Search Our Database

Example for JSP MySQL connection

Last updated on |

 JavaServer Pages (JSP) is a Java standard technology that enables you to write dynamic, data-driven pages for your Java web applications.  Below is the example of  MySQL database access using JSP.

<%@ page import = "java.sql.*"%>Obtaining a Connection 

Connection conn=null;
ResultSet result=null;
Statement stmt=null;
ResultSetMetaData rsmd=null;
try {
  Class c=Class.forName("com.mysql.jdbc.Driver");
catch(Exception e){
  out.write("Error!!!!!!" + e);
try {
catch(SQLException e) {
  System.out.println("Error!!!!!!" + e);