Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 943433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:26:16+00:00 2026-05-15T22:26:16+00:00

I am getting the error: java.sql.SQLException: No suitable driver I have imported the .jar

  • 0

I am getting the error: java.sql.SQLException: No suitable driver

I have imported the .jar file that is available here http://dev.mysql.com/downloads/mirror.php?id=13598

I am using Eclipse.

I am connecting to the DB with this code:

package dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class DBCon {

    private static final String host = "jdbc:mysql://localhost";
    private static final String port = "3306";
    private static final String db = "mydb";
//      private static final String user = "root";
//      private static final String pwd = "";
    private static final String user = "myusername";
    private static final String pwd = "mypwd";

    public Connection getCon() {
        Connection con = null;
        try {
            String url = host + ":" + port + "/" + db;

            con = DriverManager.getConnection(url, user, pwd);

        } catch (SQLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        return con;
    }
}

I then query the DB with this code:

package dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.sql.Connection;
import model.ClassPojo;

public class ARCSDao {

public ArrayList<ClassPojo> viewClasses() throws SQLException{
    ArrayList<ClassPojo> classList = new ArrayList<ClassPojo>();

    DBCon db = new DBCon();
    Connection con = db.getCon();
    Statement stmt;
    ResultSet rs;
    stmt = con.createStatement();
    rs = stmt.executeQuery("SELECT * FROM classes");
    while(rs.next()){
           ClassPojo aClass = new ClassPojo();
           rs.getString("class_name");
           rs.getString("class_uri");
           classList.add(aClass);
    }           
    return classList;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T22:26:17+00:00Added an answer on May 15, 2026 at 10:26 pm

    Add

    Class.forName("com.mysql.jdbc.Driver").newInstance();
    

    before

    con = DriverManager.getConnection(url, user, pwd);
    

    if this doesn’t work double check that the jdbc driver (jar file) is included in your classpath

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Getting java.sql.SQLException java.sql.SQLException: General error at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6986) at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7114) at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3110) at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:338) at
I am getting java.sql.SQLException: error occurred during batching: batch must be either executed or
I am getting the following error: java.sql.SQLException: Exhausted Resultset at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134) at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179) at
I'm currently getting the error: java.sql.SQLException: ORA-01843: not a valid month which I assume
I am getting the following error when inserting data into my oracle database. java.sql.SQLException:
Why do I keep getting this error: javax.servlet.ServletException: java.sql.SQLException: [Oracle][ODBC][Ora]ORA-00904: PURCHASE_PRICE: invalid identifier As
I am currently getting the error, java.sql.SQLException: Method 'executeQuery(String)' not allowed on prepared statement.
We are getting this error java.sql.SQLException: OALL8 is in an inconsistent state when executing
In the following code..I am getting no suitable driver..error: please help. I have been
I have done simple java app for blackberry, while building am getting following error.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.