Last post Nov 07, 2013 05:09 AM by sridhar_rs
Nov 06, 2013 10:15 AM|er_abhi|LINK
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.
- 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.
Nov 06, 2013 10:19 AM|sridhar_rs|LINK
What error message that you are getting when you are trying to connect the DB server?
Nov 06, 2013 10:22 AM|er_abhi|LINK
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
Nov 06, 2013 10:26 AM|sridhar_rs|LINK
Would it be possible to share your code and let us know which line is throwing an exception.
Nov 06, 2013 10:27 AM|mahedee|LINK
Hope the following reference help you.
Nov 06, 2013 10:33 AM|er_abhi|LINK
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)
DataTable dt = new DataTable();
//dt.Load(new OracleCommand(SqlQuery, dbCon).ExecuteReader());
dt.Load(new OleDbCommand(SqlQuery, oleCon).ExecuteReader());
resultObj = dt;
catch (Exception ex)
resultObj = ex;
if (oleCon != null && oleCon.State == ConnectionState.Open)
Nov 06, 2013 11:32 AM|sridhar_rs|LINK
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.
Nov 06, 2013 11:46 AM|er_abhi|LINK
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.
Nov 06, 2013 12:29 PM|sridhar_rs|LINK
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!
Nov 06, 2013 12:41 PM|er_abhi|LINK
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
Nov 06, 2013 12:52 PM|sridhar_rs|LINK
I thought you have already installed 10g 32-bit. If not try installing 10g 32-bit first.
Nov 06, 2013 12:58 PM|er_abhi|LINK
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.
Nov 07, 2013 03:38 AM|er_abhi|LINK
Now i can see the actual error which is
ORA-12154: TNS:could not resolve the connect identifier specified
Nov 07, 2013 03:46 AM|mahedee|LINK
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.
Nov 07, 2013 03:51 AM|er_abhi|LINK
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.
Nov 07, 2013 05:09 AM|sridhar_rs|LINK
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,