-4
我想連接到使用JDBC從我的Tomcat的servlet從Tomcat servlet使用MySQL JDBC的樣板是什麼?
這是我嘗試了MySQL數據庫:
Class.forName("com.mysql.jdbc.Driver");
Connection connection = DriverManager.getConnection(
"jdbc:mysql://DatabaseURL",
"username", "password");
Statement statement = connection.createStatement();
String sqlQuery = "use db name;";
statement.executeUpdate(sqlQuery);
我進口Eclipse中的JDBC並把它放在src文件夾中。
我在做什麼錯?
-1不發佈錯誤消息 –