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

您没有登录

» Java开发网 » Servlet/JSP/JSF/JavaFX Script » 精华  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
reply to postflat modethreaded modego to previous topicgo to next topicgo to back
作者 [求助]jdbc 连接sqlserver
talkinsky





发贴: 2
于 2005-03-27 21:50 user profilesend a private message to userreply to postsearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
在下写了一个连接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
可是我的数据库服务器经过测试可以连接到数据库。
请各位大虾们帮帮忙找出问题,谢谢!




话题树型展开
人气 标题 作者 字数 发贴时间
7284 [求助]jdbc 连接sqlserver talkinsky 958 2005-03-27 21:50
6245 Re:[求助]jdbc 连接sqlserver sogui 37 2005-03-30 16:27
6252 Re:[求助]jdbc 连接sqlserver talkinsky 8 2005-03-30 21:58
6260 Re:[求助]jdbc 连接sqlserver caozhe2005 185 2005-04-04 14:11
6124 Re:[求助]jdbc 连接sqlserver why 525 2005-04-06 23:25
6416 Re:[求助]jdbc 连接sqlserver InnocentBoy 16 2005-04-04 14:31
6361 Re:[求助]jdbc 连接sqlserver InnocentBoy 21 2005-04-04 15:00
6408 Re:[求助]jdbc 连接sqlserver feng 11 2005-04-06 18:02
6365 Re:[求助]jdbc 连接sqlserver InnocentBoy 17 2005-04-07 17:05
6184 Re:[求助]jdbc 连接sqlserver why 121 2005-04-07 20:18

reply to postflat 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