I.JDBC Access database steps popular explanation (eat)
1) Load Driver
Class.forName ("Com.microsoft.jdbc.sqlserver.SQLServer");
2) Establish a connection to the database
Connection ct=drevermanager.getconnection ("Jdbc:microsoft:sqlserver://localhost:1433;databasename=dbuser," sa "," SA ");
3) Create statement object
The statement object sends the SQL statement to the appropriate database and gets the result of the execution
Statement stmt=ct.createstatement ();
Explanation: For example, we go to eat Western food today, then we certainly do not go to the Chinese restaurant, loading the driver is the choice of what type of restaurants, not to go wrong, the restaurant waiter and the back kitchen is connected, because he will give the menu to the cook, rather than for example, health personnel to do this work, Establish a connection with the database we are going to find the waiter to let him order with our menu, instead of looking for a clean-up, a la carte, a la carte after the menu to cook, and finally wait for serving, create statement object is to write the menu, and then to the waiter, according to different requirements on different dishes, return different results
Two.the popular interpretation of MVC (cooking)
MVC meaning:
MVC is a design pattern that makes it mandatory to separate the input, processing, and output of an application. Using an MVC application is divided into three core parts, models, views, controllers. Each of them handles their own tasks.
The individual letters of MVC are M (model), V (view), C (Controller) Controllers
M is mainly done by Java class, or it can be Java bean, EJB, etc.
V done by JSP
C is done by the servlet.
Popular example: do a dish first to find good raw materials, this is the JSP, and then processed to cook, this is the servlet, in the process needs a variety of cooking pot, spoon, etc., this is the Java class (Implementation method), and finally get the results from the JSP display
JDBC Access database steps in Java Web Popular explanations (meals), with MVC's popular explanation (cooking)