To read a connection string from a notepad

i want to read the DSN-less connection string from a notepad that is from a text file so that if server ip address changes then it will be easy to change the ip address in the notepad rather than changing the code .we are using jsp.
Connection con=DriverManager.getConnection("jdbc:odbc:DRIVER={SQL Server};Database=profile;Server=10.11.144.124;uid=sa;pwd=sa123");
so this connection should be read from the text file
any suggestions
Thanks for ur help

i want to read the DSN-less connection string from a
notepad that is from a text file so that if server ip
address changes then it will be easy to change the ip
address in the notepad rather than changing the code
.we are using jsp.
Connection
con=DriverManager.getConnection("jdbc:odbc:DRIVER={SQL
Server};Database=profile;Server=10.11.144.124;uid=sa;p
wd=sa123");
so this connection should be read from the text file
ny suggestions
Thanks for ur help=> Good way of getting the DSN or any other setting from a text file is create a simple bean(will have get and may have set method too)that will read the data from the text file and use the bean anywhere in your jsp page(As it will also improve the performance of the application)and the bean initilizd once can be reused anywhere in the application.

Similar Messages

  • Retrieve data source connection string from reportserver.dbo.DataSource

    I would like to retrieve the connection string (and credentials) for each of my data sources (without having to click on each individual item). The DataSource table has a column called ConnectionString, but the data type is image, which cannot be converted to varchar. Does anyone have any ideas of how to pull this information from the database?
    I have tried converting to binary/varbinary, and then converting to varchar, but I get garbage back.
    Note: I am currently using SSRS 2005
    Thanks,
    Marianne

    Hi Jin,
    I downloaded your script and was impressed with the information it retrieves, however, it is not formatted very well with the name of each data source being on the same line as the previous data source so I updated the script to create a blank line between
    each data source block, and also to include the login credentials used by the data source, and the path for the data source, which is very useful in being able to locate the data source for editing in Report Manager. However, it is not retrieving all data
    sources and I don't know why. I know this for a fact because there are data sources defined that are not in the output of this script but I don't know enough about VB to improve the script further, or how the report server is configured to ensure the code
    finds the missing data sources.
    Here's the updated script.
    '=============================================================================
    '  File:      PublishSampleReports.rss
    '  Summary:  Demonstrates a script that can be used with RS.exe to
    '      publish the sample reports that ship with Reporting Services.
    ' This file is part of Microsoft SQL Server Code Samples.
    '  Copyright (C) Microsoft Corporation.  All rights reserved.
    ' This source code is intended only as a supplement to Microsoft
    ' Development Tools and/or on-line documentation.  See these other
    ' materials for detailed information regarding Microsoft code samples.
    ' THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
    ' KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
    ' IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
    ' PARTICULAR PURPOSE.
    Public Sub Main()
        rs.Credentials = System.Net.CredentialCache.DefaultCredentials
        'Create the parent folder
        GetCatalogItems(String.Empty)
    End Sub
        ' <summary>
        ' recursivly get folder items from report
        ' server catalog; render to treeview control
        ' </summary>
        ' <param name="catalogPath"></param>
        ' <param name="parentNode"></param>
        Public Sub GetCatalogItems(ByVal catalogPath As String)
            Dim items As CatalogItem()
            Try
                ' if catalog path is empty, use root, if not pass the folder path
                If catalogPath.Length = 0 Then
                    ' no recursion (false)
                    items = rs.ListChildren("/", False)
                Else
                    ' no recursion (false)
                    items = rs.ListChildren(catalogPath, False)
                End If
                ' iterate through catalog items and populate treeview control
                For Each item As CatalogItem In items
                    ' if folder is hidden, skip it
                    If item.Hidden <> True Then
                        ' ensure only folders are rendered
                        If item.Type.Equals(ItemTypeEnum.DataSource) Then
                            'use the GetDataSourceContents to get the definition of the data source.
                            Dim definition As DataSourceDefinition = Nothing
                            Try
                                definition = rs.GetDataSourceContents(item.Path)
                                Console.WriteLine(item.Name)
                                Console.WriteLine(item.Path)
                                Console.WriteLine("Connection String: {0}", definition.ConnectString)
                                Console.WriteLine("Extension name: {0}", definition.Extension)
                                Console.WriteLine("UserName: {0}", definition.UserName)
                            Catch e As SoapException
                                Console.WriteLine(e.Detail.InnerXml.ToString())
                            End Try
                            Console.WriteLine(item.Name)
                            Console.WriteLine()
                        ElseIf item.Type.Equals(ItemTypeEnum.Folder) Then
                            ' recurse                     
                            GetCatalogItems(item.Path)
                        End If
                    End If
                Next
            Catch ex As Exception
                Console.WriteLine(ex.Message)
            Finally
                'Do nothing
            End Try
        End Sub
    To run this I use:
    rs -i GetPropertiesOfDataSources.rss -s
    http://<reportserver_name>/reportserver > DataSources_<reportserver_name>.txt
    But as I mentioned it is not picking up all of the data sources and I don't know why. I also don't know why it's so difficult to find all the data sources from within Report Manager. I'm new to SSRS but was told that prior to SQL 2005, this information was
    easily available using Management Studio to connect to the report server but now it's buried in the Report Manager and not accessible from one spot. Bad move by Microsoft apparently. You'd think that there would be an easy way to find all of the data sources.
    We need to migrate the SQL Servers on which reports are running, but we have tons of reports and, historically, little documentation for them so we need to be able to determine where all the data sources are so we know which to update. This is proving extremely
    difficult. Your script helps but is not comprehensive.
    Any and all help is appreciated.
    Michael MacGregor, Senior SQL Server DBA, Carlson Marketing

  • Problem - reading an abitrary string from the command line in basic swing

    Hi,
    I'm sorry if this problem is a bit basic, but I've only just started swing in Java. Anyway, I'm trying to adapt a basic swing version of the HelloWorld class. When I try to pass an abitrary string from the command line to the label within the class, I get the following error,
    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 1
            at week2.HelloWorldSwing_commandline.main(HelloWorldSwing_commandline.java:31)
    Java Result: 1I must be missing something because I can't see where the problem is in the following code.
    import javax.swing.*;
    import java.awt.*;
    public class HelloWorldSwing_commandline {
        String message;
        private static void createAndShowGui(String message){
            JFrame.setDefaultLookAndFeelDecorated(true);
            JFrame frame = new JFrame("HelloWorldSwing");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            JLabel label = new JLabel(message);
            Container content = frame.getContentPane();
            content.add(label);
            frame.pack();
            frame.setVisible(true);
        public static void main(String[ ] args) {
         createAndShowGui(args[1]);
    }Any help would really be appreciated.

    Hi,
    I've tried changing the index value to O in the main method, but I still get the same error.
    I'm running this in NetBeans 4.1, and when I try to run the class I get the error as listed above.
    Any ideas how to correct this error?
    Thanks

  • JDBC connection string from POJOs

    I have created a new connection named ConnDB. It was added in Application Resources/Descriptions in file connections.xml.
    I want to access this connection string in my POJOs. How do I grab my connection?

    example :
            DCIteratorBinding dciterb =(DCIteratorBinding)dcbind.get("ParcelsView1Iterator");
            dciterb.executeQuery();
            DCDataControl dc = dciterb.getDataControl();
            ApplicationModule am = (ApplicationModule)dc.getDataProvider();
            Statement st = am.getDBTransaction().createStatement(0);rg Thomas

  • Reading large large string from database

    I am reading is a large string value. It's data type in Oracle is CLOB. I was originally casting it to vARCHAR2(4000) in the select statement, but just realized the data can be larger than 4000. I took out the cast and have tried changing to several data types, but they all error out. How can I read in string data greater than 4000 characters?

    You must use Java to do this, the Execute Script operation makes it simple. I have put together a little process to demonstrate, and I can paste the Java from the Execute Script step below.
    It's all in the data-typing. In the sample I built, the BigString and NewBigString process variables are of LiveCycle type "string" with unlimited size. These become CLOBs in the database. When read as a CLOB object using JDBC, converted to Java Strings, they then can be loaded into the LiveCycle Process data and the API handles the rest.
    Let me know if I'm not clear enough with my explanation.
    Jeff A Yates
    http://www.avoka.com
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import javax.sql.DataSource;
    import javax.naming.InitialContext;
    int processId = patExecContext.getProcessDataIntValue("/process_data/@id");
    InitialContext context = new InitialContext();
    Connection connection = ((DataSource)context.lookup("java:/IDP_DS")).getConnection();
    String queryQuery = "select bigdocument, bigstring from tb_pt_workwithxlobs where process_instance_id = ?";
    PreparedStatement queryStatement = connection.prepareStatement(queryQuery);
    try {
    queryStatement.setInt(1, processId);
    ResultSet results = queryStatement.executeQuery();
    results.next();
    java.sql.Blob documentBlob = results.getBlob(1);
    com.adobe.idp.Document document = new com.adobe.idp.Document(documentBlob.getBinaryStream());
    patExecContext.setProcessDataValue("/process_data/@NewBigDocument", document);
    java.sql.Clob stringClob = results.getClob(2);
    patExecContext.setProcessDataValue("/process_data/@NewBigString", stringClob.getSubString(1L, (int)stringClob.length()));
    } catch(Exception ex) {
    ex.printStackTrace();
    queryStatement.close();
    connection.close();

  • Oracle 8i/9i connection string?

    We have two computers:
    Computer X:
    Windows 2000 Advanced Server
    Oracle 9i (9.2.0.1)
    DHCP IP address: 10.140.4.74
    Oracle SID: XXX
    Computer name: ZZZ
    Computer Y:
    Windows 2000 Professional
    Oracle 8i (8.1.7)
    IP address static: 10.140.2.4
    Oracle SID: YYY
    Computer name: YYY
    On client computer we install Oracle 6i Runtime and we make one connection string to Oracle 9i database. Connection String XXX TCP/IP 10.140.4.74 and SID XXX. (Others connection strings thru Oracle Net8 Easy config is deleted.)
    When we start SQL*Plus from client computer and If we enter scott/tiger@YYY Sql*plus will connect to Oracle 8i database?
    If we create form and in ON-LOGON trigger we put
    logon('scott/tiger@YYY'); Form will be connected to Oracle 8i database? But there is NO connection string YYY on client computer?
    Also if we connect thru SQL*Plus on Oracle 9i server to Oracle 9i database and then we try to reconnect to Oracle 8i database with "conn scott/tiger@YYY" it will reconnect to Oracle 8i database.
    How it is possible that we can connect to Oracle 8i database without defined connection string from the client computer or from Oracle 9i server?

    Please try reposting this to the OLEDB forum for best results....

  • Adworker using wrong JDBC connect string during upgrade to 12.1.3

    Our env
    APPS - 12.1.2 - running on SLES 11
    DB 11.2.0.3 - running on IMB System z
    We cloned PROD to a new host (instance was previously on DB host - debsdb01 and app host debsap03)
    The clone was made to debsdb04 - and app was reconfigured on debsap03
    I got the app to start up and run before taking it down to apply the 12.1.3 patch.
    However, in the process of the 12.1.3 patch, I see the following entry in the ADworker log files.
    JDBC connect string from AD_APPS_JDBC_URL is
    (DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=YES)(FAILOVER=YES)(ADDRESS=(PROTOCOL=tcp)(HOST=hostname1.companyname.com)(PORT=1549)))(CONNECT_DATA=(SID=DEV3)))
    where as it should be
    JDBC connect string from AD_APPS_JDBC_URL is
    (DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=YES)(FAILOVER=YES)(ADDRESS=(PROTOCOL=tcp)(HOST=hostname4.companyname.com)(PORT=1535)))(CONNECT_DATA=(SID=DEV3)))
    If I do an echo $AD_APPS_JDBC_URL on debspap03, it returns
    JDBC connect string from AD_APPS_JDBC_URL is
    (DESCRIPTION=(ADDRESS_LIST=(LOAD_BALANCE=YES)(FAILOVER=YES)(ADDRESS=(PROTOCOL=tcp)(HOST=hostname4.companyname.com)(PORT=1535)))(CONNECT_DATA=(SID=DEV3)))
    Where are the ADWORKERS getting the old value of the DB host name?
    Any help would be appreciated.
    Thanks
    Edited by: 864641 on Sep 16, 2012 7:32 AM

    I believe figured out what the issue was.
    I was (am) running the patch session from a VNC session that was established during the previous version of this instance - so the previous connect string was being used.
    Once I killed the old VNC session and established a new one, I was able to retrieve the correct value for $AD_APPS_JDBC_URL from the command prompt.
    Yes - the value of the $AD_APPS_JDBC_URL was showing the old value in the old VNC session.
    Thanks for all of your input esp on a Saturday - when I thought I would have to wait until Monday to get this figured out.

  • When Adjusting PowerPivot Data Source it's not updating "Connection String" In Workbook

    When going into an existing PowerPivot that already has a data connection to a MySQL database, I am having issues when trying to edit that data connection. Within the PowerPivot>Manage window, here is what my connection string looks like.
    It successfully connects and I am able to refresh the data. My issue is, why when going to the Data>Connections>Custom>Properties>Definition area --- Why is the connection string not updating here? It's the same connection string from before
    I modified it in the powerpivot manage window. I need it to be updated to my new connection string credentials. Here is window I'm talking about.
    Any help is greatly appreciated!!!! Thank you!

    Tim, are you still trying to get this figured out?
    Thanks!
    Ed Price, Azure & Power BI Customer Program Manager (Blog,
    Small Basic,
    Wiki Ninjas,
    Wiki)
    Answer an interesting question?
    Create a wiki article about it!

  • Howto read url query string? Help :(

    Hi everyone, I am trying to read the query string from within an applet loaded from a URL. I am loading netscape with the following URL
    "http://localhost/mypage.html?param1=help"
    I am using code:
    System.out.println(getDocumentBase().getQuery());
    and all I am getting is a null?
    This works with appletviewer so could someone tell me what is going on. I have searched the forum but it seems no answer yet exists for this. Perhaps its not possible?
    Info:
    OS: Redhat Linux 8
    java version "1.3.1_02"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1_02-b02)
    Java HotSpot(TM) Client VM (build 1.3.1_02-b02, mixed mode)

    hi,
    can it be that there is a problem with netscape?
    it would suggest to try on ie, but you use linux and i dont think theres an ie-version for linux available ;P
    i would try it on a different browser like opera or something.
    thats my suggestion.
    hope this helped
    cu Errraddicator

  • Connection String not in

    Hello:
       I have a strange problem. I have an addon that using single sign on to connect to UI and DI together. I uses the connstring = System.Convert.ToString(Environment.GetCommandLineArgs().GetValue(1)); to get the connection string from UI. I can do it from Release mode(and it's not the debugging connection string, it's the real application connection string. But can't do it with the .exe inside the release fold. keeping getting the out or array index exception, which means that line didn't grab the connection string from UI (my SBO is on)Is this normal? Here's the details
       I am using SBO 2005A(6.80.317) SP: 01 PL: 04. UI-API I am using is version: 6.8.0.0. DI-API I am using is 2005.0.0.0.
       I am keep on thinking that it might be the wrong UI that I am using, but the fact that it connect to it in the release mode means it should be ok! So what's my problem? Thank You!
    Here's my entire code:
    private void setapplication()
                   // connect to SBO GUI application
                string connstring = string.Empty;
                   SAPbouiCOM.SboGuiApi sboapi = new SAPbouiCOM.SboGuiApiClass();
                try
                    connstring = System.Convert.ToString(Environment.GetCommandLineArgs().GetValue(1));
                    MessageBox.Show(connstring);
                catch
                    MessageBox.Show("No connection String");
                    System.Environment.Exit(0);
                   try
                        sboapi.Connect(connstring);
                   catch(Exception ex)
                        MessageBox.Show(ex.Message);
                        System.Environment.Exit(0);
                   global.oapplicaiton = sboapi.GetApplication(-1);
    Message was edited by: Bo Peng

    Hi Bo,
    If you just start the exe by itself, you have to supply the connectionstring yourself.
    If the exe is started as an addon by SBO the connection string is supplied by SBO.
    regard
    Ad

  • Help with deleting multiple strings from file.......

    I am trying to delete the same string that may appear multiple times in the file. Here is the output to the screen. Here is the code. I have been researching the delete method it says that I have to start at an index position in the string but how would I find out where the multiples strings reside in the file? I am getting the feeling that it won't work for my purpose..???? I am trying to delete all ot the strings "a string of data3" from the file.
    Output
    C:\TestRead>java StringDelete
    Temp String file_data-------- a string of data3a string of data2a string of data
    1a string of data3a string of data2a string of data1a string of data3
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data3
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data2
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data1
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data3
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data2
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data1
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    String toDelete-------- a string of data3
    Just A Blank Line
    Just A Blank Line
    Just A Blank Line
    Code:
    import java.io.*;
    public class StringDelete
    public static void main(String [] args)
    try
    FileInputStream fis = new FileInputStream("TestFile.txt");
    DataInputStream in = new DataInputStream(fis);
    StringBuffer file_data = new StringBuffer();
    while(in.available() > 0)
    String temp = in.readUTF(); // read in a string from the file
    file_data.append(temp); // append it to the buffer
    System.out.println("Temp String file_data-------- " + file_data);
    System.out.println("Just A Blank Line");
    System.out.println("Just A Blank Line");
    System.out.println("Just A Blank Line");
    boolean keepGoing = true;
    while(keepGoing)
    String toDelete = file_data.substring(0, "a string of data3".length());
    System.out.println("String toDelete-------- " + toDelete);
    System.out.println("Just A Blank Line");
    System.out.println("Just A Blank Line");
    System.out.println("Just A Blank Line");
    if(toDelete == null || toDelete.equals("") )
    keepGoing = false;
    else
    file_data.delete(0,"a string of data3".length());
    catch(IOException e)
    e.printStackTrace();

    Here is the output. I am trying to get each part to work before I go on to the next part that is why some code is commented out.
    I need help to know why string "a string of data3" is not deleted in the towrite string??
    Output:
    C:\TestRead>java NewStringDelete
    String v after remove [ &#9668;a string of data3 &#9668;a string of data2 &#9668;a string of data1
    &#9668;a string of data3 &#9668;a string of data2 &#9668;a string of data1 &#9668;a string of data3]
    String towrite after remove &#9668;a string of data3 &#9668;a string of data2 &#9668;a string of
    data1 &#9668;a string of data3 &#9668;a string of data2 &#9668;a string of data1 &#9668;a string of data
    3
    Code:
    import java.util.Vector;
    import java.io.*;
    public class NewStringDelete
         public static void main(String [] args)
              //String ls = System.getProperty("line.separator");
              //File file;
              Vector v=new Vector();
         try{
              BufferedReader br=new BufferedReader(new FileReader ("TestFile.txt"));
              String s;
              while ((s=br.readLine())!=null)
                   {v.addElement(new String(""+s));}
                        br.close();
         catch(IOException e)
                   e.printStackTrace();
    /*now you have a Vector containing String objects..*/
         String remove = ("a string of data3");
         String towrite="";
    System.out.println("String v after remove " + v);     
         for (int i=0; i<v.size();i++)
              String ss = (String)v.elementAt(i);
              if (ss.equalsIgnoreCase(remove)){continue;}
              //     towrite=towrite+ss+ls;
                   towrite=towrite+ss;
    System.out.println("");               
    System.out.println("");               
    System.out.println("String towrite after remove " + towrite);                    
    /*do filewrite*/
    //try{
    // FileWriter fw=new FileWriter(TestFile.txt);
    // fw.write(towrite);
    // fw.close();
    // catch(IOException e)
    //               e.printStackTrace();

  • Connection Strings for SQL Server 2012

    I have installed SQL Server 2012 on my machine. 
    I did not install a user_id or password.
    I have a working website with "Remote Access" Role installed.
    I have tried many different connection strings from
    http://www.connectionstrings.com/sql-server-2012/:  
    This stood out:
    Server=(localdb)\v11.0;Integrated Security=True;AttachDbFileName=C:\inetpub\wwwroot\App_Data\db.mdf;Trusted_Connection=True;
    Error Code:
    System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.

    I would recommend asking them in SQL forums: https://social.technet.microsoft.com/Forums/en-us/home?forum=sqlgetstarted&filter=alltypes&sort=lastpostdesc
    This posting is provided AS IS with no warranties or guarantees , and confers no rights.
    Ahmed MALEK
    My Website Link
    My Linkedin Profile
    My MVP Profile

  • How to specifiy the provider to be Oracle.ManagedDataAccess.Client when creating a dynamic connection string with EF Code First from Database?

    I am trying to use the relatively new Code First from Database with the newest EF (6.x) and on an Oracle database (11g, but I have installed the newest ODTwithODAC). First of all, it works fine as long as the connection string is inside the App.Config file. But when I try to build it dynamically in the C# code (or rather, statically at the moment) it fails. I have it working with a dynamically built connection string when doing Model from Database though, so I'm at a loss right now.
    First, I have created a second constructor for the context class that takes a string and does base(connectionString). Then I build the connection string via
    OracleConnectionStringBuilder oracleBuilder = new OracleConnectionStringBuilder();
    oracleBuilder.DataSource = "TEST.BLA.COM";
    oracleBuilder.UserID = "ABC";
    oracleBuilder.Password = "abc";
    oracleBuilder.PersistSecurityInfo = true;
    string connection = oracleBuilder.ToStrin();
    Now trying to open an EntityConnection by giving to it this provider-specific connection string (or even the static one from the App.Config) doesn't work; I get "keyword not supported: user id"). Trying it by creating a context and giving this connection string doesn't work either. I'm pretty sure that this is because I didn't specify the provider to use; after all, it should use the Oracle.ManagedDataAccess.Client provider and not an SQL Server based one.
    I then tried to get around this by using an EntityConnectionStringBuilder on top and specifying the provider keyword there, but then I get "keyword not supported: provider" when using it in the context constructor, and "the 'metadata' keyword is always required" when using it with the EntityConnection constructor.
    As I said above: I bet it's the provider that I have to specify somehow, but I don't know how. The code that does work is the following:
    using (var context = new Model())
    context.Database.Connection.Open();
    context.Database.Connection.Close();
    When I read context.Database.Connection.ConnectionString, it is exactly the provider-specific connection string I created above, but I don't know where to specify the provider again. Do you know of any way to do this? Certainly there must be one.
    PS: I have also posted this question on http://stackoverflow.com/questions/27979454/ef-code-first-from-database-with-managed-oracle-data-access-dynamic-connection because it is quite urgent and I'd like to use Code First from Database. Otherwise I'd have to go "back" to using Model from Database again, which is not ideal because we have updatable views where the .edmx-file has to be edited after every reload of the model, while with Code First from DB inserting into the view automatically works.

    I am trying to use the relatively new Code First from Database with the newest EF (6.x) and on an Oracle database (11g, but I have installed the newest ODTwithODAC). First of all, it works fine as long as the connection string is inside the App.Config file. But when I try to build it dynamically in the C# code (or rather, statically at the moment) it fails. I have it working with a dynamically built connection string when doing Model from Database though, so I'm at a loss right now.
    First, I have created a second constructor for the context class that takes a string and does base(connectionString). Then I build the connection string via
    OracleConnectionStringBuilder oracleBuilder = new OracleConnectionStringBuilder();
    oracleBuilder.DataSource = "TEST.BLA.COM";
    oracleBuilder.UserID = "ABC";
    oracleBuilder.Password = "abc";
    oracleBuilder.PersistSecurityInfo = true;
    string connection = oracleBuilder.ToStrin();
    Now trying to open an EntityConnection by giving to it this provider-specific connection string (or even the static one from the App.Config) doesn't work; I get "keyword not supported: user id"). Trying it by creating a context and giving this connection string doesn't work either. I'm pretty sure that this is because I didn't specify the provider to use; after all, it should use the Oracle.ManagedDataAccess.Client provider and not an SQL Server based one.
    I then tried to get around this by using an EntityConnectionStringBuilder on top and specifying the provider keyword there, but then I get "keyword not supported: provider" when using it in the context constructor, and "the 'metadata' keyword is always required" when using it with the EntityConnection constructor.
    As I said above: I bet it's the provider that I have to specify somehow, but I don't know how. The code that does work is the following:
    using (var context = new Model())
    context.Database.Connection.Open();
    context.Database.Connection.Close();
    When I read context.Database.Connection.ConnectionString, it is exactly the provider-specific connection string I created above, but I don't know where to specify the provider again. Do you know of any way to do this? Certainly there must be one.
    PS: I have also posted this question on http://stackoverflow.com/questions/27979454/ef-code-first-from-database-with-managed-oracle-data-access-dynamic-connection because it is quite urgent and I'd like to use Code First from Database. Otherwise I'd have to go "back" to using Model from Database again, which is not ideal because we have updatable views where the .edmx-file has to be edited after every reload of the model, while with Code First from DB inserting into the view automatically works.

  • Deployment from 11g to 10g connection string cannot get provider error.

    Hi, I'm doing a deployment from oracle client 11g to 10g. Is this possible? there are yes and no answer I have try out from the forum. All did not workout with any of the configuration setup.
    For development I am using VS2012, MVC 4. EF 4. Oracle 11g
    The server is currently running Oracle 10g with Oracle.Dataaccess.dll 10.2.0.100
    This is my connection string setup at the server.
    <?xml version="1.0"?>
    <!--
    For more information on how to configure your ASP.NET application, please visit
    http://go.microsoft.com/fwlink/?LinkId=169433
    -->
    <configuration>
    <configSections>
    <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=4.4.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
    </configSections>
    <connectionStrings>
    <add name="OraAspNetConnectionString" connectionString="Data Source=dtsr;User Id=ids;Password=pwd;" providerName="Oracle.DataAccess.Client"/>
    <add name="OraAspNetConnectionString2" connectionString="Data Source=dtsr;User Id=ids;Password=pwd;" providerName="Oracle.DataAccess.Client.OracleConnection"/>
    </connectionStrings>
    <!--<startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
    </startup>-->
    <appSettings>
    <add key="webpages:Version" value="2.0.0.0"/>
    <add key="webpages:Enabled" value="false"/>
    <add key="PreserveLoginUrl" value="true"/>
    <add key="ClientValidationEnabled" value="true"/>
    <add key="UnobtrusiveJavaScriptEnabled" value="true"/>
    </appSettings>
    <system.data>
    <DbProviderFactories>
         <add name="Oracle Data Provider for .NET" invariant="Oracle.DataAccess.Client" description="Oracle Data Provider for .NET" type="Oracle.DataAccess.Client.OracleClientFactory,Oracle.DataAccess,Version=4.112.3.0,Culture=neutral,PublicKeyToken=89b483f429c47342" />
    </DbProviderFactories>
    </system.data>
    <system.web>
    <compilation targetFramework="4.0">
    <assemblies>
    <add assembly="System.Data.Entity, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
    <add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add assembly="System.Web.Helpers, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    </assemblies>
    </compilation>
    <httpRuntime/>
    <authentication mode="Windows"/>
    <identity impersonate="true"/>
    <pages controlRenderingCompatibilityVersion="4.0">
    <namespaces>
    <add namespace="System.Web.Helpers"/>
    <add namespace="System.Web.Mvc"/>
    <add namespace="System.Web.Mvc.Ajax"/>
    <add namespace="System.Web.Mvc.Html"/>
    <add namespace="System.Web.Optimization"/>
    <add namespace="System.Web.Routing"/>
    <add namespace="System.Web.WebPages"/>
    </namespaces>
    </pages>
    <sessionState mode="InProc" timeout="20" cookieless="false"/>
    </system.web>
    <system.webServer>
    <validation validateIntegratedModeConfiguration="false"/>
    <handlers>
    <remove name="ExtensionlessUrlHandler-ISAPI-4.0_32bit"/>
    <remove name="ExtensionlessUrlHandler-ISAPI-4.0_64bit"/>
    <remove name="ExtensionlessUrlHandler-Integrated-4.0"/>
    <add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0"/>
    <add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0"/>
    <add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG,PUT,DELETE,PATCH,OPTIONS" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0"/>
    </handlers>
    <security>
    <authorization>
    <add accessType="Allow" users="?"/>
    </authorization>
    </security>
    </system.webServer>
    <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
    <dependentAssembly>
    <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
    <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
    </dependentAssembly>
    <dependentAssembly>
    <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
    <bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
    </dependentAssembly>
    <dependentAssembly>
    <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
    <bindingRedirect oldVersion="1.0.0.0-2.0.0.0" newVersion="2.0.0.0"/>
    </dependentAssembly>
    <!--<dependentAssembly>
    <assemblyIdentity name="Oracle.DataAccess, Version=10.2.0.100, Culture=Neutral," publicKeyToken="89b483f429c47342" />
    <bindingRedirect oldVersion="10.2.0.100" newVersion="4.112.3.0"/>
              <publisherPolicy apply="no" />
    </dependentAssembly>-->
    </assemblyBinding>
    </runtime>
    <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework"/>
    </entityFramework>
    </configuration>
    I get this error when page trying to connect to database.
    [ProviderIncompatibleException: An error occurred while getting provider information from the database. This can be caused by Entity Framework using an incorrect connection string. Check the inner exceptions for details and ensure that the connection string is correct.]
    System.Data.Entity.ModelConfiguration.Utilities.DbProviderServicesExtensions.GetProviderManifestTokenChecked(DbProviderServices providerServices, DbConnection connection) +163
    System.Data.Entity.ModelConfiguration.Utilities.DbConnectionExtensions.GetProviderInfo(DbConnection connection, DbProviderManifest& providerManifest) +39
    System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection) +46
    System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext internalContext) +62
    System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input) +117
    System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +453
    System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +18
    System.Data.Entity.Internal.Linq.InternalSet`1.Initialize() +56
    System.Data.Entity.Internal.Linq.InternalSet`1.get_InternalContext() +15
    System.Data.Entity.Infrastructure.DbQuery`1.System.Linq.IQueryable.get_Provider() +37
    I have check the
    1. Enviroment Variables path is set to the 10.../client_1/
    2. Tnsname.ora already configured.
    3. machine.config did not define the connection string path, as it is define in the web.config
    4. Oracle.Dataaccess.dll is in the bin of my application website (v4.112.3.0).
    5. In my application web bin folder also include additional dlll.
    mfc71.dll
    msvcr71.dll
    oci.dll
    ociw32.dll
    orannzsbb11.dll
    oraocci11.dll
    oraociicus11.dll
    OraOps11w.dll
    Anyone please help.. Thanks in advance..
    Edited by: 976886 on Dec 13, 2012 7:46 PM

    976886 wrote:
    I want to know, it is possible to migrate the application from oracle 11g to 10g? such that the component are supported across?
    Because in the development, all goes well, no error on the oracle connection.
    OR did I miss out anything that causes it not working on my server deployment?yes
    yes
    yes
    how can we reproduce what you claim?

  • How to retreive String from the Connection object

    hi all,
    I am using HttpConnection to Connect to the server.I want to retreive string from the Connection.
    As like Connection.openInputStream() is there any method to get the String from the connection.In the server side also i want to send the String not the stream .
    Thanks in advance
    lakshman

    Just read the string from the stream.

Maybe you are looking for