• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

where to add mysqlconnector jar in eclipse

 
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i am using servlet and mysql i placed jar file in webinf->lib but it tell class not found error in eclipse

org.gtj.mm.mysql.Driver class not found exception

can anybody tell where to place mysqlconnector.jar in eclipse?






thanks in advance





 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should add it to the specific project you're working on, either by importing it into a library directory, putting it in WEB-INF/lib if it's a web app, or use it as an external jar.

I'd also recommend using the com.mysql.jdbc.Driver class (or whatever it's called; I don't remember) instead of the very old compatibility driver name.
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are correctly coding to the JDBC spec, and not using database-specific functionality, you should not need to include the MySQL JDBC driver JAR file in your project - the JDBC API is all in the JDK runtime JAR.
 
David Newton
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What? I don't see how you could just use MySQL through JDBC without the MySQL connector. All databases supply their own JDBC drivers. How would you instantiate a driver?
 
vijayakumar durai
Ranch Hand
Posts: 153
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you friends i got result i download new mysql connector jar file and place it in web-inf ->lib its working
 
Saloon Keeper
Posts: 27763
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This sounds like the classical confusion between the IDE and the deployable application.

The ONLY time you need to put ANY database driver "in Eclipse" is if you have an Eclipse tool such as one of the database management plug-ins and you need to tell the plug-in where to find the driver.

For general app development, Eclipse could care less (and in fact, has no use for databases). In that case, what you really want is to make the driver available to the application. And, specifically, if Eclipse is managing a web application server for debugging purposes, to that application server environment. And, as in general databases, Eclipse doesn't know nor does it care about web application servers. Only an installed plugin for webapp development such as sysdeo or WTP will care.

Normally, you should not put application libraries in your webapp server's private libraries, you should put them in the webapp's WEB-INF/lib directory. One of the few exceptions is JDBC drivers. Normally, you'd want to place things like the mysql connector jar in the server's common library directory (for example, CATALINA_HOME/lib, for Tomcat). That's because unlike most Java code, the drivers are intended to be shared between multiple applications, and may, in fact, do better resource management if they do. It also insulates your webapps from dependence on a particular driver/version and makes them somewhat more portable.
 
Peter Johnson
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When the OP mentioned an Eclipse error, I assumed that it was a compile error. The OP was not clear on this topic. As Tim pointed out, there is a big difference between building an app that uses JDBC and running it - you don't need the driver to build it.
 
reply
    Bookmark Topic Watch Topic
  • New Topic