引用:http://www.45it.com/database/201202/28000.htm
1.安装SQL Server 2000 driver for JDBC驱动,把下载下来的那个setup.exe直接双击默认安装即可。
2.最后找到把C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib下的msbase.jar、mssqlserver.jar、msutil.jar三个文件复制到Tomcat下的bin目录下F:\tomcat-5.5.20\bin。
3.
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=student";
String user="sa";
String password="12345";
Connection conn= DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from stu";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()){ %>
您的第一个字段内容为:<%=rs.getString(1)%><br>
您的第二个字段内容为:<%=rs.getString(2)%><br>
}
out.print("数据库连接成功,恭喜你");%>
rs.close();
stmt.close();
conn.close();
--------------------------------------------------------
引用:http://zhidao.baidu.com/question/80839407.html&__bd_tkn__=75fb55643c369f275623bf6fbab024a79e0889ff8078338d51fed8133ea5c69d362ad36bb4bcda3b39bb3949f6bbe47087ac3af56e60b1f4e7eb6015705cf5319463a9ff40491fc7006f4708a440cc0a4d74e9070d2bcbfea04f407f062e322ecb140a364abcddaeee0aeabbc9da890ece3d23f14b