File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes Not able run mysql based jdbc program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Not able run mysql based jdbc program" Watch "Not able run mysql based jdbc program" New topic

Not able run mysql based jdbc program

gyan kumar
Ranch Hand

Joined: Sep 28, 2011
Posts: 61
I have mysql-connector-java-5.1.0-bin.jar should I put in classpath of windows environment variable. In web application I read we can keep in lib directory.

there is any other way.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10826

WEB-INF/lib is the recommended way.

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15092

There are also other ways, but it depends on what servlet container you're running your application in. For example in Apache Tomcat you could also put your libraries in a special lib folder somewhere under the Tomcat installation directory, so that these libraries would be seen by all web applications. (I don't know if this is still possible with Tomcat 7.0, see the Tomcat documentation).

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46397
I think this discussion would sit better on our JDBC forum: moving.
gyan kumar
Ranch Hand

Joined: Sep 28, 2011
Posts: 61
What if my application is not web application then where should I keep/set this .jar file to run my program/application?
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33129

Anywhere on your machine. Where do you keep the rest of the application?

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

I think the best place is inside your software and add it to the software class path.

There you will have the control over it more cleary.

[] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
I agree. Here's the link:
subject: Not able run mysql based jdbc program
jQuery in Action, 3rd edition