locked
Oracle 10g connectivity issue with .net 2.0 website hosted on win 2008 server RRS feed

  • Question

  • User398825048 posted

    Hi guys,

    PLZ help me!

    Scenario - My client has 2 server machine. one is database server with oracle 10g database 64-bit. Another server(new one) is windows 2008 server which has an .net 2.0+3.5 website hosted. This website make use of System.data.oracleClient dll . Problem is that this app is not able to connect to oracle 10g database server though it is able to connect to some other 11g R2 database server. On this app server we have also tried to install oracle 10g 32-bit client but still can't access. Tnsping and sqlplus is working fine. Pls. suggest.

    Solution that we tried :- 

    - Gave permission and added various users to oracle directory and sub-directory like IIS_Iuser,network service, anonymous etc.

    Possible culprit:-

    - Earlier on this app server oracle 11g 32-bit client was installed. So my client has although worked on to remove it by manually deleting folder , deleting registeries , extra home directories. but it looks like a possible reason to me..

    Note - we use some internal ddl for dataaccess , so im not able to see actual error just some OLEDB exception.

    Pls help

    Wednesday, November 6, 2013 10:15 AM

All replies

  • User-1225287840 posted

    What error message that you are getting when you are trying to connect the DB server?

    Wednesday, November 6, 2013 10:19 AM
  • User398825048 posted

    i will not be able to access the exact error but this error is coming ->[InvalidCastException: Unable to cast object of type 'System.Data.OleDb.OleDbException' to type 'System.Data.DataTable'.]

    Im sure that web site is not able to open and resolve the connection to 10g database server. works fine if i connect to 11gr2 database with 11g 32 bit client

    Wednesday, November 6, 2013 10:22 AM
  • User-1225287840 posted

    Would it be possible to share your code and let us know which line is throwing an exception.

    Wednesday, November 6, 2013 10:26 AM
  • User398825048 posted

    this datalayer is implemented as an dll. 

    in the below example im certainly sure that error is thrown on olecon.open() line but this method return an object and in our class we directly cast this object to Datatable. so im getting oledbcast exception .. but this is working fine for 11g database . so Im sure this one is not able to open the connection. Again note, i dont have access to this datalayer so cant catch real exception being getting thrown

    public object ExecuteQuery_Reader(string SqlQuery)
    {
    try
    {
    DataTable dt = new DataTable();
    oleCon.Open();
    //dt.Load(new OracleCommand(SqlQuery, dbCon).ExecuteReader());
    dt.Load(new OleDbCommand(SqlQuery, oleCon).ExecuteReader());
    resultObj = dt;
    }
    catch (Exception ex)
    {
    resultObj = ex;
    throw ex;
    }
    finally
    {
    if (oleCon != null && oleCon.State == ConnectionState.Open)
    {
    oleCon.Close();
    }
    }
    return resultObj;
    }

    Wednesday, November 6, 2013 10:33 AM
  • User-1225287840 posted

    1. Do you have this connectivity problem from the day one or just occured?

    2. Have you tried connecting the DB server in VS using the Server Explorer?

    3. Looking at your exception, the error may occured in this line, dt.Load(new OleDbCommand(SqlQuery, oleCon).ExecuteReader());

        So, Try checking the sql query and see if that works and returns the data in the DB server itself.

    Let us know, if all above does not help.

    Wednesday, November 6, 2013 11:32 AM
  • User398825048 posted

    It is happening on my client's environement , coz they have now migrated to new server(windows 2008 64-bit server) though their database server is old(10g).

    1. so this connectiviity issue is realted to oracle 10g version coz it is able to connect to other 11g database server.

    2. its hosted in prod environment , dont have VS

    3. the error is with .Open() , coz its not able to connect i believe. query is fine and data is there in dbase.

    - earlier the App server was Windows 2003 and it was able to connect to 10g server. SO i guess it has to do something with New win 2008 server ,although this server is able to connect to 11g dbase.

    Wednesday, November 6, 2013 11:46 AM
  • User-1225287840 posted

    As you know the problem is not able to communicate 64-bit (win 2008) vs 32-bit (10g).

    So, try installing 32 and 64 bit version of the Oracle 11g full client and restart the server.

    Also, configure the Oracle 11g clients to support both 32 and 64 bits.

    Hope this help!

    Wednesday, November 6, 2013 12:29 PM
  • User398825048 posted

    But i guess, since i my Website needs to communicate with oralce 10g database, so why do i need to install 11g clients , dont i need to use 10g 32 bit client only?? ru sure?If you are sure, then can u pls. point me to some link for configuring 11g client to support both 32 and 64 bit

    - also note, my website is running in Enable 32-bit mode(in IIS), since system.data.oracleclient dll used by the app is for 32-bit i guess

    - also , previously we had oracle 11g 32 bit client installed which was done to access 11g database and was working fine. then when we tried to connect to 10g dbase , same exception hence removed this client and installed 10g 32 bit client

    Wednesday, November 6, 2013 12:41 PM
  • User-1225287840 posted

    I thought you have already installed 10g 32-bit. If not try installing 10g 32-bit first.

    Wednesday, November 6, 2013 12:52 PM
  • User398825048 posted

    Looks like there is some confusion. 10g 32-bit client is already installed on app server and it is giving error while connected to 10g database.

    - previously we had 11g 32-bit client installed and it was connecting fine with 11g database but not with 10g database , so it was removed as now our target dbase is 10g

    - as per your previous post, my question was that why do we need to install 11g client since we need to access 10g dbase server.

    Wednesday, November 6, 2013 12:58 PM
  • User398825048 posted

    Now i can see the actual error which is 

    ORA-12154: TNS:could not resolve the connect identifier specified

    Thursday, November 7, 2013 3:38 AM
  • User1079421601 posted

    When you installed the server version it updated the environment variables to point to the server installation and not the client installation. The definition of TNS aliases is done in tnsnames.ora and no the listener.ora. So you would have to copy the already existing entries from c:/oracle/ora_client/network/admin/tnsnames.ora to c:/oracle/product/db_1/network/admin/tnsnames.ora. Be careful that you obey the tnsnames.ora format.

    Source: http://stackoverflow.com/questions/7252286/ora-12154-tnscould-not-resolve-the-connect-identifier-specified

    Thursday, November 7, 2013 3:46 AM
  • User398825048 posted

    but we didnot installed any oracle 10 server version, it is already present on different server machine. On Web app machine, we installed oracle client 10g 32-bit to access the database server machine.

    Thursday, November 7, 2013 3:51 AM
  • User-1225287840 posted

    Could you try changing the connection string in this format,

    "Provider=OraOLEDB.Oracle.1;Password=XXXXXX;Persist Security Info=True;User ID=username;Data Source=dbname"

    Also, have a look at this link,

    http://stackoverflow.com/questions/13800602/getting-12154-tnscould-not-resolve-the-connect-identifier-specified-error-with

    Thursday, November 7, 2013 5:09 AM