Use Java Applet to access the database
To learn any programming language, of course, it must be related to the database. When Java was just born, its support for the database was not very good. After several years of development, its support for the database has also completely reached a mature situation. Since Java Applet is introduced here, it is impossible to use a large space to introduce the knowledge of the database and how to create and design the database, please read some books by yourself! I can't help it anymore.
Here we use Microsoft Access database as an example to illustrate how to enable and read a database.
Step 1:
When Microsoft Access is used to create a database, that is, what is used in my example, the content is free.
Step 2: Compile the program.
1) define variables. The variables are defined as follows:
TextArea theVisits = new TextArea (6, 80 );
// Display the database content
TextField theStatus = new TextField ("", 80 );
// Display the information for opening the database. Equivalent to the Program Status Bar
Connection theConnection; // Connection method of the database
Statement theStatement; // represents a database command sent to the database for execution.
ResultSet theResult; // The data read result, that is, the result returned by the database.
ResultSetMetaData theMetaData;
// Contains useful information about the returned results after database command execution.
String theDataSource; // contains the name of the accessed database or data source, expressed in URL format.
String theUser; // User Name of the database
String thePassword; // Database Password