Connecting to the database has always been a big problem for novices. I will now talk about the method of connecting to the MYSQL database based on the mysql database.
1: Download a driver: such as mm.mysql-2.0.4-bin.jar
2: Place it under the commonlib directory
3: Test
<%
Class.forName("org.gjt.mm.mysql.Driver") .newInstance();
String url="jdbc:mysql://localhost/shangwu?user=root";
Connection con=DriverManager.getConnection(url);
Statement sql=con.createStatement();
ResultSet rs=sql.executeQuery( "select * from x");
while(rs.next())
out.println(rs.getInt("age"));
%>
4: Done without any configuration