WAMP サーバーを介して Tomcat と MySQL で JSP を実行しています。JSP を MySQL に接続できません。ここにコードがあります
<%
try {
/* Create string of connection url within specified format with machine name,
port number and database name. Here machine name id localhost and
database name is usermaster. */
String connectionURL = "jdbc:mysql://localhost:3306/database";
// declare a connection by using Connection interface
Connection connection = null;
// Load JBBC driver "com.mysql.jdbc.Driver"
Class.forName("com.mysql.jdbc.Driver").newInstance();
/* Create a connection by using getConnection() method that takes parameters of
string type connection url, user name and password to connect to database. */
connection = DriverManager.getConnection(connectionURL, "root", "");
// check weather connection is established or not by isClosed() method
if(!connection.isClosed())
%>
<%
out.println("Successfully connected to " + "MySQL server using TCP/IP...");
connection.close();
}
catch(Exception ex){
%>
<%
out.println("Unable to connect to database."+ex.toString());
}
%>
フォルダにも入れmysql-connector-java-5.0.8.jar
ました。/lib
誰でもこれで私を助けることができますか?