if you are talking about
Microsoft SQL Server 2000 Driver for JDBC you can download it from
http://msdn.microsoft.com/downloads/default.asp?URL=/downloads/sample.asp?url=/MSDN-FILES/027/001/779/msdncompositedoc.xml
Microsoft SQL Server 2000 Driver for JDBC you can download it from
http://msdn.microsoft.com/downloads/default.asp?URL=/downloads/sample.asp?url=/MSDN-FILES/027/001/779/msdncompositedoc.xml
Connection con = null;
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
con = DriverManager.getConnection("jdbc:microsoft:sqlserver://127.0.0.1:1433","sa","java");
Statement statement = con.createStatement();
ResultSet rs = statement.executeQuery("select * from person");
rs.last();
int recordcount = rs.getRow();
System.out.println(recordcount);
System.out.println("成功!");
statement.close();
con.close();运行结果:[Microsoft][SQLServer JDBC Driver][SQLServer]对象名 'person' 无效。
我不知道数据库的名字应该放在连结的哪儿("jdbc:microsoft:sqlserver://127.0.0.1:1433","sa","java");
请指点
我按上边的连结,把数据库名改成我的,结果出现这个,是不是我的sqlserver还要设置一下选项?但是按我上边写的运行,好像是连上了,但是不知道连到了那个数据库上,头大!你是说把那个xml文件,放到classpath的目录里吗?谢谢!
连接字串应是
jdbc:weblogic:mssqlserver4:192.168.0.51:1433?db=数据库名&&charset=gb2312
Driver 是
weblogic.jdbc.mssqlserver4.Driver
Copyright (c) 1997-1999 by BEA Systems, Inc. All Rights Reserved. WebLogicLicense.xml This is your WebLogic license file. Prior to evalating the WebLogic products, you must first read and
accept the evaluation license at: http://www.weblogic.com/licbeta.html and register as an evaluation user.
When you purchase a product license for WebLogic, you will
receive non-expiring keys for this file by email. Instructions on how to edit and compile this file are online in the
WebLogic Administrator Guide "Installing a WebLogic license" at: http://www.weblogic.com/docs/techstart/license.html If you have other questions about this file or obtaining license
keys, you can email us at [email protected].
-->
<!-- Keys for version 4.0 and later -->
<WEBLOGIC-LICENSES>
<LICENSE PRODUCT="WebLogic"
IP="any" UNITS="unlimited" EXPIRATION="never"
KEY="870d56b939c1f8f5933ca9174a4ac22a"
/>
<LICENSE PRODUCT="WebLogic/SSL"
IP="any" UNITS="unlimited" EXPIRATION="never"
KEY="7093fdcf8157efd7060284beb5be8bc7"
/>
<LICENSE PRODUCT="WebLogic/ClusterII"
IP="any" UNITS="unlimited" EXPIRATION="never"
KEY="5707555716a163c4b0fbcd394ec7bff9"
/>
<LICENSE PRODUCT="Personalization"
IP="any" UNITS="unlimited" EXPIRATION="never"
KEY="7fc478301e23eeb557ad8c6f664b9a74"
/>
<LICENSE PRODUCT="jdbcKona/MSSQLServer4"
IP="any" UNITS="unlimited" EXPIRATION="never"
KEY="b22617083e54125f56f4e5580d021242"
/>
<LICENSE PRODUCT="jdbcKona/Informix4"
IP="any" UNITS="unlimited" EXPIRATION="never"
KEY="5ef00998d338a70115624114677f8f42"
/>
<LICENSE PRODUCT="jdbcKona/Oracle"
IP="any" UNITS="unlimited" EXPIRATION="never"
KEY="25f83bfa0beced41c9f582316bef1d51"
/>
<LICENSE PRODUCT="jdbcKona/Sybase"
IP="any" UNITS="unlimited" EXPIRATION="never"
KEY="9cdbea15b205d3c15d6217f991291179"
/>
<LICENSE PRODUCT="jdbcKona/MSSQLServer"
IP="any" UNITS="unlimited" EXPIRATION="never"
KEY="46bce7882c7755baf74e89026df7c2f9"
/>
</WEBLOGIC-LICENSES>
ResultSet rs = statement.executeQuery("select * from MeetingNote");
rs.last();
int ss = rs.getRow();
System.out.println(ss);
运行到rs.last()就停住了,那是不是jdbc的版本老了,还是其他的原因,怎么看jdbc的版本?