谁有jsp连接sql server 2005的详细资料啊??
传一下,谢谢。zhouyong5217@
程序代码:
package com.xh.jsp.dbc; import java.sql.*; public class DataBaseConnection { private final String DRIVER="com.microsoft.sqlserver.jdbc.SQLServerDriver"; private final String DBURL="jdbc:sqlserver://localhost:1433;DatabaseName=person"; private final String DBUSER="sa"; private final String DBPASSWORD="123"; Connection conn=null; public DataBaseConnection() { try { Class.forName(DRIVER); conn=DriverManager.getConnection(DBURL,DBUSER,DBPASSWORD); } catch (Exception ex) { System.out.println("数据库连接出错"+ex.toString()); } } public Connection getConnection() { return this.conn; } public void closeConnection() { try { this.conn.close(); } catch (Exception ex) { System.out.println("关闭数据库出错"+ex.toString()); } } }