Topic: [求助]jdbc 连接sqlserver

  Print this page

1.[求助]jdbc 连接sqlserver Copy to clipboard
Posted by: talkinsky
Posted on: 2005-03-27 21:50

在下写了一个连接sqlserver的jsp程序如下:
<%@page contentType="text/html;charset=gb2312"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="java.sql.*"%>
<html>
<head><title>JSP Page</title></head>
<body>
<%
try{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
String url="jdbc:microsoft:sqlserver://127.0.0.1:1433;DatabaseName=lyb";
String user="sa";
String password="12115891";
Connection conn= DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
String sql="select * from lyb";
ResultSet rs=stmt.executeQuery(sql);
while(rs.next()) {%>
您的第一个字段内容为:<%=rs.getString(1)%>
<%}%>
<%
conn.close();
}catch(Exception e){out.printEnvelope;}
%>
</body>
</html>
但是提示:
java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
可是我的数据库服务器经过测试可以连接到数据库。
请各位大虾们帮帮忙找出问题,谢谢!

2.Re:[求助]jdbc 连接sqlserver [Re: talkinsky] Copy to clipboard
Posted by: sogui
Posted on: 2005-03-30 16:27

提示所说的是你的SQL驱动程序没有找到,在工程里面你引入了这个驱动程序未?

3.Re:[求助]jdbc 连接sqlserver [Re: talkinsky] Copy to clipboard
Posted by: talkinsky
Posted on: 2005-03-30 21:58

在哪里引入???

4.Re:[求助]jdbc 连接sqlserver [Re: talkinsky] Copy to clipboard
Posted by: caozhe2005
Posted on: 2005-04-04 14:11

先去下载一个驱动,想要的话发信给我:zhege20022002@yahoo.com.cn传给你
然后,配置方法:
你如果用的是JCREATOR的话,就在configure/options中双击jdk profiles,
弹出一个对话框,双击你的JDK版本,又弹出对话框,在ADD中选Add Archieve...
这时你就把那个驱动加进去再一路点确定就OK了!!

5.Re:[求助]jdbc 连接sqlserver [Re: talkinsky] Copy to clipboard
Posted by: InnocentBoy
Posted on: 2005-04-04 14:31

editplus怎么导入????

6.Re:[求助]jdbc 连接sqlserver [Re: talkinsky] Copy to clipboard
Posted by: InnocentBoy
Posted on: 2005-04-04 15:00

可不可以设置一下驱动的classpath?

7.Re:[求助]jdbc 连接sqlserver [Re: talkinsky] Copy to clipboard
Posted by: feng
Posted on: 2005-04-06 18:02

用jdbc-odbc桥

8.Re:[求助]jdbc 连接sqlserver [Re: caozhe2005] Copy to clipboard
Posted by: why
Posted on: 2005-04-06 23:25

caozhe2005 wrote:
先去下载一个驱动,想要的话发信给我:zhege20022002@yahoo.com.cn传给你
然后,配置方法:
你如果用的是JCREATOR的话,就在configure/options中双击jdk profiles,
弹出一个对话框,双击你的JDK版本,又弹出对话框,在ADD中选Add Archieve...
这时你就把那个驱动加进去再一路点确定就OK了!!


Please read the question carefully before you post.

It's a jsp, i.e. it's about a web container.
put the 3 SQL Server 2000 JDBC jars under /WEB-INF/lib/

if the originator of the post does not understand what the above is, please do some reading on setup and deployment of web application.

9.Re:[求助]jdbc 连接sqlserver [Re: talkinsky] Copy to clipboard
Posted by: InnocentBoy
Posted on: 2005-04-07 17:05

why, R u a EN?

10.Re:[求助]jdbc 连接sqlserver [Re: InnocentBoy] Copy to clipboard
Posted by: why
Posted on: 2005-04-07 20:18

InnocentBoy wrote:
why, R u a EN?

甚麼是EN?
身在楓葉國, 所用的電腦或環境不一定適宜敲中文
就算可以, 也太費時
尤其用中文討論電腦問題有點艱難


   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