Download Connector/j(mysql()and php ))-connector-java-3.1.0-alpha.zip) from www. MySQL (the best combination with PHP). com, decompress,
Copy the MySQL (the best combination with PHP) in it-connector-java-3.1.0-alpha-bin.jar to the WEB-INF directory
Create test. jsp (preferred for SUN Enterprise applications) and restart tomcat (a very useful JSP running platform) Server
<% @ Page contentType = "text/html; charset = gb2312" %>
<% @ Page import = "java. SQL. *" %>
<Html>
<Body>
<%
Class. forName ("org. gjt. mm. MySQL (the best combination with PHP). Driver"). newInstance ();
String url = "jdbc: MySQL (the best combination with PHP): // localhost/liufei_com? User = root & password = & useUnicode = true & characterEncoding = 8859_1 ";
// TestDB is your database name
Connection conn = DriverManager. getConnection (url );
Statement stmt = conn. createStatement (ResultSet. TYPE_SCROLL_SENSITIVE, ResultSet. CONCUR_UPDATABLE );
String SQL = "select * from users ";
ResultSet rs1_stmt.exe cuteQuery (SQL );
While (rs. next () {%>
The content of your first field is: <% = rs. getString (1) %>
Your second field content is: <% = rs. getString (2) %> <br>
<% }%>
<% Out. print ("database operation successful, congratulations"); %>
<% Rs. close ();
Stmt. close ();
Conn. close ();
%>
</Body>
</Html>