• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How To Connect JSP with MySQL

 
P Arunkumar
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1604
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
P Arunkumar
Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1604
5
Android Java Java ME
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic