File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and the fly likes Unable to connect using JDBC Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Unable to connect using JDBC" Watch "Unable to connect using JDBC" New topic

Unable to connect using JDBC

Ashwin Sridhar
Ranch Hand

Joined: Jul 09, 2011
Posts: 272

Hi ,

I am connecting to Oracle 11g from JDBC, but I get TimedOut Exception.

Below is my Connection String

Below is my TNS entries,

But I am able to establish a connection from Sql*Plus.

Any thoughts on this exception.

Ashwin Sridhar
Sai Rao

Joined: Mar 23, 2007
Posts: 4

Hello Ashwin,
Is this a local database? If not can you please try entering the DB URL instead of localhost in the connection parms, or the IP address of the database
(ADDRESS = (PROTOCOL = TCP)(HOST = <IP of the database>)(PORT = 1599))

Connection conn = DriverManager.getConnection("jdbcracle:thin:@<IP/URL of database>:1599:TEST",USERNAME,PASSWORD);
Ashwin Sridhar
Ranch Hand

Joined: Jul 09, 2011
Posts: 272

Hi Sai,

The DB Url also throws me the same exception. I tried to do a tnsping, I am able to retreive the some bytes. I am planning to re-install Oracle.
I agree. Here's the link:
subject: Unable to connect using JDBC
Similar Threads
Not able to connect oracle 11.2 using ODBC6.jar
SQLException : The Network Adapter could not establish connection
connection of JDBC with oracle 9i database
Network adapter connection error
Spring - Connection Problem in some Unit Tests