i am new in Jsp please tell me how to connect MySql to JSP ?

Recommended Answers

All 3 Replies

Go to the JSP forum. On top of that there is a link with useful example

Step 1:- (a)Download mysql-connector-java3.1.11-bin.jar or any other updated version. (b) include this in libraries via Project properties->libraries
Step 2:- In MySql, create db with db1(for example), remember userName and pwd and remember it.
Step 3:- Use this code in dao class which will communicate with jsp while storing data
private static Connection con = null;
Class.forName( "com.mysql.jdbc.Driver");
con = DriverManager.getConnection("jdbc:mysql://ipaddress/DB1", user, password);

Step 4: Do connection to database from servlet and not from Java Server Page

Optional Step: If you care to learn something you better to check out post on the top of the JSP section which gives example with description how to tackle this problem for start

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.