Get Started. It's Free
or sign up with your email address
Rocket clouds
JBDC by Mind Map: JBDC

1. SQL Statements

1.1. INSERT

1.1.1. Creates a new row

1.2. DELETE

1.2.1. Removes existing data

1.3. UPDATE

1.3.1. Change existing data

1.4. SELECT

1.4.1. Reads data

2. Four keys Interfaces JAVA API

2.1. Driver

2.1.1. DriverManager

2.1.1.1. Factory method getConnection()

2.1.1.1.1. JAR file contains java.sql.Driver file

2.1.1.1.2. Older JAR files

2.2. Connection

2.2.1. Conncect database

2.2.1.1. JDBC URL

2.2.1.1.1. Three parts

2.3. ResultSet

2.3.1. Create a ResultSet with three diferent types

2.3.1.1. TYPE_FORWARD_ONLY

2.3.1.1.1. Go through the data in order

2.3.1.1.2. Default

2.3.1.2. TYPE_SCROLL_INSENSITIVE

2.3.1.2.1. Go through the data in any order

2.3.1.3. TYPE_SCROLL_SENSITIVE

2.3.1.3.1. Go through the data in any order

2.3.2. Creates a ResultSet with concurrency modes

2.3.2.1. CONCUR_READ_ONLY

2.3.2.1.1. Reads data but not write it

2.3.2.2. CONCUR_UPDATABLE

2.3.2.2.1. Read and write data

2.3.3. Method next()

2.3.3.1. Returns true if existing data

2.3.3.1.1. moves a cursor position data

2.3.4. get methods

2.3.4.1. Wrappers

2.3.4.2. index int or name column

2.3.4.2.1. index begins 1

2.4. Statement

2.4.1. executeUpdate()

2.4.1.1. returns rows affected

2.4.2. executeQuery() returns ResultSet

2.4.2.1. Only SELECT SQL Statement

2.4.3. execute() returns boolean

2.4.3.1. true if the first result is a ResultSet object

2.4.3.1.1. getResultSet()

2.4.3.2. false if it is an update count or there are no results

2.4.3.2.1. getUpdateCount()

3. Database specific

3.1. JAR file implements interfaces

4. Close resources

4.1. avoid leaking resources

4.1.1. Closing a Connection automatically closes the Statement and ResultSet objects

4.1.2. Closing Statement automatically closes the ResultSet

4.2. try-with-resources

4.2.1. Does not require explicit closing

5. Dealing Exceptions

5.1. SQLException

5.1.1. getMesage

5.1.1.1. returns a human-readable message as to what went wrong

5.1.2. getErrorCode

5.1.2.1. Retrieves the vendor-specific exception code for this SQLException object

5.1.3. getSQLState

5.1.3.1. returns a code as to what went wrong