Flashcards
JDBC
Flashcards do conjunto (15)
- 1JDBC1.Java API used to interact with databases
2. Works with multiple drivers to connect with multiple databases - 2Connection PoolingReuse database connection
Better Performance - 3Batch Process1.Combine the queries as a batch(block) and send the complete batch to database instead of sending single query
2. Faster in execution
3. addBatch() method - 4JDBC Architecturejava program
|
jdbc api
|
jdbc Driver manager
|
jdbc Driver
|
Database - 52 main package1. java.sql
2. javax.sql - 6Classes and Interfaces1. CLASS -- DriverManager
2. INTERFACES -- i.Driver
ii. Connection
iii. Statement
iv. ResultSet - 77 Steps in Using JDBC1. Load the driver -- database specific
2. Define a connection URL
3. Establish the connection -- create an obj
4. Create a Statement Object
5. Execute a query
6. Process the resultSet
7. Close the connection - 8Types of statements in JDBC1. Statement
2. Prepared Statement
3. Callable Statement - 9What is Statement1. Interface representing Static SQL
2.General purpose SQL statements
3. created using createStatement() object - 10What is Prepared Statement1. It extends Statement Interface
2. Precompiled SQL statements which can be executed multiple times -- better performance
3. Parameterized Query with 0/more paras (only INPUT)
4. Reuses same Execution plan - 11Prepared Statement prevents which attackIt prevents SQL injection Attack
- 12What is Callable Statement1. Execute Stored Procedures
2. uses prepareCall() method of connection Interface
3. Can have input/output/both parameters
4. Execution only with execute() method - 133 types of Execute methods1. execute() -- DDL statements , returns boolean value, getResultSet() give the results
2. executeQuery() -- only select statement, returns tabular data. used only for reading the contents of a database
3. executeUpdate() -- insert/update/delete stmts, returns int value i.e. no of rows affected. Only NON-SELECT statements - 14Types of JDBC Drivers1. Type 1/JDBC ODBC -- used for development & testing of the application
2. Type 2/Native API -- used when type3/4 is unavailable
3. Type 3/Network Protocol Driver -- used when accessing multiple types of DB at same time
4. Type 4/Thin Driver -- used when accessing only single database such as ORACLE, MySQL, SQL Server. - 15Type 1 ODBC-JDBC Driver Bridge
Informações
- Descrição
- JFST FlashCards sobre JDBC, criado por Simran Khinvasara em 03-10-2020.
- Criado por
- Simran Khinvasara
- Visualizações
- 0
- Avaliação