Meaningless Drivel is fun!*
The moose likes JDBC and the fly likes TNS Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "TNS Error" Watch "TNS Error" New topic
Author

TNS Error

Ramaswamy Srinivasan
Ranch Hand

Joined: Aug 31, 2004
Posts: 295
Hi people, I am currently working with Servlets, JSP and JDBC.

I run my appln for the first time, successfully, the second time, I get an error stating "TNS could not resolve Service Name"

Is this related to DB or my Server (Tomcat)

How to set it right?

Cheers,
Swamy
Santosh Jagtap
Greenhorn

Joined: Sep 20, 2004
Posts: 23
Basically this is backend problem.This error comes when the service for database is not started or the listener is not configured properly.I hope u r using oracle as database.


Santy
Ramaswamy Srinivasan
Ranch Hand

Joined: Aug 31, 2004
Posts: 295
Hi,

Yeah am using Oracle as my backend. I could figure out this to be a back end issue.

Any ways to correct it?

cheers,
Swamy
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
actually need to know what driver are you using.

oracle.jdbc.driver.OracleDriver
jdbc racle:thin:@<machine IP>:<1521 or if other port>:SID

are you using the same driver or some other???

if this one we can use the SID of the database. no need to create a listener and a service. you can just delete your listener and service both. if its not used by some other app.

hope this helps.
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
I face the same problem when i request the listener and the listener is not up. after bringing up the listener i used to get the same error. so it is better not to request the listener if the listener is not up or your machine, where the listener reside, is not up.

it is like. Why you request me while i m not up now i am not gonna listen you anyway. configure me again.

and you are like :roll:
Ramaswamy Srinivasan
Ranch Hand

Joined: Aug 31, 2004
Posts: 295
Hi adeel,

You are to my rescue again man....happy about that....

Well....i'm not using thin....am using jdbc dbc SN with "sun.jdbc.odbc.JdbcOdbcDriver"

Any luck? where to find the root?

cheers,
Swamy
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Why use jdbcOdbc bridge buddy. it will affect your performance in a negative way. you can use classes12.zip instead.

anyways dont know whether SID works with your driver or not. try it out yourself. and if not just configure the listener and service again, and never try to request listener again during listener starting up. let the service start the listener.
Santosh Jagtap
Greenhorn

Joined: Sep 20, 2004
Posts: 23
Hi
If u have database access try this
goto net config and create a service for ure db
if it is already created just check in services whether it is in started (sholud not be starting)state.
or if tht is also fine then check for tnsnames.ora file which is on client machine (since u r using odbc so i assume u have oracle client installed on ure machine)in oracle/network/admin folder check the db entry for ure database name.
and dnt forget to check whether the database is up or not.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: TNS Error