Commonly used java.sql package classes and interfaces
- DriverManager
- Connection
- Statement/PreparedStatement
- ResultSet
this section only familiar with the API, be aware of the following section using familiar examples of API usage.
DriverManager class
DriverManager class can automatically find driver class that meets your needs in memory, it is mainly used to obtain a database link object
Method Prototype:
static Connection getConnection(String url,
String user,
String password)
throws SQLException
Description:
Url is the connection string parameter, parameter user database user name, password parameter is the login password to successfully connect to the database returns a Connection object, the connection fails SQLException is thrown exceptions, it must capture
url each database has a different specification, the DriverManager class can be determined according to the type of database url link needs to find the right driver class for links.
Connection interface
Connectio