连接代码为
<%@ page contentType="text/html; charset=GBK" %>
<%@ page import="java.sql.*"%>
<html>
<head>
<title>
test
</title>
</head>
<body bgcolor="#ffffff">
<%
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:microsoft:sqlserver://local:1433;DatabaseName=dtbs";
String user="sa";
String password="";
Connection conn=DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement();
String sql="select * from db1 ";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()){%><%=rs.getString("name")%><%=rs.getString("age")%><br>
<%}
rs.close();
stmt.close();
conn.close();
%>
<h1>
shu ju ku cao zuo cheng gong
</h1>
</body>
</html>