站内搜索: 请输入搜索关键词

当前页面: 开发资料首页J2EE 专题请各位大侠指点一下,数据连接的问题!

请各位大侠指点一下,数据连接的问题!

摘要: 请各位大侠指点一下,数据连接的问题!


我是一个初学者,用的SQLSERVER,但是出现在这样的问题,不知道怎么解决,希望各位大侠指点一下。谢谢 注:(sqlserver的jdbc都装了)


服务器端发生错误:

class mypack.BookDB : java.lang.ClassNotFoundException: com.microsofr.jdbc.sqlserver.SQLServerDriver

错误原因为:java.lang.InstantiationException: class mypack.BookDB : java.lang.ClassNotFoundException: com.microsofr.jdbc.sqlserver.SQLServerDriver at org.apache.jsp.bookstore_jsp._jspService(bookstore_jsp.java:67) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:193) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:589) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:666) at java.lang.Thread.run(Thread.java:534)


这是程序:

public class BookDB {

private ArrayList books;
private String dbUrl = "jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=BookDB";
private String dbUser="dbo";
private String dbPwd="dbo";

public BookDB () throws Exception{
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
}

public Connection getConnection()throws Exception{
return java.sql.DriverManager.getConnection(dbUrl,dbUser,dbPwd);
}




就是sqlserver的驱动的3个jar没有加到classpath中


↑返回目录
前一篇: 需要你们的帮助(java)
后一篇: Javabean和Jsp传值问题