我尝试将mysql数据库连接到java,但我得到了异常,因为" com.mysql.jdbc.Driver"

时间:2015-07-14 17:39:22

标签: java mysql

这是我的代码

SELECT * FROM DOCUMENT
WHERE CREATED_DATE BETWEEN $startDate AND $endDate
AND (EMP_ID = $empId OR $empId IS NULL)

1 个答案:

答案 0 :(得分:0)

将类路径设置为mysql jar文件。由于此jar文件中提供了com.mysql.jdbc.Driver类。

String DB_URL = "jdbc:mysql://localhost/Hotel_management";
String USER = "username";
String PASS = "password";
conn = DriverManager.getConnection(DB_URL,USER,PASS);