Urgent: connection not made using JDBC Thin Drivers

R

Ramji

Dear friends:
following code just prints
Connecting to Oracle... & it doesnt prints ....Connected to oracle
statement.
I've given the code in try catch block but also it doesn't print any
exception
why??

System.out.println("connencting to Oracle....");

Class.forName("oracle.jdbc.driver.OracleDriver");

Connection conn=
DriverManager.getConnection("jdbc:eek:racle:thin:mad:(DESCRIPTION
=(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = testserver.com)(PORT
= 1521)))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME =
testdb)))","test","test");

System.out.println(".....connencted to Oracle");


I've tried the above code with some changes for the database on the
same machine it works fine. But when I tries it for the db on the other
server it not works.

waiting for reply.....
 
S

stixwix

Ramji said:
Dear friends:
following code just prints
Connecting to Oracle... & it doesnt prints ....Connected to oracle
statement.
I've given the code in try catch block but also it doesn't print any
exception
why??

System.out.println("connencting to Oracle....");

Class.forName("oracle.jdbc.driver.OracleDriver");

Connection conn=
DriverManager.getConnection("jdbc:eek:racle:thin:mad:(DESCRIPTION
=(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = testserver.com)(PORT
= 1521)))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME =
testdb)))","test","test");

System.out.println(".....connencted to Oracle");


I've tried the above code with some changes for the database on the
same machine it works fine. But when I tries it for the db on the other
server it not works.

waiting for reply.....

Could it be simply that the code is throwing an exception? Wrap it in
a try-catch block...
 
B

Bjorn Abelli

...
following code just prints
Connecting to Oracle... & it doesnt prints ....Connected to oracle
statement.
I've given the code in try catch block but also it doesn't
print any exception
why??

What do you do with the exception you catch?

When caught, the exception doesn't "print itself".

If it happens that you catch an exception, but don't do anything with it
(e.g. print out the stacktrace), you'll not see anything.

Could that be the case here?
System.out.println("connencting to Oracle....");

Class.forName("oracle.jdbc.driver.OracleDriver");

Connection conn=
DriverManager.getConnection("jdbc:eek:racle:thin:mad:(DESCRIPTION
=(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP)(HOST = testserver.com)(PORT
= 1521)))(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME =
testdb)))","test","test");

This seems a bit overkill to supply the whole Net8 configuration file when
working with the thin driver... ;-)

It should suffice with:

DriverManager.getConnection(
"jdbc:eek:racle:thin:mad:testserver.com:1521:testdb",
"test", "test");

// Bjorn A



Inviato da X-Privat.Org - Registrazione gratuita http://www.x-privat.org/join.php
 

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

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top