Important classes/interfaces in JDBC-connection, DriverManager, ResultSet, statement, and Common methods

Source: Internet
Author: User

Tag: exec count () performs a span by querying the specified send NEC

DriverManager (basic service for managing a set of JDBC drivers)
It's method:
getConnection(String url, String user, String password)
.

Connection (connection to a specific database.) Executes the SQL statement in the connection context and returns the result)
It's method:
createStatement()
Statementobject to send the SQL statement to the database.
   2. close()
This action occurs when the object's database and the JDBC resource are not waiting for the object to close automatically. ResultSet
   prepareStatement(String sql)    Precompiled objects to send parameterized SQL statements to the database.   PreparedStatement 

4.setAutoCommit(boolean autoCommit)
Sets the auto-commit mode for this connection to the given State. False to not auto-commit
 5.setSavepoint()
SavepointObject.

Statement (the object used to execute a static SQL statement and return the result it produces.) )
It's method:
1.executeQuery(String sql)
ResultSetObject.
   2. executeUpdate(String sql)      , DELETE  statements, or SQL statements (such as SQL DDL statements) that do not return any content. UPDATE   INSERT  return type  int
 3.close()
StatementThis action occurs when the object's database and the JDBC resource are not waiting for the object to close automatically.
PreparedStatement object that represents the precompiled SQL statement. ) (Statement sub-interface )
It's method:
1.executeQuery()
PreparedStatementResultSetObject.

2.executeUpdate()
在此 PreparedStatement 对象中执行 SQL 语句,该语句必须是一个 SQL 数据操作语言(Data Manipulation Language,DML)语句,比如 INSERTUPDATEDELETE 语句;或者是无返回内容的 SQL 语句,比如 DDL 语句。
返回值为int类型
   3.setString(int parameterIndex, String x)
StringValue.

ResultSet (a data table that represents a database result set, usually generated by executing a statement that queries the database)
It's method:

1.getString(int columnIndex)
StringResultSetThe value of the specified column in the current row of the object.
 2.next()   Moves the cursor forward one row from the current position,  returning a boolean type value

3.getMetaData()
ResultSetResultSetMetaData
ResultSetThe object that contains the type and property information for the column in the )
It's method:
1.getColumnCount() ResultSetThe number of columns in the object. The return type is int



Important classes/interfaces in JDBC-connection, DriverManager, ResultSet, statement, and Common methods

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.