Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Arun Giridharan
Ranch Hand
Posts: 290
Debian Fedora Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2608
14
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

 
Arun Giridharan
Ranch Hand
Posts: 290
Debian Fedora Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2608
14
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 290
Debian Fedora Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2608
14
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 290
Debian Fedora Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It Worked fine!now!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic