i already have xammp set up on localhost. and
i also added a "mysql-connector-java-5.1.22-bin" file to m exlipse under "JRE SYSTEM LIBRARY"

information on xammp:
user name: "root"
password: ""
database: "a_upload"
table: "user"

in eclipse iam just testing my connection. but i get a error:

SQLException: No suitable driver found for jdbc:mydql://localhost//a_upload
SQLException: 0

how i now what the error mean but i dont now why it give me the error.

import java.sql.*;

public class database01
{
    public static void main(String[]args)
    {
        Connection connect = null;

        try{
            Class.forName("com.mysql.jdbc.Driver");
            connect = DriverManager.getConnection("jdbc:mydql://localhost//a_upload","root","");
            Statement sqlState = connect.createStatement();

            String selectStuff = "Select firstname from user";
            ResultSet rows = sqlState.executeQuery(selectStuff);
            while(rows.next())
            {
                System.out.println(rows.getString("firstname"));
            }
        }
        catch(SQLException e){
            System.out.println("SQLException: "+e.getMessage());
            System.out.println("SQLException: "+e.getErrorCode());
        }
        catch(ClassNotFoundException e){
            e.printStackTrace();

        }
    }
}

for jdbc:mydql://localhost//a_upload

there's a typo there. try "mysql" instead of "mydql"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.