JAVA SQL - No suitable drivers found for jdbc: derby


This question already has an answer here:

  • SQLException: No suitable driver found for jdbc:derby://localhost:1527 16 answers

I am a newbie at JAVA and SQL.

In one exercise, I need to read data from a sample SQL table in NetBeans.

In "services", I started the JAVA DB server. All good. The following message appeared:

Mon Dec 16 21:40:36 EST 2013 : Security manager installed using the Basic server security policy.
Mon Dec 16 21:40:37 EST 2013 : Apache Derby Network Server - - (1405108) started and ready to accept connections on port 1527

But when I run this program (below), the following error occurs:

SQL Error: java.sql.SQLException: No suitable driver found for jdbc:derby://localhost:1527/sample 0 08001

Here are the codes.. how can I make sure the right driver is found?

import java.sql.*;

public class TableReporter {

    public static void main(String[] args) {
        String data = "jdbc:derby://localhost:1527/sample";
        try (
            Connection conn = DriverManager.getConnection(
            data, "app", "APP");
            Statement st = conn.createStatement()) {


            ResultSet rec =st.executeQuery(
                    "select * " +
                    "from SYS.SYSTABLES" +
                    "order by TABLENAME");
                System.out.println("TABLEID:\t" + rec.getString(1));
                System.out.println("TABLENAME:\t" + rec.getString(2));
                System.out.println("TABLETYPE:\t" + rec.getString(3));
                System.out.println("SCHEMAID:\t" + rec.getString(4));
        } catch (SQLException s){
            System.out.println("SQL Error: " + s.toString() + " "
                    + s.getErrorCode() + " " + s.getSQLState());
        } catch (Exception e) {
            System.out.println("Error: " + e.toString()

The issue is with the jar file.



  1. Whether it is installed or not.
  2. If it is installed, is there a need to update your .bashrc file.
  3. Or, have you imported the .jar file in your netBeans IDE.

If all does not works, simply write a simple JDBC program to connect to Database using notpad & run it, check what is the problem with your machine.