wood burning stoves*
The moose likes JDBC and the fly likes Anyone please tell the reason for the following exception & how to solve it Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Anyone please tell the reason for the following exception & how to solve it" Watch "Anyone please tell the reason for the following exception & how to solve it" New topic
Author

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

Ram Prasad
Greenhorn

Joined: Feb 02, 2008
Posts: 9
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

Joined: May 26, 2003
Posts: 30752
    
156

"Ram",
Please check your PM for a message from me.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Masoud Kalali
Author
Ranch Hand

Joined: Jul 08, 2004
Posts: 531

It should be like:



you forget a mere ":" after "thin" and before "@".


Masoud Kalali
Software Engineer - My Weblog - GlassFish Security
Ram Prasad
Greenhorn

Joined: Feb 02, 2008
Posts: 9
Hi Masoud,

It worked. Thank You for quick response

Ram Prasad
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Anyone please tell the reason for the following exception & how to solve it