今天做个项目测试,连接SQL2000数据库搞了半天,以前有连接成功过,今天又搞了半天,想想还是有必要记录一下:
MyEclipse DataExplore连接界面参数如下:
jar包:sqljdbc4.jar (SQL2005的为sqljdbc.jar)
Driver Name: test
Conection URL:jdbc:sqlserver://XXX.XXX.XXX.XXX:1433
Driver Classname:com.microsoft.sqlserver.jdbc.SQLServerDriver
<!-- SQL2000 Database -->
<environment id="tavServer">
<transactionManager type="JDBC">
</transactionManager>
<dataSource type="POOLED" >
<property name="driver" value="com.microsoft.sqlserver.jdbc.SQLServerDriver" />
<property name="url" value="jdbc:sqlserver://XXX.XX.XX.XX:1433;databaseName=test" />
<property name="username" value="sa" />
<property name="password" value="" />
</dataSource>
</environment>
用java连接如下:
String connectionUrl = "jdbc:sqlserver://localhost:1433;" + "databaseName=AdventureWorks;user=MyUserName;password=*****;"; Connection con = DriverManager.getConnection(connectionUrl);