I'm already trying to make my MySQL database connect at getConnection()
. I have tried several different ways, to put the name of the bank, I have seen several tutorials including the tutorials that are from the MySQL website itself, videos, internet postings and none of the solutions there have solved my problem!
I'm trying to use the format that I do not go to the driver manually since in the most current versions of java this is done automatically.
Follows a print of the code I ran next to the connected bank.
Theerrorisasfollows:
Exception in thread "main" java.sql.SQLException: No suitable driver found for jdbc:mysql:@localhost:3306/Java
at java.sql.DriverManager.getConnection(DriverManager.java:689)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at acessobanco.AcessoBanco.main(AcessoBanco.java:14)
/Users/Alecell/Library/Caches/NetBeans/8.1/executor-snippets/run.xml:53: Java returned: 1
FALHA NA CONSTRUÇÃO (tempo total: 0 segundos)
I use Netbeans on the Mac with MAMP. Initially the port of MySQL was 8889, I came to think that this would be the problem and I modified it to 3306 even though it did not work. I made a check of whether the database is working on the new port (3306) with MySQLWorkbanch and is actually working, I just can not make the connection via java code.
JDBC has been installed in many different ways and mysql-connector-java-5.0.8-bin.jar is actually in the project library.