Feb-17 how to install SQL and JSP

This week, we meet up again and we have made the decisions about how to splits people into groups and start our project. There are groups in Coloring, Puzzle, Content Frames, Home Page, PhoneGap and Database. And I choice to been in the Database group, I wish to build a database in order to replace the content in the app easily to make the app will being used wildly. None of our group member have very specific experience on build such a database in a web. So we have to starting from doing a research on it.

And what I have done this week is installed both Java and mySQL on the computer. And most important thing to know about is how to make the connection between these two. So I found out a good example on the web to show such thing.



<head><title>Enter to database</title></head>
<%@ page import=”java.util.*” %>
<%@ page import=”javax.sql.*;” %>

java.sql.Connection con;
java.sql.Statement s;
java.sql.ResultSet rs;
java.sql.PreparedStatement pst;


// Remember to change the next line with your own environment 
String url= 
String id= “username”;
String pass = “password”;

con = java.sql.DriverManager.getConnection(url, id, pass);

}catch(ClassNotFoundException cnfex){

String sql = “select top 10 * from tbl_sys_user”;
s = con.createStatement();
rs = s.executeQuery(sql);

while( rs.next() ){
<td><%= rs.getString(“cust_id”) %></td>
<td><%= rs.getString(“rdate”) %></td>
<td><%= rs.getString(“email”) %></td>


catch(Exception e){e.printStackTrace();}
if(rs!=null) rs.close();
if(s!=null) s.close();
if(con!=null) con.close();




(From: http://www.java-samples.com/showtutorial.php?tutorialid=619 )


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s