OracleClient Connection string ..

N

.Net Developer

I'm trying to connect to Oracle database in the asp.net app. But keep
getting the error:
"ORA-12154: TNS: could not resolve service name at
System.Data.OracleClient.DBProjectPool.GetObject(Boolean&isInTransaction) at
System.Data.OracleClient.OracleConnectionPoolManager.GetPooledconnection ..
"

==============
Here's the connection string I'm using:
dim sConn as string = "Data Source=DSNName;User
ID=username;Password=password;Integrated Security=SSPI"

Code to connect to the database:
imports system.data
imports system.data.OracleClient
imports system.configuration

dim objConn as OracleConnection = new OracleConnection
objConn.ConnectionString = sConn 'as defined above

Try
objConn.open
catch ex as Exception
response.write(ex.Tostring())
finally
objconn.dispose
End Try
==============

Also, I have given full control to the ASPNET account and the IUSR and the
IWAM accnt in the Oracle bin folder.

Can someone point out what's going wrong?

Thanks
 
W

William Ryan eMVP

Try replacing the Integrated Security = SSPI with Integrated Security =
false (also, this assumes Oracle 8 or later).

I don't think SSPI is valid for Oracle and the syntax your are using is the
same one I use all of the time, except for the false vs. SSPI. Also, if you
are using Integrated security, Username and Password aren't necessary.

HTH,

Bill
 
N

.Net Developer

thanks for the reponse, Bill.
I changed the Integrated Security to "false" but still receive the same
error. Any clues why? r u using the OracleClient?
Also, I was wondering if the Data Source is the correct one. I'm specifying
the data source as the name of the System DSN on the machine. This data
source uses the Oracle ODBC Driver. .
 
W

William Ryan eMVP

.Net Developer said:
thanks for the reponse, Bill.
I changed the Integrated Security to "false" but still receive the same
error. Any clues why?
Not off of the top of my head, that's definitely weird. Do you have a
Server specified in your TNSnames.ora file? If so, try pinging it and make
sure you can make the connection. Also what's specified in sqlnet.ora

r u using the OracleClient?
Yes, but previously I used ODBC for a while. Didn't have any issues there
either.
Also, I was wondering if the Data Source is the correct one. I'm specifying
the data source as the name of the System DSN on the machine. This data
source uses the Oracle ODBC Driver. .

Actually I'm using the named instance, so I wonder if that isn't the
problem. Try connecting to the named instance of the server or the IP
address and see if that works.
 
C

Cowboy \(Gregory A. Beamer\)

Oracle is a bit trickier. I am guessing from DSNName that you are using a
DSN. If you wish to go this route, you will not be able to use OracleClient
to connect, as DSNs are not Oracle specific connections. You might be able
to switch to ODBC to connect, although it is a slow connection.

For using the MS software, you will have to get the Oracle client libraries
loaded and have a TNSNames.ora file with a location setup. A better option
is the ODP download from Oracle TechNet (otn.oracle.com - free registration
and then you can download Oracle everything (pretty much everything, that
is) for development purposes). The ODP works much better than the MS Oracle
components, esp. if you are using 9i or later (have not checked against
10g).

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

**********************************************************************
Think Outside the Box!
**********************************************************************
 
E

Eric

Launch a command prompt on the machine and type:

tnsping [dsnname]


Do you get an 'OK'?
 
G

Guest

In Old days of VB 6.0 and VC6.0 i used the following way
to directly connect to database server.
Actually u have to made an alias on client system to
connect to the database server. that alias stores
information in a .ora file (I have forgotten the correct
name)
when u wana connect to server Oracle client software uses
the connection string of that file.

So pls search the file *.ora at the machine and open it
with notepad. there should be something like
(Application=(protocole=)(server=)(programme id=)
(Service=))

pls copy that to ur connection string

if u still feel problem write me a mail at

(e-mail address removed)


Regards
Kaleem
 
R

Roy Fine

William Ryan eMVP said:
Not off of the top of my head, that's definitely weird. Do you have a
Server specified in your TNSnames.ora file? If so, try pinging it and make
sure you can make the connection. Also what's specified in sqlnet.ora

tnsping does not make a connection to the database - it only verifies that a
listener is available on the port and host specified in the alias.

Service Name refers to the name of the database - if you are using local
naming, it is specified in the tnsnames.ora file. make sure that the
service name is complete with the domain, or that you have specified the
default domain in the sqlnet.ora config file.

regards
roy fine
 

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