Connection String
Hiya Guys,
I am new to all this JSP stuff. I am trying to connect to a MySQL database. I get this exception: -
org.apache.jasper.JasperException: com.mysql.jdbc.Driver
I have downloaded the driver and stored it in the C:\Tomcat\common\lib directory. But I still get this error. Here is my code: -
<%@ page import="java.sql.*" %>
<%
String connectionURL = "jdbc:mysql://localhost:3306/adnan?user=Root;password=password";
Connection connection = null;
Statement statement = null;
ResultSet rs = null;
%>
<html><body>
<%
Class.forName("com.mysql.jdbc.Driver").newInstance ();
connection = DriverManager.getConnection(connectionURL, "", "");
statement = connection.createStatement();
rs = statement.executeQuery("SELECT * FROM pet");
while (rs.next()) {
out.println(rs.getString("owner")+"<br>");
}
rs.close();
%>
</body></html>
Thanks Guys.
Adz - The World is not enough
__________________
Adz - Learning The J2EE Ways.
|