title: Cannot create JDBC driver of class '' for connect URL 'null' : Tomcat & SQL Server JDBC driver
body: <p>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).</p>
  
  <p>Basically, I have an error in Tomcat 7.0 (both when running within Eclipse and via startup.bat) that says this once data begins to be accessed by my dynamic web application:</p>
  
  <pre><code>Cannot create JDBC driver of class '' for connect URL 'null'
  java.lang.NullPointerException
  at sun.jdbc.odbc.JdbcOdbcDriver.getProtocol(JdbcOdbcDriver.java:507)
  at sun.jdbc.odbc.JdbcOdbcDriver.knownURL(JdbcOdbcDriver.java:476)
  at sun.jdbc.odbc.JdbcOdbcDriver.acceptsURL(JdbcOdbcDriver.java:307)
  </code></pre>
  
  <p>I have the sqljdbc4.jar file in my tomcat\lib directory. I have also tried putting this in my WEB-INF/lib, and even my JDK lib directories. I don't think sqljdbc.jar will work, as it is intended for older JDK/JRE installs than mine.</p>
  
  <p>I've heard the context.xml and web.xml files are crucial in getting this to work.</p>
  
  <p>web.xml snippet:</p>
  
  <pre><code>&lt;resource-ref&gt;
  &lt;description&gt;LBI DB Connection&lt;/description&gt;
  &lt;res-ref-name&gt;jdbc/LBIDB&lt;/res-ref-name&gt;
  &lt;res-type&gt;javax.sql.DataSource&lt;/res-type&gt;
  &lt;res-auth&gt;Container&lt;/res-auth&gt;
  &lt;res-sharing-scope&gt;Shareable&lt;/res-sharing-scope&gt;
  &lt;/resource-ref&gt;
  &lt;resource-ref&gt;
  &lt;description&gt;OR DB Connection&lt;/description&gt;
  &lt;res-ref-name&gt;jdbc/ORDB&lt;/res-ref-name&gt;
  &lt;res-type&gt;javax.sql.DataSource&lt;/res-type&gt;
  &lt;res-auth&gt;Container&lt;/res-auth&gt;
  &lt;res-sharing-scope&gt;Shareable&lt;/res-sharing-scope&gt;
  &lt;/resource-ref&gt;
  </code></pre>
  
  <p>context.xml</p>
  
  <pre><code>&lt;Context&gt;
  &lt;!-- Default set of monitored resources --&gt;
  &lt;WatchedResource&gt;WEB-INF/web.xml&lt;/WatchedResource&gt;
  &lt;Resource name="jdbc/LBIDB" auth="Container"
  type="javax.sql.DataSource" username="***" password="***"   driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" 
  url="jdbc:sqlserver:localhost;DatabaseName=YYBackOffice;SelectMethod=cursor;"
  maxActive="8" maxIdle="4"/&gt;
  
  &lt;Resource name="jdbc/ORDB" auth="Container"
  type="javax.sql.DataSource" username="***" password="***"   driverClassName="com.microsoft.sqlserver.jdbc.SQLServerDriver" 
  url="jdbc:sqlserver:localhost;DatabaseName=XXBackOffice;SelectMethod=cursor;"
  maxActive="8" maxIdle="4"/&gt;
  </code></pre>
  
  <p>The Context tab does have a closing tab, eventually.</p>
  
  <p>Please help! If you need any more information, please let me know. Also, I'm not sure which context.xml ought to be modified, there are 2 in the Tomcat directories, one in the /conf folder, and one in the webapps/appname/META-INF folder. Sorry if it sounds like I'm a bit of a rookie, that's because I am!</p>
  
  <p>Also, I've seen many different examples of the url="..." part of the context.xml, some including port numbers. I have tried several things out online, but nothing seems to work (doesn't help nothing online is my exact data environment, also I suppose it's challenging that this app queries two different DBs at given times).</p>
  
  <p>Thoughts?</p>