September 5th, 2001, 07:19 AM
i have downloaded sql which i seem to connect to fine using doc command.Does any one know how to connect to mysql using JAVA or preferably JSP? only connection code please without the quries or html .
I have a piece of code below which i have tried to use unsuccessfully.
I get error message.
catch (Exception E)
System.err.println("Unable to load driver.");
Connection conn =
Statement statement = conn.createStatement();
String sql = "SELECT * FROM LOGINS";
ResultSet rs = statement.executeQuery(sql);
<td><%= rs.getString("customerID") %></td>
<td><%= rs.getString("username") %></td>
<td><%= rs.getString("password") %></td>
<td><%= rs.getString("logintype") %></td>
<% } %>
<% if(statement != null)
if(conn != null)
September 5th, 2001, 09:48 AM
- Did you download the JDBC Driver for mm.mysql? If not, you need to do so and add it to your classpath
- MySQL does not typically run on port 8080, that is for the web server. It usually runs on port 3306 by default.
- I might be wrong here but are you sure that you're using the right URL to connect? "jdbc:mysql://localhost:8080/PROJ" doesn't seem right to me.
- It doesn't specify anywhere your username and password so there is no authentication done. From what little I've worked with (on MySQL), you need to provide this information to connect.
hope this helps in helping your problem