Chapter 10: JDBC Flashcards

1
Q

Enumerate the four interfaces in JDBC

A

Connection, Driver, Statement, ResultSet

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

Parts of JDBC URL

A

: :

jdbc:oracle:thin:@192168.1.18:1521:orcl

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

what is Class.forName() method for?

A

It loads the class and throws ClassNotFoundException if the class is not available.

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

Two ways to create a statement?

A

conn. createStatement() and

conn. createStatement(ResultSet type, ResultSet concurrency)

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

ResultSet type, You can go through the data once in the order in which it was retrieved.

A

ResultSet.TYPE_FORWARD_ONLY

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

ResultSet Type, Allows you to move forward and backward to the resultSet but the result set is static.

A

ResultSet.TYPE_SCROLL_INSENSITIVE

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

ResultSet Type, Allows you to move backward and forward in the ResultSet but you see the latest data when scrolling

A

ResultSet.TYPE_SCROLL_SENSITIVE Not many database driver and database support this feature.

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

ResultSet Concurrency Mode, you cannot update the result set.

A

ResultSet.CONCUR_READ_ONLY

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

ResultSet Concurrency Mode, you can update the result set.

A

ResultSet.CONCUR_UPDATABLE

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

statement method, you can execute a query or update statement and it will return a boolean if there is a result set.

A

statement.execute(“Query”);

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

statement method, executes a query and returns a result set

A

statement.executeQuery(“Query”);

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

statement method, executes an update, delete, and insert. returns how many rows are affected.

A

statement.executeUPdate(“Query”);

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

9 get methods in ResultSet.

A
getBoolean
getDate
getDouble
getInt
getLong
getObject
getString
getTime
getTimeStamp
How well did you know this?
1
Not at all
2
3
4
5
Perfectly