java connector/J5.1 mysql
Posted by: Willem de korte
Date: February 10, 2018 03:08PM

I am working on the connection of MySQL with Java.
I understand this is a tested practise because I see many file applications about it.

I have obtained the files:
below from the Connnector J 5.1 documentation.
The files are pasted in the jdk1.8.0_71 /bin directory en succesfully compiled into *.java files.

The mysql-connector-java-5.1.44-bin.jar file from the ConnectorJ5.1 documentation was also pasted in the jdk1.8.0_71 /bin directory.

The first file is the driver loader.
The second file is de connection maker

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

// Notice, do not import com.mysql.jdbc.*
// or you will have problems!

public class LoadDriver {
public static void main(String[] args) {
try {
// The newInstance() call is a work around for some
// broken Java implementations

} catch (Exception ex) {
// handle the error

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

public class MakeConnection {
public static void main(String[] args) {

Connection conn = null;

try {
conn = DriverManager.getConnection("jdbc:mysql://localhost:3306/" + "user=shorty@localhost&password=asdfgh456");
// Do something with the Connection
System.out.println("Connected to database");

} catch (SQLException ex) {
// handle any errors
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());


SQLExeption: No suitable driver found for jdbc:mysql://localhost:3306/user=shorty@localhost&password=asdfgh456
SQLstate: 00001
VenderError: 0

This error above shows.
The files were entered at the commandline, with administrator privelige.
shorty@localhost&password=asdfgh456 is a tested user with password.

I hope you can point out the mistake I make, or any syntax error.

Hope to behearing from you soon.
Signing, best regards, Korte

Options: ReplyQuote

Written By
java connector/J5.1 mysql
February 10, 2018 03:08PM
February 12, 2018 12:14PM
February 19, 2018 01:16PM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.