mode 4 JDBC Flashcards

1
Q

What is a Design Pattern

A

Opinionated

It is a solution to a common problem.

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

What is the DAO design pattern?

A

Data Access Object

its a design pattern that allows us to serperate the application/business logic from the persistance layer

its how we separate our requirement logic / code and logic for our database

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

What are the layers in the DAO design pattern?

A

> DAO Layer - directly accesses the database (using JDBC)
>Service Layer - directly acceses the DAO layer

What are layers??
packages! They will have their own packages

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

What is the heirachy of full stack

A
talks to                                talks to                        talks to
Frontend   
     ||     ^
     V    ||
Backend Controller  
     ||     ^
     V    ||
Service Layer 
   ||     ^
     V    ||
DAO Layer
  ||     ^
  V    ||
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is JDBC?

A

Java Database Connectivity
> JDBC is technology that allows java to connect to a database
> JDBC is modular. It doesnt connect to any specific DB it can connect to any DB as long as it has the driver

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

What is needed for you to be able to connect to a database?

A

> url
> username
> password
> driver for the specific database

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

Important classes/interfaces that JDBC uses

A
Important classes/interfaces that JDBC uses
	DriverManager (class)
	Connection (interface)
	Statement (interface)
		PreparedStatement(interface)
		CallableStatement(interface)
	ResultSet (interface)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What are some common errors you may have in JDBC

A

“No suitable driver found”
the two common reasons wh you’ll see this are:
-you forgot to add the dependency to your gradle…in short, you don’t have a driver at all
-your url has a typo

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

Does JDBC needs a SPECIFIC format for the driver manager?

A

JDBC needs a SPECIFIC format to the URL string so that the DriverManager

 * can understand which driver that you are using
 *  
 * For PostgreSQL, the URL format is:
 * url = jdbc:postrgesql://[endpoint]/[databasename]
How well did you know this?
1
Not at all
2
3
4
5
Perfectly