jsp教程调用java类并查询sql数据库教程
package bean;
import java.sql.*;
public class MyDb_Page{
private Statement stmt;
private Connection conn=null;
private ResultSet rs=null;
private String navi;
public void connection(String db_name,String user,String pwd) throws Exception{
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
String url="jdbc:mysql教程://www.111cn.net:3306/" + db_name;
conn=DriverManager.getConnection(url,user,pwd);
stmt=conn.createStatement();
}
public ResultSet query(String sql) throws Exception{
rs=stmt.executeQuery(sql);
return rs;
}
首页 1 2 末页
时间: 2024-09-22 17:21:11