Connecting to mysql using JSP

by rajesh 2007-11-21 21:09:59

When we are using JSP/Java Hosting.

We can connect to mysql using JDBC.

You can use the following code to connect to mysql in Jsp/Java

<%@ page import="java.sql.*" %>
Connection connection = null;
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
connection = DriverManager.getConnection("jdbc:mysql://localhost/<DB Name>?user=<User Name>&password=<PASSWORD HERE>");

Tagged in:

1999
like
0
dislike
0
mail
flag

You must LOGIN to add comments