File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Connection JSP with MySql

 
Ravisankar Karunanithy
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1585
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ...
 
Amit Kumargupta
Ranch Hand
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 54
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3381
Mac MySQL Database Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Rahul Bhattacharjee
Ranch Hand
Posts: 2308
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
    Posts: 2308
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Posts: 3381
    Mac MySQL Database Tomcat Server
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator

    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
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic