0

I'm having a problem connecting my from Java in Netbeans with mariadb in localhost. I've been seeing some post like this Connect to MariaDB from Java application in NetBeans on Linux (Mageia) but doesn't work it's pretty similar so I don't know why this post can't help me.

public BD(String servidor, String database, String usuario, String password) throws SQLException{
    try {


        Class.forName("org.mariadb.jdbc.Driver");
        url="jdbc:mysql://localhost/ddsi";
        conexion=DriverManager.getConnection(url, usuario, password);

        System.out.println("Conexion a Base de Datos "+url+" . . . . .Ok");

    }
    catch (ClassNotFoundException ex) {
        System.out.println(ex);
    }
}

As in the previous link I've tried everything. I also have mariadb library. enter image description here

I checked skip-networking directive in /etc/my.cnf but it is already commented.

1
  • 1
    Well what happens? Do you get an error of some kind? Commented Dec 18, 2018 at 18:37

1 Answer 1

3

You have a sources JAR in your classpath, that won't work. Get a regular JAR mariadb-java-client.jar and put it on the classpath. Better yet use a dependency management tool like gradle or Maven.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.