Cannot create JDBC driver of class '' for connect URL 'null' : Tomcat & SQL Server JDBC driver

前端 未结 2 1533
孤城傲影
孤城傲影 2021-01-05 07:40

I\'ve tried just about everything I can find out there, if someone is able to help me out, I will be eternally grateful (and a lot more free in my time).

Basically,

相关标签:
2条回答
  • 2021-01-05 07:58
    1. The context.xml in your web application's META-INF folder will take precedence over the one in the /conf directory, which is really just a generic default.

    2. The open-source JTDS SQL Server driver is way better than Microsoft's. Unless there's an overriding reason, use it instead. The only reason to put it in your tomcat/lib folder is if you're declaring a GlobalNamingResource for the database in your server.xml, otherwise you can just put it in your application's /lib folder.

    3. The JDBC URL for JTDS is: jdbc:jtds:sqlserver://hostname/databasename

    4. The connection driver class for JTDS is: net.sourceforge.jtds.jdbc.Driver

    0 讨论(0)
  • In tomcat 6.0.36 it's exactly the opposite way:

    CATALINA_HOME/conf/Catalina/your_host/context.xml

    will take presedence over the one from

    YourApplication/WebContent/META-INF/

    After putting data following snippet inside the Context-Tag in Catalina/your_host it worked in my case:

    <WatchedResource>WEB-INF/web.xml</WatchedResource>
      <Resource name="jdbc/your_db" auth="Container" type="javax.sql.DataSource"
          maxActive="50" maxIdle="30" maxWait="10000"
          username="your_usr" password="your_pwd" 
          driverClassName="com.mysql.jdbc.Driver"
          url="jdbc:mysql://your_host:3306/your_db"/>
    

    See Tomcat Documentation on http://tomcat.apache.org/tomcat-6.0-doc/config/context.html

    0 讨论(0)
提交回复
热议问题