aspose file tools*
The moose likes JDBC and the fly likes Connecting to Oracle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connecting to Oracle" Watch "Connecting to Oracle" New topic
Author

Connecting to Oracle

Gale Greaser
Greenhorn

Joined: Aug 05, 2002
Posts: 17
Hi -
I'm having trouble connecting to an Oracle database.
This is the code I try to connect with:
Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("got driver.");

(dies here) --> conn = DriverManager.getConnection("url", "user", "pass");
System.out.println("got Connection");
This is the error message I get:
java.sql.SQLException: No more data to read from socket
java.lang.Throwable(java.lang.String)
java.lang.Exception(java.lang.String)
java.sql.SQLException(java.lang.String)
void oracle.jdbc.dbaccess.DBError.check_error(short)
short oracle.jdbc.ttc7.TTCInBuffer.getByte()
byte oracle.jdbc.ttc7.TTIMsg.unmarshalSB1()
void oracle.jdbc.ttc7.O3log.receive2nd()
oracle.jdbc.dbaccess.DBConversion oracle.jdbc.ttc7.TTC7Protocol.logon(java.lang.String, java.lang.String, java.lang.String, java.util.Properties)
oracle.jdbc.driver.OracleConnection(oracle.jdbc.dbaccess.DBAccess, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.util.Properties)
java.sql.Connection oracle.jdbc.driver.OracleDriver.connect(java.lang.String, java.util.Properties)
java.sql.Connection java.sql.DriverManager.getConnection(java.lang.String, java.util.Properties, java.lang.ClassLoader)
java.sql.Connection java.sql.DriverManager.getConnection(java.lang.String, java.lang.String, java.lang.String)

Any suggestions?
Thanks in Advance!
Gale
Dean Reedy
Ranch Hand

Joined: Sep 10, 2001
Posts: 89
I do something like this:

Note: You will need to fill in the UserName, Password, <Host>,<Port>,<Instances>
Hope this helps.
Dean
Gale Greaser
Greenhorn

Joined: Aug 05, 2002
Posts: 17
Thanks for the suggestion, but I received the same error when I tried it.
Could it be something with the Oracle Driver JAR file I'm using?
- Gale
Gale Greaser
Greenhorn

Joined: Aug 05, 2002
Posts: 17
Yep - my suspicions were correct.
I downloaded a new Oracle 9i driver from:
http://www.sba.oakland.edu/faculty/mathieson/mis426/resources/sample_programs/jdbc_oracle/default.asp
- And what d'ya know, it worked!
Must have had the wrong driver version.
Thanks for you help though!
-Gale
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Connecting to Oracle