Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Database/JDBC/SQL/JDO/Hibernate » MS SQL  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 [database] JDBC with M$ SQL Server (including Error establishing socket)
why

問題兒童

总版主


发贴: 4629
积分: 388
于 2005-12-04 06:52 user profilesend a private message to usersend email to whysearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
0. Read, please read JDBC programming 101, before asking questions about JDBC programming with M$ SQL Server.


1. use jTDS if possible http://jtds.sf.net
http://www.cjsdn.net/post/view?bid=10&id=162184

1a. Consider not to use the 3 M$ JDBC jars at its C:\Program Files\... folder, but from somewhere with a straight-forward folder name (i.e. shorter and without spaces).


2. Install M$ SQL Server SP3a, not SP3.
(I have no experience with M$ SQL Server 2000 SP4)

2a. Consider changing to another port other than the default one, 1433.


3. Error establishing socket & issues with Windows XP SP2
Here're the official responses from M$ :
http://support.microsoft.com/kb/313178
How to configure Windows XP Service Pack 2 (SP2) for use with SQL Server
http://support.microsoft.com/kb/841249
How to enable SQL Server connectivity on Windows XP Service Pack 2
http://support.microsoft.com/kb/841251
How to manually enable TCP/IP on Windows XP Service Pack 2 for SQL Server 2000
http://support.microsoft.com/kb/841252

... TBC


why edited on 2005-12-04 07:22


Hibernate开发指南
作者 Re:[database] JDBC with M$ SQL Server (including Error establishing socket) [Re:why]
why

問題兒童

总版主


发贴: 4629
积分: 388
于 2005-12-26 19:04 user profilesend a private message to usersend email to whysearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
Database Connection Issues, Solutions and Workarounds
http://dev.mainsoft.com/Default.aspx?tabid=150
(see http://www.cjsdn.net/post/view?bid=10&id=166429&sty=3&age=0&tpg=1&ppg=1#166429 )




CJSDNer6月14日北京聚会花絮
作者 Re:[database] JDBC with M$ SQL Server (including Error establishing socket) [Re:why]
xcj84311





发贴: 3
积分: 0
于 2006-01-09 17:14 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
我安装的MSSQL 2000 个人版,操作系统是XPSP2.安装MS SQL 2000 采用默认路径. 如果JDBC在连接时如果出现 NO SUITABLE DRIVER
就将Microsoft SQL Server 2000 Driver for JDBC SP3安装上.将你安装文件夹LIB下的msbase.jar,mssqlserver.jar,msutil.jar三个文件加到类路径中即将CLASSPATH设置为
C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msbase.jar;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\mssqlserver.jar;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msutil.jar;E:\java\bao\*.*;我的安装都是默认安装所以路径有点长啊.
如果还出现 Error establishing socket异常,那么就安装MS SQL SERVER2000的补丁.我建议最好安装sql server pack sp3,SP4可能i不行.安装的文件名是chs_sql2ksp3.exe.安装后就可以用了,如果你是使用JCRETOR编辑器编辑的话运行还是会出现如下错误:
java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:140)
at a.main(a.java:8)
但是如果在CMD(命令行方式运行时)将会显示:
E:\java>java a
regeister driver success
[Microsoft][SQLServer 2000 Driver for JDBC]Database changed to student
[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]已将数据库上下文改为 'stud
ent'。
[Microsoft][SQLServer 2000 Driver for JDBC]Language changed to 简体中文
[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]已将语言设置改为 简体中文

1 98.0
5 98.0
5 90.0
1 12.0
恭喜你,成功了.


why edited on 2006-01-09 21:08


25了才开始学JAVA晚吗?
作者 Re:[database] JDBC with M$ SQL Server (including Error establishing socket) [Re:xcj84311]
why

問題兒童

总版主


发贴: 4629
积分: 388
于 2006-01-09 21:14 user profilesend a private message to usersend email to whysearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
xcj84311 wrote:
将CLASSPATH设置为
C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msbase.jar;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\mssqlserver.jar;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msutil.jar;E:\java\bao\*.*;我的安装都是默认安装所以路径有点长啊.

You could move the 3 jars to another folder with a shorter path.
E:\java\bao\*.* ?? Are you sure this works?

如果你是使用JCRETOR编辑器编辑的话运行还是会出现如下错误:
java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:265)
at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:140)
at a.main(a.java: 8 )

You may want to show us the source code of a.java (BTW, bad class name).
I'm wondering whether this is a question.

Does JCreator (not JCRETOR, I suppose) us system's CLASSPATH automatically? I think you should set it properly in JCreator.




初学者与<书>

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923