JDBC in artifact
已回答
Hello,
I changed sqlite to mysql and since then,I can't solve this problem. Sqlite used to work perfectly.
In IDE is all right, in jar not.
I tried these before connection
Class.forName("com.mysql.cj.jdbc.Driver").newInstance();
Class.forName("com.mysql.cj.jdbc.Driver");
Class.forName("com.mysql.jdbc.Driver").newInstance();
Class.forName("com.mysql.jdbc.Driver");
and without (connector v. 8.0.16) - just
String url = "jdbc:mysql://localhost:3306/jawler";
conn = DriverManager.getConnection(url, "name", "pass");




What am I doing wrong?
Thanks, Filip
请先登录再写评论。
You need to make sure the jar is present in application classpath when it is running.
Make sure you have specified correct driver class and that the class is present in classpath. Check this thread https://stackoverflow.com/questions/5982675