JDBC Connection Interface Flashcards

1
Q

Creates a statement that can b e used to send SQL statements to the database.

A

Statement createStatement()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Creates a PreparedStatement object that can contain SQL statements. The SQL statement can have IN parameters; they may contain ‘?’ symbol(s), which are used as placeholders for passing actual values later.

A

PreparedStatement prepareStatement(String sql)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Creates a CallableStatement object for calling stored procedures in the database. The SQL statement can have IN or OUT parameters; they may contain ‘?’ symbol(s), which are used as placeholders for passing actual values later.

A

CallableStatement prepareCall(String sql)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Gets the DataBaseMetaData object. This metadata contains useful information, such as schema information, table information etc., which is especially useful when you don’t know the underlying database.

A

DatabaseMetaData getMetaData()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Returns a Clob object. CLOB (Character Large Object) is a built in type in SQL; it can be used to store a column value in a row of a database table.

A

Clob createClob()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Returns a blob object. BLOB (Binary Large Object) is a built in type in SQL; it can b e used to store a column value in a row of a database table.

A

Blob createBlob()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

When passed the schema name, it sets this Connection object to the database schema to access.

A

void setSchema(String schema)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Returns the schema name of the database associated with this connection object; returns null if no schema is associated with it.

A

String getSchema()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Gets a connection object from the driver manager.

A

DriverManager.getConnection()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Closes the connection. Automatically called if try-with-resources is used.

A

close()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Sets the auto-commit mode to true or false. By default, this is set to true.

A

void setAutoCommit(boolean autoCommit)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Returns the auto commit mode currently set (true means auto commit mode is set, false means it is not).

A

boolean getAutoCommit()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Creates a Savepoint object in the current transaction and returns that object.

A

Savepoint setSavepoint()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Creates a Savepoint object in the current transaction with a name associated with it and returns that object.

A

Savepoint setSavepoint(String name)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Removes the given Savepoint object and subsequent Savepoint objects from the current transaction.

A

void releaseSavepoint(Savepoint savepoint)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Rolls back to the given Savepoint state. Throws a SQLException if the rollback cannot be done.

A

void rollback(Savepoint savepoint)

17
Q

Rolls back all changes made in the current transaction. Throws a SQLException if there is nothing to roll back, like if auto-commit mode is on.

A

void rollback()

18
Q

Commits all changes done so far in the transaction to the database.

A

void commit()