• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

how can I know my TNS Names_Entry?

 
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am trying to connect java with oracle with oci deriver. I have both oracle and java on one machine.


This line works perfectly (doesn't give ClassNotFoundException), taken classes111.zip file into classpath.



What should I write at the place of TNS Names_Entry. Actually what exactly is this TNS Names_Entry. How can I know the value of this in my computer.

Please help me.

Thanks a lot.
[ November 13, 2005: Message edited by: rathi ji ]
 
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First, you should have oracle client installed in your machine when you use oracle oci driver.

Then look for the file tnsnames.ora inside "admin" folder of oracle client installation. This file holds the details of the list of services configured by your client.

pick the required service name and use in your java program.
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I guess, I have both server and client installed. Because I am writing query from SQL plus prompt (I guess, without client, we can't make query) and server is executing the query.

Unfortunately, I can't look this file now.

Is there a direct entry like this in tnsnames.ora file:

TNS Names_Entry = SHREE

Please reply.
Thanks.
 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Rathi,

A usual tnsname entry looks like the following

SUNILDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = SUNIL01) (PORT = 1521))
)
(CONNECT_DATA =
(SID = SUNILDB)
(SERVER=DEDICATED)
)
)

-Sunil
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And to double check the value you think is the tns name, try "tnsping [tnsname]" from the command line.
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sunil Dumpala:
Rathi,

A usual tnsname entry looks like the following

SUNILDB =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = SUNIL01) (PORT = 1521))
)
(CONNECT_DATA =
(SID = SUNILDB)
(SERVER=DEDICATED)
)
)

-Sunil




Thank you very much Sunil and Paul.
Could you please tell me what is TNS Names_Entry here in this file.
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
SUNILDB = ...

SUNILDB is the TNS name.
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by David O'Meara:
SUNILDB = ...

SUNILDB is the TNS name.



Thanks David,
I will try this.

 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried this code.



It was giving this error:



Please tell me, what can be wrong here?
Thanks.
[ November 22, 2005: Message edited by: rathi ji ]
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I dont know if this will anyway solve ur issue, But it did mine some time back.
First, make sure that the jdbc-oci shared object (libocijdbc8 or liboci80Xjdbc.so etc.) and ${ORACLE_HOME}/lib are in your path. Then, try the Test sample program available in the JDBC samples directory. Sometimes, even after the shared object is loaded successfully, you may get errors such as make_c_state symbol not found. This may happen if your CLASSPATH has classes.zip from JRE 1.1.7 or JDK 1.1.6 and your running java binaries from jdk 1.1.3 or so. Make sure everything (LD_LIBRARY_PATH, CLASSPATH, java binaries) is in sync.
 
Sri Ram
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry forgot to post. I actually got this from Here.
 
ankur rathi
Ranch Hand
Posts: 3852
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Sri Ram:
I dont know if this will anyway solve ur issue, But it did mine some time back.
First, make sure that the jdbc-oci shared object (libocijdbc8 or liboci80Xjdbc.so etc.) and ${ORACLE_HOME}/lib are in your path. Then, try the Test sample program available in the JDBC samples directory. Sometimes, even after the shared object is loaded successfully, you may get errors such as make_c_state symbol not found. This may happen if your CLASSPATH has classes.zip from JRE 1.1.7 or JDK 1.1.6 and your running java binaries from jdk 1.1.3 or so. Make sure everything (LD_LIBRARY_PATH, CLASSPATH, java binaries) is in sync.



I am sorry but I didn't get it.

I have classes111.zip into classpath. Using JDK 1.4 and Oracle 8i. Are they not compatible with each other.

Please help.

Thanks.

 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have to make sure that the relevant OCI DLL's (if you're using Windows) are in the PATH (note, that's not the same as classpath).

The error you are getting:

Unsatisfied link error make_c_safe at oracle.jdbc.oci8.OCIDBAccess.make_c_safe

sounds like you do have the DLL's in your path, but you have a wrong (too old or too new) version somewhere.

Why do you want to use the OCI driver anyway? Using the thin driver is easier, if you use the thin driver you don't need the Oracle client software at all (and you wouldn't have problems like the error message above).

edit: Aha, I see you have another post which is exactly the same, except you're asking about the thin driver... :roll:
[ November 22, 2005: Message edited by: Jesper de Jong ]
reply
    Bookmark Topic Watch Topic
  • New Topic