Broken Database Connection [message #128758] |
Wed, 20 July 2005 08:18 |
dmwallac
Messages: 20 Registered: July 2005
|
Junior Member |
|
|
Is it possible to establish a database connection in jdeveloper, to an oracle database, without providing the ip address and port information?
I have tried everything I can think of and still always I am asked for these. This is what tnsnames.ora is for. Are there other drivers (or connection types) that take advantage of tnsnames that maybe I could install and see from jdeveloper? I don't provide ip/port for sql*plus and it connects fine.
If I know the instance name of the database, as an application developer, I should not have to know or care what server or port it is on. Our DBAs recently relocated some database instances while consolidating servers and broke my application because of that information being hard-coded. Their response: We updated tnsnames, why isn't your app using that!
Please help the newbie!
|
|
|
Re: Broken Database Connection [message #128768 is a reply to message #128758] |
Wed, 20 July 2005 09:29 |
kmmfoo
Messages: 38 Registered: June 2005 Location: massachusetts
|
Member |
|
|
The problem you report suggests that you are using the "thin driver" to connect to your oracle database. Typically your connect string looks something like
"jdbc:oracle:thin:@hostname:1521:instancename"
Using that approach has a few benefits, namely that you don't need the oracle client installed, and you have total control of the target address from within the connect string.
The other approach is called the "OCI driver". In that case your connect string looks something like
"jdbc:oracle:oci:@entry_from_tnsnames"
The "OCI" approach uses TNSNAMES to figure out where the target database is located.
There are a few other repercussions of switching drivers -- mostly which libraries you include in your project -- so you should check out the oracle documentation for more info.
HTH...
|
|
|
Re: Broken Database Connection [message #128997 is a reply to message #128768] |
Thu, 21 July 2005 08:18 |
dmwallac
Messages: 20 Registered: July 2005
|
Junior Member |
|
|
Thanks. That sounds like what I am looking for. I am not sure if my jdeveloper environment is setup properly, though, for using OCI.
I have the Oracle9 client on my machine and my ORACLE_HOME is set for that. I have classes111.jar and classes12.jar on my classpath. But when I try to use jdbc:oracle:oci:@... or even jdbc:oracle:oci8:@... I get the following error:
java.lang.UnsatisfiedLinkError: no ocijdbc10 in java.library.path
It looks like jdeveloper expects Oracle 10. This seems especially weird when I specify oci8. Any ideas?
|
|
|
|
Re: Broken Database Connection [message #133342 is a reply to message #129214] |
Thu, 18 August 2005 10:03 |
dmwallac
Messages: 20 Registered: July 2005
|
Junior Member |
|
|
As a follow-up to this discussion.
My installation of JDeveloper was expecting Oracle10, but my local Oracle client was 9. I fixed the problem by renaming my JAR files in jdbc\lib under JDeveloper (to .xxx) and then copying in the files from \jdbc\lib under my Oracle9 installation. That fixed it.
Hope this helps anyone with a similar problem.
|
|
|