I am trying to set up a data connection to an Oracle database using asp.net System.Data.Oracle. My dev machine is running Windows 7 64bit with VS 2008 Pro. The web server which will run the final site runs Windows Server 2008r2 64bit.
I have trawled the web for what drivers i require etc and there is SO much information i am completely lost as to what I need to do!
Where do I get the required Oracle drivers from the dev machine and live server and which versions do i require?
How do I install them and what additional steps do I require?
What gotchas do I need to be aware of?
Most probabaly you dont need any additional installation on server to work with oracle data as long as you are using "System.Data.Oracle" to connect to data.
ORA-12154: TNS:could not resolve the connect identifier specified
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OracleClient.OracleException: ORA-12154: TNS:could not resolve the connect identifier specified Source Error:
Line 287: {
Line 288: //Open the connection.
Line 289: oracleCmd.Connection.Open();
Because I don't have Oracle installed I don't have a tnsnames file which I think I need?
----this would be enought to connect from any client machine to any oracle DB.
----on your project add "System.Data.OracleClient" reference and namespace. (it will complain that its obsulete , but it works perfect)
----also note that you should check your connection via command prompt with the command C:\tnsping whatever . where whatever is the -----name of your oracle alias in your TNSNAMES file.
you already have oracle client or server instaled ( since oracleserver instalation also includes the client module ) becouse other wise it would say OCI.DLL missing or something like that .
---TNS:could not resolve the connect identifier specified ---means on normal circunstancies that i would have a problem on the connectionstring/TNSNAMES
1- check (SID = whatever)
your SID name
2 - checl HOST = ip_address_of_host_db your db host. ( can you ping it ? can you tnsping it? )
......
well thats about it. its very simple from a .net point of view.....the hard part its with oracle network configuration it self.
BoxheadMonke...
Member
37 Points
36 Posts
Basic steps for Oracle data access connection
Apr 13, 2012 01:52 PM|LINK
I am trying to set up a data connection to an Oracle database using asp.net System.Data.Oracle. My dev machine is running Windows 7 64bit with VS 2008 Pro. The web server which will run the final site runs Windows Server 2008r2 64bit.
I have trawled the web for what drivers i require etc and there is SO much information i am completely lost as to what I need to do!
Where do I get the required Oracle drivers from the dev machine and live server and which versions do i require?
How do I install them and what additional steps do I require?
What gotchas do I need to be aware of?
Thanks for any assistance :)
avinash_bhud...
Contributor
2881 Points
517 Posts
Re: Basic steps for Oracle data access connection
Apr 13, 2012 02:12 PM|LINK
Most probabaly you dont need any additional installation on server to work with oracle data as long as you are using "System.Data.Oracle" to connect to data.
The only pre-requisite would be .net framework.
BoxheadMonke...
Member
37 Points
36 Posts
Re: Basic steps for Oracle data access connection
Apr 13, 2012 02:37 PM|LINK
I am getting this error on my dev machine:
ORA-12154: TNS:could not resolve the connect identifier specified
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.OracleClient.OracleException: ORA-12154: TNS:could not resolve the connect identifier specified
Source Error:
Line 287: { Line 288: //Open the connection. Line 289: oracleCmd.Connection.Open();Because I don't have Oracle installed I don't have a tnsnames file which I think I need?
BoxheadMonke...
Member
37 Points
36 Posts
Re: Basic steps for Oracle data access connection
Apr 13, 2012 03:09 PM|LINK
Only get the above error when debugging!
ruipedromach...
Member
258 Points
84 Posts
Re: Basic steps for Oracle data access connection
Apr 13, 2012 11:11 PM|LINK
hi BoxheadMonkey
----------------------------------------------------------------------------------------------------------------------------------------------------
REQUISITS
----------------------------------------------------------------------------------------------------------------------------------------------------
VS2008/2010 does not matter;
.net >v2;
oracleclient ( i would suggest version 10);
----this would be enought to connect from any client machine to any oracle DB.
----on your project add "System.Data.OracleClient" reference and namespace. (it will complain that its obsulete , but it works perfect)
----also note that you should check your connection via command prompt with the command C:\tnsping whatever . where whatever is the -----name of your oracle alias in your TNSNAMES file.
----------------------------------------------------------------------------------------------------------------------------------------------------
EXAMPLE
----------------------------------------------------------------------------------------------------------------------------------------------------
at this point all you need to do is connect ....EX:
oracleconnect a = new oracleconnect();
a.connectionstring = "User ID=(oracleuser);Password=(oraclepass);Data Source=(oracle_tns_alias_from_tnsnames)";
a.open();
----at this point you should be connected.
----note that all that the "System.Data.OracleClient" needs is the OCI.DLL from the oracleclient so you can or not use the TNSNAME.ora file
----you could setup your connectionstring directly with the TNSNAME address information and this way not use the TNSNAMES.ora.
----if you notice .....its a block from the TNSNAMES.ORA file :)
----EX :
"User ID=oracleuser;Password=oraclepass" +
";Data Source=" +
"(DESCRIPTION = " +
" (ADDRESS = (PROTOCOL = TCP)(HOST = ip_address_of_host_db)(PORT = 1521)) " +
" (CONNECT_DATA = " +
" (SERVER = DEDICATED) " +
" (SID = whatever) " +
" ) " +
")";
-----------------------------------------------------------------------------------------------------------------------------------------------------
as for your extra info i would say .....
you already have oracle client or server instaled ( since oracleserver instalation also includes the client module ) becouse other wise it would say OCI.DLL missing or something like that .
---TNS:could not resolve the connect identifier specified ---means on normal circunstancies that i would have a problem on the connectionstring/TNSNAMES
1- check (SID = whatever) your SID name
2 - checl HOST = ip_address_of_host_db your db host. ( can you ping it ? can you tnsping it? )
......
well thats about it. its very simple from a .net point of view.....the hard part its with oracle network configuration it self.
BoxheadMonke...
Member
37 Points
36 Posts
Re: Basic steps for Oracle data access connection
Apr 23, 2012 12:42 PM|LINK
Ok, thanks for that :) All working so far except for one issue - when i debug from VS i get the error:
ORA-12154: TNS:could not resolve the connect identifier specified
Any ideas?
ruipedromach...
Member
258 Points
84 Posts
Re: Basic steps for Oracle data access connection
Apr 30, 2012 08:15 AM|LINK
check tnsname.ora
BoxheadMonke...
Member
37 Points
36 Posts
Re: Basic steps for Oracle data access connection
May 01, 2012 03:49 PM|LINK
Check it for what?! As I say, it works fine on my machine unless i run debug.