• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

MSSQL JDBC driver with tomcat

 
Ranch Hand
Posts: 139
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I try to place all mssql *.jar into \tomcat\common\lib

I compile my java file with "import com.microsoft.jdbc.sqlserver.*;"
it says

"DBConn.java:5: package com.microsoft.jdbc.sqlserver does not exist
import com.microsoft.jdbc.sqlserver.*;"

but if I extract the mssql jar files into tomcat\common\lib\com\microsoft\jdbc\sqlserver.
it can, how can I fix the problem? Thanks
 
author
Posts: 4348
40
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to set your Tomcat classpath properly. The files aren't really compiled with the mysql.jar (unless you're using MySQL specific classes in your code which is often unlikely), so the file is rarely not used during compiling.

It is, on the other hand, used directly at runtime. You may need to place the jar into the WEB-INF/lib directory of the web application. It's been awhile since I've used tomcat, so I could be off on that. Other than that, try updating the classpath for tomcat to find the jar you placed.
 
She's out of the country right now, toppling an unauthorized dictatorship. Please leave a message with this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic