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

Anyone please tell the reason for the following exception & how to solve it

 
Ram Prasad
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone tell me why i am getting the following exception while trying to connect to a oracle database;
Exception in thread "main" java.sql.SQLException: Invalid Oracle URL specified
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:162)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:227)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:384)
at java.sql.DriverManager.getConnection(DriverManager.java:512)
at java.sql.DriverManager.getConnection(DriverManager.java:171)
at LookUp.main(LookUp.java:15)

MY file name is Lookup.java
My code has the following lines to establish the connection

String dbUrl = "jdbcracle:thin@localhost:1521:PROJDB";
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection c = DriverManager.getConnection(dbUrl,"SYS","system");
[ February 02, 2008: Message edited by: Ram ]
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34095
337
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Ram",
Please check your PM for a message from me.
 
Masoud Kalali
Author
Ranch Hand
Posts: 531
Java Mac OS X Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It should be like:



you forget a mere ":" after "thin" and before "@".
 
Ram Prasad
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Masoud,

It worked. Thank You for quick response

Ram Prasad
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic