context.xml配置如下
<!-- The contents of this file will be loaded for each web application -->
<Context>    <!-- Default set of monitored resources -->
    <WatchedResource>WEB-INF/web.xml</WatchedResource>

    <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <!--
    <Manager pathname="" />
    -->
<Resource name="jdbc/e-book" auth="Container"
  type="javax.sql.DataSource" maxActive="100"
  maxIdle="30" maxWait="10000" username="sa"
  password="sa"
driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver"
url="jdbc:microsoft.sqlserver://127.0.0.1:1433;DataBaseName=e-book"
/>
</Context>
web.xml配置如下
  <resource-ref>
  <description>e-book</description>
  <res-ref-name>jdbc/e-book</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Container</res-auth>
  </resource-ref>连接类
DataSource source = (DataSource) ic.lookup("java:comp/env/jdbc/e-book");
connection = source.getConnection();
preparedStatement = connection.prepareStatement("select * from titles ORDER by title");
最后提示我Cannot create JDBC driver of class 'com.microsoft.sqlserver.jdbc.SQLServerDriver' for connect URL 'jdbc:microsoft.sqlserver://127.0.0.1:1433;DataBaseName=e-book'用的mssql2005

解决方案 »

  1.   

    看看驱动啊对  还有就是URL 端口及数据库名对不对
      

  2.   

    连接数据库的jar包是不是正确导入,在就是你的端口问题设置对不对!
      

  3.   

    请问你使用的数据库是哪个版本的。SQL server 2000sp3一下版本要下载升级驱动,是否添加jar文件,之前的没用连接池的Pure连接能否连接上去?期待……
      

  4.   

    看看驱动啊对 还有就是URL 端口及数据库名对不对
      

  5.   


    数据库用的mssql2005...还是失败..FML