This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connecting to Oracle

 
Gale Greaser
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic