Results 1 to 3 of 3

Thread: ODBC to Oracle...problem!!!!

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602

    ODBC to Oracle...problem!!!!

    I have read about this problem before on forums, but I think mine is a bit special.

    I am strying to get data from an oracle db, by using a WORKING ODBC connection. I have used this ODBC connection with crystal reports, so I know it is working. Now, I downloaded microsofts .net odbc (Microsoft.Data.Odbc; ) and from within my .NET application I have problems.

    1)The Oracle DB contains several instances (like databases in SQL). How can I in the connection string, specify which one I want to work with??????

    2)How should a CORRECT connection string look like? I want to connect by using the DSN.

    3)I get the error that Oracle client software isn't installed when I run the application. That's correct I am not using oracle software on my workstation. I don't want to use it either...

    Here is the code Im using... faulty
    PHP Code:
    using Microsoft.Data.Odbc;  

    namespace 
    oracle_odbc_lab
    {
        
    /// <summary>
        /// Summary description for WebForm1.
        /// </summary>
        
    public class WebForm1 System.Web.UI.Page
        
    {
            private 
    void Page_Load(object senderSystem.EventArgs e)
            {
                
    // Build a connection and SQL strings
                
    string connectionString 
                    
    = @"Driver={Microsoft ODBC for Oracle};Server=testing.BMCEDS;UID=eda_user;PWD=eda" ;
                
    string SQL "SELECT NAME FROM DATASOURCE";
                
    // Create connection object
                
    OdbcConnection conn = new OdbcConnection(connectionString);        
                
    // Create command object
                
    OdbcCommand cmd = new OdbcCommand(SQL);
                
    cmd.Connection conn;    
                
    // Open connection
                
    conn.Open();
                
    // Call command's ExecuteReader
                
    OdbcDataReader reader cmd.ExecuteReader();
                
    // Read the reader and display results on the console
                
    while (reader.Read()) 
                {
                    
    Response.Write("Name:" reader.GetString(0).ToString());
                    
    Response.Write(" ,"); 
                    
                    
    //Console.WriteLine("Customer:" + reader.GetString(1).ToString() );
                
    }
                
    // close reader and connection
                
    reader.Close();
                
    conn.Close();

            } 

    And we have made the mapping to the instance at the central oracle client (not my workstation). But that shouldn't matter since I am trying to use a WORKING LOCAL ODBC.

    anyone who can help?

    kind regards
    Henrik

  2. #2

    Thread Starter
    Frenzied Member
    Join Date
    May 2002
    Posts
    1,602
    I have also tried:

    PHP Code:
    string connectionString 
                    
    = @"Provider=MSDAORA;DSN=testing;UID=eda_user;PWD=eda" 

    and get the same problem.. that the oracle client components wheren't found. But then why on earth is it working with Crystal Reports and my current ODBC connection (testing, which is mappend to the instance BMCEDS...


    I might tell you that the oracle client isn't installed locally, but rather mapped as a network path. When I run sqlplus from the network location everything is working fine, also everything is working fine from CR, but NOT from developer studio...

    kind regards
    Henrik
    Last edited by MrNorth; Mar 3rd, 2003 at 10:40 AM.

  3. #3
    Frenzied Member MrGTI's Avatar
    Join Date
    Oct 2000
    Location
    Ontario, Canada
    Posts
    1,277

    Question

    Just a quick stab at it, but have you checked out ConnectionStrings.com ?
    ~Peter


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width