Karthik
Karthik

Reputation: 1

Connecting Eclipse JSP Page with MySQL DataSource

I need to connect MySQL datasource to a jsp page through eclipse. I need to add, delete and read data from tables. I am using Eclipse Helios, Tomcat Apache 7 and Struts 2. I found some related page How should I connect to JDBC database / datasource in a servlet based application? but i dont know how to use public Database().What do i import. Also pls tell me some simple procedure to add and access data from tables.

Upvotes: 0

Views: 3815

Answers (2)

Akshay Patel
Akshay Patel

Reputation: 21

  1. You have to download mysql server and MySqlWonkbench for better UI. https://dev.mysql.com/downloads/workbench/

  2. You have to add mysql.jar file to run mysql on your eclipse. https://dev.mysql.com/downloads/connector/j/5.1.html

  3. Add jar file to your eclipse project

    • Rightclick on your project --> properties --> java Build path --> add external jar --> select your mysql jar from your pc.

refer this video https://www.youtube.com/watch?v=5vzCjvUwMXg

refer this code for login/signup fusing jsp + mysql https://github.com/Aksh0369/log_sin_jsp-MySql

Upvotes: 0

You need to learn JDBC first - http://download.oracle.com/javase/tutorial/jdbc/index.html - and then you need to add the appropriate Java MySQL driver to your application so that the JDBC connection creation string can locate it.

Start with the tutorial.


Edit: A very good JDBC-based database exploration program is the DBVisualizer - http://www.dbvis.com/ - where the free version can help you getting started as well as help you investigate database contents and an easy SQL editor for getting the selects right.

Upvotes: 2

Related Questions