aspose file tools
The moose likes JDBC and the fly likes No suitable driver found for jdbc:oracle:thin:@localhost:1521:CON Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "No suitable driver found for jdbc:oracle:thin:@localhost:1521:CON" Watch "No suitable driver found for jdbc:oracle:thin:@localhost:1521:CON" New topic
Author

No suitable driver found for jdbc:oracle:thin:@localhost:1521:CON

Arun Giridharan
Ranch Hand

Joined: Sep 30, 2010
Posts: 290

My FirstCode in jdbc

error :
Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbcracle:thin:@localhost:1521:CON
at java.sql.DriverManager.getConnection(DriverManager.java:602)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at com.cls.demo.JdbcDemo.main(JdbcDemo.java:35)

1)what is this thin driver ?
jdbcracle:thin:@localhost:1521:CON

what does this say ?
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2343

The Thin driver is a jdbc library that allows you to connect to an Oracle database without needing Oracle client software.

You can download it from Oracle.


OCUP UML fundamental
ITIL foundation
Arun Giridharan
Ranch Hand

Joined: Sep 30, 2010
Posts: 290

Why i am keep getting this Exception ?? What's Wrong

Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc: oracle:thin:@localhost:1521:CON
at java.sql.DriverManager.getConnection(DriverManager.java:602)
at java.sql.DriverManager.getConnection(DriverManager.java:185)
at com.cls.demo.JdbcDemo.main(JdbcDemo.java:35)
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2343

You get this error because you did not make the oracle jdbc thin driver library available when running your program.

Download the Oracle jdbc library.
add it to the classpath when running your program.

This line of code seems odd : Class class1 = ClassLoader.getSystemClassLoader().loadClass("oracle.jdbc.driver.OracleDriver");
Where did you learn to load a driver class that way?

Arun Giridharan
Ranch Hand

Joined: Sep 30, 2010
Posts: 290

Jan Cumps wrote:You get this error because you did not make the oracle jdbc thin driver library available when running your program.

Download the Oracle jdbc library.
add it to the classpath when running your program.

I have Added.
Jan Cumps wrote:This line of code seems odd : Class class1 = ClassLoader.getSystemClassLoader().loadClass("oracle.jdbc.driver.OracleDriver");
Where did you learn to load a driver class that way?


No,why so?




Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2343

I was expecting to see : Class.forName ("your driver class");
(and with JDBC 4 drivers you can completely skip loading the driver)
Arun Giridharan
Ranch Hand

Joined: Sep 30, 2010
Posts: 290

It Worked fine!now!
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: No suitable driver found for jdbc:oracle:thin:@localhost:1521:CON
 
Similar Threads
ClassNotFoundException
How do I use Oracle's thin Driver ?
java.sql.SQLException: No suitable driver
JDBC Error
JDBC + Localhost