Lecture 15 - JDBC Part 1 Flashcards

1
Q

What is JDBC?

A

•JDBC (Java database connectivity) is used for accessing databases from Java applications
–This is not specific for servlets
•Information is transferred from relations to objects and vice-versa
–databases optimized for searching/indexing
–objects optimized for engineering/flexibility

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

What are the seven steps for JDBC?

A

1. Load the driver

  1. Define the Connection URL
  2. Establish the Connection
  3. Create a Statement object
  4. Execute a query
  5. Process the result
  6. Close the connection

•This is typical for a 2-tier database connection: the application talks directly with the database.

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

What is the JDBC Java architecture?

A

•Java code calls JDBC library
•JDBC loads a driver
•Driver talks to a particular database
•Can have more than one driver
–Required if we have more than one database
•Ideal because can change database engines without changing any application code

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

What does the drivermanager do?

A
  • The DriverManager tries all the drivers
  • Uses the first one that works
  • When a driver class is first loaded, it registers itself with the DriverManager
How well did you know this?
1
Not at all
2
3
4
5
Perfectly