Oracle Connection string

B

Bob Clegg

I am about to connect to an Oracle database using ado.net
The connection string sample that I tried is:
oOracleConn.ConnectionString = "Data Source=MySever;User
ID=MyUser;Password=MyPassword;Integrated Security=SSPI";

I keep getting ORA 12154 TNS could not resolve SERVICE_NAME given in
connect descriptor.
Which seems reasonable seeing I am not specifiying the SID.

But there doesn't seem to be a way to specify the SID (at least in the help
file that I found.)
(Yes there are multiple SIDs on this machine.)
Can anyone please give me a connection string for say :
HostComputer MyComputer
User MyUser
Password MyPassword
SID ThisSID
(Running Oracle 8.1.7 Client.)
thanks
Bob
 
B

Bob Clegg

Hi Miha,
Thanks for your reply.
Problem solved by putting the SID as the datasource.
regards
Bob

Miha Markic said:
Hi Bob,

I think you should adjust your tnsnames.ora for MySever.

--
Miha Markic [MVP C#] - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

Bob Clegg said:
I am about to connect to an Oracle database using ado.net
The connection string sample that I tried is:
oOracleConn.ConnectionString = "Data Source=MySever;User
ID=MyUser;Password=MyPassword;Integrated Security=SSPI";

I keep getting ORA 12154 TNS could not resolve SERVICE_NAME given in
connect descriptor.
Which seems reasonable seeing I am not specifiying the SID.

But there doesn't seem to be a way to specify the SID (at least in the help
file that I found.)
(Yes there are multiple SIDs on this machine.)
Can anyone please give me a connection string for say :
HostComputer MyComputer
User MyUser
Password MyPassword
SID ThisSID
(Running Oracle 8.1.7 Client.)
thanks
Bob
 
D

DotNetJunkies User

Consider a situation that i need to connect to a remote oracle database using a ASP.NET interface. I dont have the access to change the TNSname.ora file. In that case, how can i connect to oracle using the following information:
1. Network Address
2. Port
3. SID
4. User Id
5 Password

Java does allow this. But the .NET connection string using both ORAClient or Microsoft's Oracle native driver, doesnt allow me to do that.

Any body who can help me on this.?
 
D

DotNetJunkies User

Consider a situation that i need to connect to a remote oracle database using a ASP.NET interface. I dont have the access to change the TNSname.ora file. In that case, how can i connect to oracle using the following information:
1. Network Address
2. Port
3. SID
4. User Id
5 Password

Java does allow this. But the .NET connection string using both ORAClient or Microsoft's Oracle native driver, doesnt allow me to do that.

Any body who can help me on this.?
 
R

Roy Fine

The tnsnames.ora file is used by sqlnet to map a net service name alias to
these two components:
1. the connection data
2. network address

These two components are required to:
1. locate a listener (i.e. the host, port, and protocol)
2. identify a specific database instance (i.e. the service name)

If you do not want to use the tnsnames.ora file (and you will get a
millisecond or so performance boost if you don't), you can specify the
parameters directly.

If you routinely specify a net service name of myservice.myorg.com, and if
the entry in the tnsnames.ora file looks something like this:
MYSERVICE.MYORG.COM=
(DESCRIPTION =
(ADDRESS=(PROTOCOL=TCP)(HOST=121.9.9.30)(PORT=1521))
(CONNECT_DATA=(SERVICE_NAME=HRPROD.MYORG.COM)
)

then anywhere you use this in a connection string:
Data Source=myservice.myorg.com;

you can use the more verbose form of:
Data Source=(DESCRIPTION =
(ADDRESS=(PROTOCOL=TCP)(HOST=121.9.9.30)(PORT=1521))(CONNECT_DATA=(SERVICE_N
AME=HRPROD.MYORG.COM))

The SERVICE_NAME= parameter is for Oracle 8i and later. Prior versions use
the older naming syntax of SID=. In any case, the SERVICE_NAME value must
match one of the service names listed SERVICE_NAMES parameter in the
database instance parameter file.

regards
roy fine


DotNetJunkies User said:
Consider a situation that i need to connect to a remote oracle database
using a ASP.NET interface. I dont have the access to change the TNSname.ora
file. In that case, how can i connect to oracle using the following
information:
1. Network Address
2. Port
3. SID
4. User Id
5 Password

Java does allow this. But the .NET connection string using both ORAClient
or Microsoft's Oracle native driver, doesnt allow me to do that.
Any body who can help me on this.?
engine supports Post Alerts, Ratings, and Searching.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top