我下载 SQL Server 2000 Driver for JDBC 但不支持 SQL Server 7
求 SQL Server 7 Driver for JDBC 的驱动
或则
最好同时 SQL Server 7 Driver for JDBC 和 SQL Server 2000 Driver for JDBC
求 SQL Server 7 Driver for JDBC 的驱动
或则
最好同时 SQL Server 7 Driver for JDBC 和 SQL Server 2000 Driver for JDBC
public Connection m_dbConnection; try
{
// Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Class.forName("net.sourceforge.jtds.jdbc.Driver");
}
catch(ClassNotFoundException e)
{
e.printStackTrace();
throw new SQLException(e.getMessage()) ;
}
try
{
/*根据机构编码获取数据库SQL SERVER 连接信息*/
SQLConnectInfo info = new SQLConnectInfo(sOrgCode) ;
String sUrl ="jdbc:jtds:sqlserver://"
+info.getIP()+":1433;DatabaseName="
+info.getDatabase()+";User="
+info.getUser()+";Password="
+info.getPassword();
/*创建连接*/
//m_dbConnection = DriverManager.getConnection(sUrl);
Properties proper = new Properties() ;
Driver driver = new Driver() ;
//driver.acceptsURL(sUrl) ;
m_dbConnection = driver.connect(sUrl,proper) ;
/*事务模式设为不自动提交*/
m_dbConnection.setAutoCommit(false);
}
catch(SQLException se)
{
se.printStackTrace();
/*抛出异常*/
throw new SQLException(se.getMessage()) ;
} 其它查询 执行跟原来一样 只需对 Connection 进行操作即可