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

  • Home
  • SEARCH
  • 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

Ask A Question

Stats

  • Questions 510k
  • Answers 510k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You'll need to use the :odd selector: http://api.jquery.com/odd-selector/ Not exactly… May 16, 2026 at 4:52 pm
  • Editorial Team
    Editorial Team added an answer from echo "<a href="index.php"> Click here </a> to Login"; to… May 16, 2026 at 4:52 pm
  • Editorial Team
    Editorial Team added an answer It seems that a reboot of my machine has fixed… May 16, 2026 at 4:52 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm currently getting the error: java.sql.SQLException: ORA-01843: not a valid month which I assume
I'm getting the following error when I try to run a simple Java JDBC
Could someone please help me understand that why am I getting this error at
I am trying to connect to MS SQL Server 2005 from java, I am
I am getting the following error. Not getting clue why is it happening. Also
I am getting this error when I try to query the database and write
I'm getting the following error when trying to build my very simple webservice project.
I'm getting a no such column: _id error. YES there is a column _id
I'm a newbie to Java-related web development, and I can't seem to get a
I have a Tomcat and PostgreSQL installed on a server. I'm having a connection

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.