Answer the question
In order to leave comments, you need to log in
How to correctly write mysql url in java?
Good!
The first experiments with the work of the database, I watch lessons from devkolibri, they create a maven project and connect it to the database. I have a small project on javaFX, but there are no class differences between classes for working with the database, but there is no maven, respectively. + They used to download using pom.
So I downloaded mysql, installed everything and everything, added it to the library, but I can’t connect anyway, I’m sure that I’m just writing the wrong url, because I don’t understand how to write it correctly.
private static String URL = "jbdc:mysql://localhost:3306/mydbtest";
private static String name = "root";
private static String pass = "root";
public static void main(String[] args) {
Connection connection;
try {
Driver driver = new FabricMySQLDriver();
DriverManager.registerDriver(driver);
connection = DriverManager.getConnection(URL, name,pass);
} catch (SQLException e) {
e.printStackTrace();
}
launch(args);
}
java.sql.SQLException: No suitable driver found for jbdc:mysql://localhost:3306/mydbtest
at java.sql.DriverManager.getConnection(DriverManager.java:689)
at java.sql.DriverManager.getConnection(DriverManager.java:247)
at sample.Main.main(Main.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question