MYSQL and Java Connection Error

0

Hello dear, I need help I want to make a connection test between java and mysql and I have this error, here is my source code:

package test;
import java.sql.*;

public class PruebaConexion {


    public void conexionBD() {
        try {
            try {
                Class.forName("com.mysql.jdbc.Driver");



            } catch (ClassNotFoundException e) {
                System.out.println("Error Driver");
            }
            Connection connection=null;
            connection=DriverManager.getConnection("jdbc:mysql://localhost:3306/servicios", "root", "mysql");
            boolean valid=connection.isValid(50000);
            System.out.println(valid?"Conexion correcta":"Conexion incorrecta");
        } catch (Exception e) {
            System.out.println("Error:"+e);
        }



    }


    public static void main(String[] args) {
        PruebaConexion pruebaConexion=new PruebaConexion();
        pruebaConexion.conexionBD();

    }

}

My mistake this:

  

Exception in thread "main" java.lang.AbstractMethodError:   com.mysql.jdbc.Connection.isValid (I) Z at   test.testConexion.conexionBD (TestConexion.java:18) at   test.testConexion.main (Test Connection.java:31)

    
asked by Kevin Quevedo Bonifacio 18.11.2018 в 20:16
source

0 answers