File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes IDEs, Version Control and other tools and the fly likes where to keep database drivers in Eclipse IDE Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "where to keep database drivers in Eclipse IDE" Watch "where to keep database drivers in Eclipse IDE" New topic
Author

where to keep database drivers in Eclipse IDE

nirjari patel
Ranch Hand

Joined: Apr 23, 2009
Posts: 374
If I want to connect to a mysql database from servlet, I need to load the driver for mysql using Class.forName(mysql driver)

Where do I need to keep this MySQL driver in eckipse IDE ? I mean in order to load this driver, I have to keep it at some default location so that forName() can load it. So whats this default location ? Can I also provide a complete path to the driver location ?

Thanks
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

For a servlet, you do not need to have the driver in Eclipse anywhere. Instead, you should place the driver in the proper location for your app server. If the app server allows you to place the driver JAR in your WAR, then add the driver in the Libraries tab of the Java Build Path of your project's properties. If you let us know which app server, we can be more specific.


JBoss In Action
nirjari patel
Ranch Hand

Joined: Apr 23, 2009
Posts: 374
I dont understand. If I am connecting to MySQL from servlet, how will the connection be made to database without driver ?
I am not using any app server, I am creating servlet only for practice purpose. Anyways later on I plan to use WebSphere.

1) If I dont have MySQL driver will the driver still be loaded ? Does Eclipse come with database drivers preloaded ? If not, then from where does a driver get loaded to make connection ?
2) If I have MySQL driver stored in any directory on my computer, will it be automatically located and loaded in server ?
3) Do I need to store driver in a particular location only ? if yes, where ?

Please answer these questions pointwise and it will help remove confusion and make picture clear.

Thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: where to keep database drivers in Eclipse IDE