aspose file tools*
The moose likes JDBC and the fly likes How To Connect JSP with MySQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "How To Connect JSP with MySQL" Watch "How To Connect JSP with MySQL" New topic
Author

How To Connect JSP with MySQL

P Arunkumar
Ranch Hand

Joined: Jan 05, 2012
Posts: 118
Hi

I have created some jsp files without database its working perfectly, now i want to connect that project with data base with Mysql.


I don't have any idea about MySql, I tried from out side but till now i didn't get any idea about connection.


Please any one help me from where i want to download mysql , how i want to install and how to connect with jsp page, because iam new to developing field no one is not there to guide me in my office.

Please explain with simple addition program code for connection, then i will develop my self.


Thanks in advance.

Thank & Regards,
Jenifer Rajkumar.
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1398
    
    6

Create a java class that manages your database related things, for e.g. making connection, retrieving result set etc. Under META-INF folder create a file called context.xml where you define your database connection settings.
From your jsp, use JSTL/EL to retrieve results and other things.


Swastik
P Arunkumar
Ranch Hand

Joined: Jan 05, 2012
Posts: 118
Hi

I can't understand how to connect my jsp page with my sql please guide with step by step process.


Thanks in advance,
Jenifer Rajkumar.
Swastik Dey
Rancher

Joined: Jan 08, 2009
Posts: 1398
    
    6

As I said create a java class that manages your connection, that can be somewhat like this



create a file context.xml and store it under META-INF


a sample jsp code to retrieve data




And don't forget to include the required library files in your project build path.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How To Connect JSP with MySQL
 
Similar Threads
How to use different hibernate configurations
for the jdbc connectivity....
MySql Connection
connect my MySQl databse
JSP -> MySQL -> MS Access