Today's work, see the use of SEAJS framework, Baidu is Ali before the front-end engineer Yuber wrote, is very admire Ah, but has not carefully studied the principle, JS and jquery are not proficient in it. Take the work seriously, today hit the soy sauce for a day. Review the database connection JDBC Connection:
String jdbcdriver;//defines the database interface class: MySQL is Com.mysql.jdbc.Driver, depending on the database category. )
String URL; Defines the path to access the database; The local MySQL path and port number are: http://localhost:3306/database name
String username;//defines the user name of the database
String password;//defines the access password for the database
The Connection Conn;//connection interface is equivalent to creating a Connection object.
What is PreparedStatement ps;//for? Ready to connect?
Result rs;//Database Results set
Class.forName (jdbcdriver); Load database connection class
Conn=drivermanager.getconnection (Url,username,password);//Create Connection object;
Ps=conn.preparestatement (SQL);//
Rs=ps.executequery ();
while (Rs.next ()) {
String s=rs.getstring (1);//output first column;
String s1=rs.getstring ("column name");
}
Outputs the first few rows of the column
String getDate (int i,int j) {
int k=0;
while (Rs.next ()) {
k++;
if (k==j) {
System.out.println (Rs.getstring (j));
}
}
}
Close (); Defines a method to close the interface: first close the RS, then close PS, and then close the conn;
Database Connection pool:
Since the creation of the connection object consumes more serious resources, the pre-created connection is saved in the collection and is taken directly at the time of use.
Too late, do not write, the brain already has a prototype, now has a lot of mature database connection pool, or in the project to study well.
Tomorrow there will be time to start the blog system that project, while doing learning, but also to learn the next Android, on-line words must be from the mobile end first online. Sleep, goodnight.
12th Day How can I persist