Java开发网 |
注册 |
登录 |
帮助 |
搜索 |
排行榜 |
发帖统计
|
您没有登录 |
» Java开发网 » Database/JDBC/SQL/JDO/Hibernate
» MS SQL
打印话题 寄给朋友 订阅主题 |
作者 | jdbc连接sqlserver2000出错信息 |
huahualiushui
发贴: 3 积分: 0 |
于 2005-04-09 12:02
win2003 sqlsever2000 sqlserver打上了sp3的补丁 (Microsoft SQL Server 2000 Driver for JDBC Service Pack 1 Version 2.2.0029 December 2002) 并且我也把下面三个加到了classpath中 D:\JDBC\lib\msbase.jar; D:\JDBC\lib\mssqlserver.jar; D:\JDBC\lib\msutil.jar; 运行程序怎么出现错误 :No suitable driver 帮我分析一下 谢谢! SWT Designer v1.2.3 Released! |
作者 | Re:jdbc连接sqlserver2000出错信息 [Re:huahualiushui] |
why
問題兒童 总版主 发贴: 4629 积分: 388 |
于 2005-04-10 06:16
Most likely the connection URL is incorrect, double check and understand what it is before you post it here. 搞笑QQ图片 |
作者 | Re:jdbc连接sqlserver2000出错信息 [Re:huahualiushui] |
czl1314
发贴: 4 积分: 0 |
于 2005-04-10 16:25
我的是WINDOWs2000+J2SDK1.4.2_07+SQL2000,也出现同样的情况, 但我的sqlsever2000 sqlserver sp3的补丁没打上,这有影响吗? 我在sqlsever2000 那里测试的时候是可以连接上的,但在下面程序里面 运行就不能连接得上。请问是不是程序本身出现了问题啊?conn = DriverManager.getConnection(url,"MRLV",""); 的MRLV和""指的是服务器的名字和密码吧?小弟在数据库编程着方面还是个菜鸟,请各位大虾指点一下,谢谢!! import java.net.URL; import java.sql.*; public class testsql{ public testsql(){ } public static void main(String[] args){ testsql testsqll =new testsql(); String url = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=tsglxt"; Connection conn; try{ Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); }catch(java.lang.ClassNotFoundException e){ System.err.print("没有找到jdbc-odbc"); System.err.print(e.getMessage()); } try{ conn = DriverManager.getConnection(url,"MRLV",""); DatabaseMetaData dma=conn.getMetaData(); System.out.println("Connect to Database"+dma.getURL()); System.out.println("Driver and Version : "+dma.getDriverName()+","+dma.getDriverVersion()); System.out.println("Connect success"); conn.close(); }catch(Exception e){ System.out.print(e.getMessage()); e.printStackTrace(); } } } 菜鸟请教,基本程序调试不通,急急急急急急!!! |
作者 | Re:jdbc连接sqlserver2000出错信息 [Re:huahualiushui] |
czl1314
发贴: 4 积分: 0 |
于 2005-04-10 18:51
出现了如下问题,请问谁是帮帮小弟啊? CJSDNer6月14日北京聚会花絮 |
作者 | Re:jdbc连接sqlserver2000出错信息 [Re:huahualiushui] |
why
問題兒童 总版主 发贴: 4629 积分: 388 |
于 2005-04-10 21:55
I have doubts with what you say: 在sqlsever2000 那里测试的时候是可以连接上的 What did you test? How did you test? Check http://support.microsoft.com/default.aspx?scid=kb;en-us;313100 Basic Connectivity Troubleshooting These are common error messages that may occur when you try to connect to your SQL server: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]Login failed for user 'user'. Reason: Not associated with a trusted SQL Server connection. This error message occurs if the SQL Server 2000 authentication mode is set to Windows Authentication mode. The Microsoft SQL Server 2000 driver for JDBC does not support connecting by using Windows NT authentication. You must set the authentication mode of your SQL Server to Mixed mode, which permits both Windows Authentication and SQL Server Authentication. java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]This version of the JDBC driver only supports Microsoft SQL Server 2000. You can either upgrade to SQL Server 2000 or possibly locate another version of the driver. This error message occurs you try to connect to a SQL Server version earlier than SQL Server 2000. The Microsoft SQL Server 2000 driver for JDBC supports connectivity only with SQL Server 2000. [转帖]面向对象的思维方法 |
作者 | Re:jdbc连接sqlserver2000出错信息 [Re:huahualiushui] |
czl1314
发贴: 4 积分: 0 |
于 2005-04-11 15:25
我只是在设置数据源的时候那里有个测试的,这个与驱动器没关的 还有就是Microsoft SQL Server 2000 Driver for JDBC是不是要拷到 J2SDK1.4.2_07的LIB那个文件夹里面去的呀?相关的设置怎么设置? 谢谢! 如何用JTable设置表头多行 |
作者 | Re:jdbc连接sqlserver2000出错信息 [Re:huahualiushui] |
why
問題兒童 总版主 发贴: 4629 积分: 388 |
于 2005-04-11 19:30
This error message occurs if the SQL Server 2000 authentication mode is set to Windows Authentication mode. Do you understand? I won't put such a poor JDBC implementation into J2SDK's lib. In fact I won't put anything into it unless absolutely required. What Java really cares is the classpath. It should be fine as long as you have include the 3 jars in the classpath. 关于女孩子从事软件开发的问题 |
作者 | Re:jdbc连接sqlserver2000出错信息 [Re:huahualiushui] |
ekinfeng
发贴: 12 积分: 0 |
于 2005-04-14 00:14
我也出现了同样的问题 WINDOWs2003+J2SDK1.4.2_07+SQL2000 其中sqlsever2000 sqlserver sp3的补丁以打上 我的三个环境变量在classpath中如下设置 D:\Apache\Tomcat\common\lib\msbase.jar; D:\Apache\Tomcat\common\lib\mssqlserver.jar; D:\Apache\Tomcat\common\lib\msutil.jar; 测试的JSP页面文件如下: <%@ page contentType="text/html;charset=gb2312" %> <%@ page import="java.sql.*" %> <html> <body> <%Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance(); String url="jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=BookStore"; //pubs为你的数据库的 String user="test"; String password="test"; Connection conn=DriverManager.getConnection(url,user,password); Statement stmt=conn.createStatement(); String sql="select * from guest"; ResultSet rs=stmt.executeQuery(sql); while(rs.next()) {%> 您的第一个字段内容为:<%=rs.getString(1)%> 您的第二个字段内容为:<%=rs.getString(2)%> <%}%> <%out.print("数据库操作成功,恭喜你");%> <%rs.close(); stmt.close(); conn.close(); %> </body> </html> (注:其中BookStore为自己创建的数据库,guest为创建的表) 在TOMCAT5.0.30中运行后页面中有如下错误信息: HTTP Status 500 - -------------------------------------------------------------------------------- type Exception report message description The server encountered an internal error () that prevented it from fulfilling this request. exception javax.servlet.ServletException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]用户 'test' 登录失败。原因: 未与信任 SQL Server 连接相关联。 org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:846) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:779) org.apache.jsp._1_jsp._jspService(_1_jsp.java:84) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) root cause java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]用户 'test' 登录失败。原因: 未与信任 SQL Server 连接相关联。 com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source) com.microsoft.jdbc.base.BaseExceptions.getException(Unknown Source) com.microsoft.jdbc.sqlserver.tds.TDSRequest.processErrorToken(Unknown Source) com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReplyToken(Unknown Source) com.microsoft.jdbc.sqlserver.tds.TDSLoginRequest.processReplyToken(Unknown Source) com.microsoft.jdbc.sqlserver.tds.TDSRequest.processReply(Unknown Source) com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown Source) com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown Source) com.microsoft.jdbc.base.BaseConnection.open(Unknown Source) com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source) java.sql.DriverManager.getConnection(DriverManager.java:512) java.sql.DriverManager.getConnection(DriverManager.java:171) org.apache.jsp._1_jsp._jspService(_1_jsp.java:53) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) note The full stack trace of the root cause is available in the Apache Tomcat/5.0.30 logs. 本人是刚开始学习JSP,希望有好心的朋友可以给我分析下情况,万分感谢! 25了才开始学JAVA晚吗? |
作者 | Re:jdbc连接sqlserver2000出错信息 [Re:ekinfeng] |
why
問題兒童 总版主 发贴: 4629 积分: 388 |
于 2005-04-14 00:52
ekinfeng wrote: Isn't this clear enough? I believe you should be able to find hundreds of links with Google, and actually it is just above: This error message occurs if the SQL Server 2000 authentication mode is set to Windows Authentication mode. The Microsoft SQL Server 2000 driver for JDBC does not support connecting by using Windows NT authentication. You must set the authentication mode of your SQL Server to Mixed mode, which permits both Windows Authentication and SQL Server Authentication. 学java的朋友,请一起来投票让sun推出中文jdk文档!!! |
作者 | Re:jdbc连接sqlserver2000出错信息 [Re:huahualiushui] |
why
問題兒童 总版主 发贴: 4629 积分: 388 |
于 2005-04-14 01:00
ok, since I have a SQL Server installation here, I could tell me how to set the authentication mode of your SQL Server to Mixed mode: 1. open Enterprise Manager 2. select the database instance (likely to be (LOCAL)) 3. right-click and select Properties 4. select the "Security" tab I assume this is more than enough... 联想游戏(欢迎跟贴,哈) |
作者 | Re:jdbc连接sqlserver2000出错信息 [Re:huahualiushui] |
ekinfeng
发贴: 12 积分: 0 |
于 2005-04-14 13:46
谢谢版主 唉!~看来自己还得把数据库操作上的一些小问题好好熟悉下呀 对了,你可以经你介绍几个有关具体学习像MSSQL或MYSQL之类具体操作上的网址吗? 关于 异常 。。。。 谢谢指教 |
作者 | Re:jdbc连接sqlserver2000出错信息 [Re:ekinfeng] |
why
問題兒童 总版主 发贴: 4629 积分: 388 |
于 2005-04-14 20:00
ekinfeng wrote: I only read M$ documentation (well, of course, Mr. Henderson's Guru's Guide to T-SQL, but this is rather irrelevant to DB admin) and a very old ebook on MySQL -- haven't used it for 4 years. 学习java的工具(IDE)有什么? |
已读帖子 新的帖子 被删除的帖子 |
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 |