• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Connection JSP with MySql

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 1585
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ...
 
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 2308
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 3389
Mac MySQL Database Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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: 3389
    Mac MySQL Database Tomcat Server
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • 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 don't get it. A whale wearing overalls? How does that even work? It's like a tiny ad wearing overalls.
    a bit of art, as a gift, the permaculture playing cards
    https://gardener-gift.com
    reply
      Bookmark Topic Watch Topic
    • New Topic