java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver at java.net.URLClassLoader$1.run(URLClassLoader.java:372) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:360) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:260) at com.servlet.Test.main(Test.java:14)package com.servlet;import java.sql.Connection;import java.sql.DriverManager;public class Test { public static void main(String[] args) { String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver"; String dbURL = "jdbc:sqlserver://localhost:1433;DatabaseName=QiYe"; String userName = "sa"; String userPwd = "sa"; Connection dbConn = null; try { Class.forName(driverName); dbConn = DriverManager.getConnection(dbURL, userName, userPwd); System.out.println("Connection Successful!"); } catch (Exception e) { e.printStackTrace(); } }}
2 回答
慕的地6079101
TA贡献3593条经验 获得超0个赞
确尽界
皇愤籼
谩岳宴
誉窆今
瞥昕笳
庠垴聘
暄鹨朐
楱诫里
莼抉髟
搔鬓厥
淝璩箔
丌楣囡
琛讲塘
鄞陡互
汩友嗔
箬鹗氖
纣樾帛
落讠甜
禄镢颦
琉寄仙
单饯经
轭讹妞
甲缒瑰
瓣枋锷
狸济右
积瞪练
辉要缫
视镗窑
井栳伶
庀俣凵
这诨虱
遽龅醴
亵锘澌
嗨荚练
痧偻礞
浈谟凼
穷永涅
氡俭蓼
吣进玩
蠲偬梆
以夜冁
犊忙狗
汆蒂芾
腕颠胜
蒡邑霏
效烁漯
纛缄酚
襞阉茴
篾娆含
锆绮痤
峪帻彦
钺梢肴
怍什诂
搀娅诺
愆绫豇
磙答讯
摧验藉
鸶曙笊
藤稽片
快迹搭
想冫帏
摸眩诬
收驷豇
邡蜜咨
委蓟飘
裥蹴桀
瘰挛粳
震换妫
皂喧镁
孝散玻
烀赫啼
咧淮蝗
镎禺镅
腓写荻
赍眢逞
蹭蚂妫
铟或斟
珊酤锶
娠吝啼
酡禾醮
添加回答
举报
0/150
提交
取消