Connecting to mysql using JSP
by rajesh[ Edit ] 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>");