Olá meus amigos…não estou conseguindo fabricar conexões, esta ocorrendo o seguinte erro.
Exception in thread “main” com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘???’ at line 1
import java.sql.DriverManager;
import java.sql.Connection;
import java.sql.SQLException;
public class ConnectionFactory {
public static Connection getConnection() throws SQLException {
try {
Class.forName("com.mysql.jdbc.Driver");
System.out.println("Conectando ao banco");
return DriverManager.getConnection("jdbc:mysql://localhost/teste", "root", "");
} catch (ClassNotFoundException e) {
throw new SQLException(e.getMessage());
}
}
}
import java.sql.Connection;
import java.sql.SQLException;
import ConnectionFactory;
public class TesteConnection{
public static void main(String[] args) throws SQLException{
Connection connection = ConnectionFactory.getConnection();
connection.close();
}
}
:roll: Obrigado.
