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

<%@ page import="java.lang.System" %>





<%! public ResultSet queryDB(String query) {

      	String url = "jdbc:mysql://localhost.localdomain/"+YOUR DATABASE NAME;

	String user = YOUR USER NAME
	String pwd =  YOUR PASSWORD
     	ResultSet result = null;


      	try { 
      
		DriverManager.registerDriver(new com.mysql.jdbc.Driver());
	 
       Connection conn = DriverManager.getConnection(url, user, pwd);

    		Statement stmt = conn.createStatement ();
      
		ResultSet rset = stmt.executeQuery(query);

		result=rset;
	
    
	} catch (SQLException e) {
 }


	
	return result;

    
	}

%>









<%! public int updateDB(String update) {

      	String url = "jdbc:mysql://localhost.localdomain/"+YOUR DATABASE NAME;

	String user = YOUR USER NAME
	String pwd =  YOUR PASSWORD
      	int result = -1;

 	try { 
      
		DriverManager.registerDriver(new com.mysql.jdbc.Driver());
 
      		Connection conn = DriverManager.getConnection(url, user , pwd);

      		Statement stmt = conn.createStatement ();

      		result = stmt.executeUpdate(update);

	} catch (SQLException e) {
 }


	
	return result;

     
	}

%>
