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

您没有登录

» Java开发网 » Java EE 综合讨论区  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 这是我在tomcat中sql server连接池的配置,麻烦各位大虾帮我看一下有什么问题
java8110





发贴: 22
积分: 0
于 2004-02-17 12:33 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
这是我在tomcat中的配置,麻烦各位大虾帮我看一下有什么问题,多谢。
server.xml中的配置,我是用administration tool加上的
<GlobalNamingResources>
<Environment name="simpleValue" type="java.lang.Integer" value="30"/>
<Resource auth="Container" description="User database that can be updated and saved" name="UserDatabase" type="org.apache.catalina.UserDatabase"/>
<Resource name="jdbc/mydb" type="javax.sql.DataSource"/>
<ResourceParams name="UserDatabase">
<parameter>
<name>factory</name>
<value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>
</parameter>
<parameter>
<name>pathname</name>
<value>conf/tomcat-users.xml</value>
</parameter>
</ResourceParams>
<ResourceParams name="jdbc/mydb">
<parameter>
<name>maxWait</name>
<value>50</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>4</value>
</parameter>
<parameter>
<name>password</name>
<value>mysql</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:microsoft:sqlserver://srx:1433;databasename=hotel</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>2</value>
</parameter>
<parameter>
<name>username</name>
<value>sa</value>
</parameter>
</ResourceParams>
</GlobalNamingResources>
web.xml的配置
<resource-ref>
<description>
Resource reference to a factory for java.sql.Connection
instances that may be used for talking to a particular
database that is configured in the server.xml file.
</description>
<res-ref-name>
jdbc/mydb
</res-ref-name>
<res-type>
javax.sql.DataSource
</res-type>
<res-auth>
Container
</res-auth>
</resource-ref>
jsp页面的调用
<%
    Context initCtx = new InitialContext();
    Context envCtx = (Context) initCtx.lookup("java:comp/env");
    
    // Look up our data source
    DataSource ds = (DataSource)envCtx.lookup("jdbc/mydb");
    // Allocate and use a connection from the pool
    Connection conn = ds.getConnection();
%>
出现的错误
javax.servlet.ServletException: Cannot create JDBC driver of class '' for connect URL 'null', cause: null
  org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:867)
  org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:800)
  org.apache.jsp.index_jsp._jspService(index_jsp.java:69)
  org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
  org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
  org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
  org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
  javax.servlet.http.HttpServlet.service(HttpServlet.java:856)

谢谢!




话题树型展开
人气 标题 作者 字数 发贴时间
2799 这是我在tomcat中sql server连接池的配置,麻烦各位大虾帮我看一下有什么问题 java8110 3083 2004-02-17 12:33
2288 Re:这是我在tomcat中sql server连接池的配置,麻烦各位大虾帮我看一下有什么问题 java8110 8 2004-02-17 16:54

flat 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