locked
Odbc works, but OleDb doesn't? RRS feed

  • Question

  • User-1689199484 posted

    I have a weird problem.  I'm connecting to an Oracle database using a TSN-less connection string.  I can open the connection just fine, but when I try to retrieve data, nothing happens, no error message or anything.  For example:

    string connString = "Provider=OraOLEDB.Oracle;Data Source=(DESCRIPTION=(CID=GTU_APP)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=myHost)(PORT=myPort)))(CONNECT_DATA=(SID=MyOracleSID)(SERVER=DEDICATED)));User Id=myUsername;Password=myPassword;";

    OleDbConnection conn = new OleDbConnection(connString);
    conn.Open();

    OleDbCommand comm = new OleDbCommand("select myString from myTable", conn);
    OleDbDataReader dr = comm.ExecuteReader();

    while (dr.Read())
    {
    Response.Write(dr.GetString(0));
    }

    ...

    It doesn't work.  I don't get any error messages or exceptions, the output is just nothing.

    Now, when I use that exact same code using using a DSN and System.Data.Odbc (i.e. connString = "DSN=myDSN; UID=myUID; PWD=myPWD;"; it works.  I can't seem to figure out why OleDb won't work???

    Monday, May 9, 2011 7:59 PM

All replies

  • User197322208 posted

    are you connecting to the same server/database with the same username/pwd ?

    Tuesday, May 10, 2011 12:42 AM
  • User-1689199484 posted

    Yes, I double checked it and everything.  I will triple check it again, but any other suggestions?

    Tuesday, May 10, 2011 12:19 PM