Skip to Main Content

Java Database Connectivity (JDBC)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

No suitable driver found for Oracle Database connection

jweaversJul 8 2015 — edited Jul 10 2015

I have small Java code, which execute every day and checks for data in database using Cronj Schedular and everything works fine, but recently I have observed that, it is failing due to

    java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@160.110.xx.xxx:1521/test

At the same time, when I run my test code to check Database connectivity that works fine without above exception. I'm unable to figure it out. Although, there was just slight code change, but that was nowhere related to Database or Database connection. Anyone, help me on this ?

dbconf.java

    public class dbconf {

    private Connection connect;

    private String connstr;

    public Connection getConnection() throws SQLException {

    connstr = "jdbc:oracle:thin:@160.110.xx.xxx:1521/test";

            try {

                String uname = "scott";

                String pass = "tiger";

                Class.forName("oracle.jdbc.OracleDriver").newInstance();

                connect = DriverManager.getConnection(connstr, uname, pass);

  

            } catch (Exception e) {

                System.out.println(e.toString());

            }

            return connect;

           }

        }

Application Log file

    Wed Jul 01 09:25:17 IST 2015:------- Initializing -------------------

    Wed Jul 01 09:25:17 IST 2015:------- Scheduling Jobs ----------------

    Wed Jul 01 09:25:17 IST 2015:------- Job Started Running ----------------

    Thu Jul 02 06:00:00 IST 2015 : Job Executed..!! Bschedularv2.2

    java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@160.xxx.67.xxx:1521/test

    Sat Jul 04 06:00:00 IST 2015 : Job Executed..!! Bschedularv2.2

    Sun Jul 05 06:00:00 IST 2015 : Job Executed..!! Bschedularv2.2

    java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@160.xxx.67.xxx:1521/test

So, you can see, It failed on 3rd of July and 5th July as well. But, in between it ran fine. Any help appreciated.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 7 2015
Added on Jul 8 2015
3 comments
9,476 views