File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSP and the fly likes Connection JSP with MySql Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Connection JSP with MySql" Watch "Connection JSP with MySql" New topic
Author

Connection JSP with MySql

Ravisankar Karunanithy
Greenhorn

Joined: Jul 27, 2007
Posts: 4
Hi everybody, i need help, i couldn't connect JSP with MySql. I have used "org.gjt.mm.mysql.Driver" this driver. I have copied in this driver on tamcat/webapps/root/web-inf/lib directory, but still i have facing the problem. my coding is correct. and also i can connect to Java with Mysql. but i couldn't Jsp with MySql, Plese help me...

Ravisankar.K
Vassili Vladimir
Ranch Hand

Joined: Mar 08, 2007
Posts: 1585
Hi,

Put the MySQL JAR file inside webapps/yourApplication/WEB-INF/lib and use the com.mysql.jdbc.Driver as the Driver class.

Best of luck ...


Vassili ...
SCJP 5.0, SCWCD 1.4, SCJA 1.0
Amit Kumargupta
Ranch Hand

Joined: Apr 13, 2007
Posts: 54
Put the MySQL JAR file inside jdk1.5.0/jre/lib/ext and change your drive.
Use the com.mysql.jdbc.Driver as the Driver class.
Amit Kumargupta
Ranch Hand

Joined: Apr 13, 2007
Posts: 54
Put the MySQL JAR file inside jdk1.5.0/jre/lib/ext and change your drive.
Use the com.mysql.jdbc.Driver as the Driver class.


Sorry guys

Its a driver not drive.
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344

Though "com.mysql.jdbc.Driver" is the driver url, i would suggest you to just check the version of the driver against the version of your MySQL database.

If both of them are incompatible, then you would still get an error!

You just refer the same in the website.

For example, this link lists the latest version of ConnectorJ (the JDBC driver for MySQL) here. You can choose the appropriate the version in the box on the left side.
[ July 30, 2007: Message edited by: Raghavan Muthu ]

Everything has got its own deadline including one's EGO!
[CodeBarn] [Java Concepts-easily] [Corey's articles] [SCJP-SUN] [Servlet Examples] [Java Beginners FAQ] [Sun-Java Tutorials] [Java Coding Guidelines]
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
Originally posted by Amit Kumargupta:
Put the MySQL JAR file inside jdk1.5.0/jre/lib/ext and change your drive.


Why do we need to put the jar in JDK/jer/lib/ext ?
Its a web application and it should go to WB-INF/lib.

Ravisankar Karunanithy :Why do you want to connect to database from a view component / jsp ?
[ July 30, 2007: Message edited by: Rahul Bhattacharjee ]

Rahul Bhattacharjee
LinkedIn - Blog
Raghavan Muthu
Ranch Hand

Joined: Apr 20, 2006
Posts: 3344

Hello Ravisankar Karunanithy,

Welcome to JavaRanch


Originally posted by Rahul Bhattacharjee:
Its a web application and it should go to WB-INF/lib.


It should be WEB-INF/lib. Please be careful while choosing and using this particular directory as any of the following would not work properly

  • web-inf
  • Web-inf
  • WEB-inf
  • WEBINF
  • webinf
  • Web-Inf


  • You got to have it exactly as per Sun's Specification, its in all caps and a hiphen in the middle -> "WEB-INF" :thumb:
    [ July 30, 2007: Message edited by: Raghavan Muthu ]
    Rahul Bhattacharjee
    Ranch Hand

    Joined: Nov 29, 2005
    Posts: 2308
    Raghavan Muthu: It should be WEB-INF/lib. Please be careful while choosing and using this particular directory as any of the following would not work properly


    Absolutely , it should be WEB-INF.
    My bad it was a typo.
    ;) ;)
    Raghavan Muthu
    Ranch Hand

    Joined: Apr 20, 2006
    Posts: 3344


    Message by Rahul:
    Absolutely , it should be WEB-INF.
    My bad it was a typo.
    ;) ;)


    That happens at times Rahul! Just wanted to make sure and insist!!
    [ July 30, 2007: Message edited by: Raghavan Muthu ]
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Connection JSP with MySql