This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance 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: 34672
367
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