It's not a secret anymore!
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


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
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
Author

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.
or

there is any other way.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10747
    
    9

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: 15002
    
  27

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
Sheriff

Joined: Oct 13, 2005
Posts: 44616
    
  34
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
Marshal

Joined: May 26, 2003
Posts: 32649
    
216

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.


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Not able run mysql based jdbc program
 
jQuery in Action, 3rd edition