# # JDBC Large-type data access # #
# Basic Concepts;
|--large text type data and sophomore binary data;
The main idea is to use large binary data (bytes)
or large text data (characters) read from a disk file
To the database, or read it from the database to disk;
In short, the database flow operation;
# large text data;
>> basic steps;
|--Clobtest.java
|--building the Library;
|--Building table;
|--update configuration file;
|--reads data from the stream into the database;
Details of the |--Setcharacterstream () method;
> does not support long type in 1.6;
> only supports int type in 1.5;
|--data is read from the database;
# sophomore binary data;
>> basic steps; (Reference text type method);
# # Batch Processing # #
# Basic Concepts;
|--batch processing data;
# Two ways of handling
>> Statement
|--SQL statement fixed;
|--can execute different SQL at once
>> preaparedstatement
|--SQL parameter is not deterministic
|--can only execute the same statement once;
|--memory Overflow;
> Because each added data is in memory;
> therefore memory overflow may occur after a certain limit is exceeded;
|--optimization;
> Use Judgment statement;
> sub-batch execution;
> then clears the data that has been executed;
# # Stored Procedure Call # #
# Basic Concepts;
Developed by the DBA prior to being compiled and run on the server;
Improve efficiency and safety;
# How to use
>> definition;
>> use; (see also data);
>> call;
# # transactions Getting Started # #
# Basic Concepts;
Object Processing Language (TPL);
By default, a statement is a single transaction, and the transaction is a whole;
You can encapsulate multiple statements that perform the same task into a single transaction, such as a transfer;
# basic steps;
>> start transaction;---open transaction
>> commit;---commit the transaction;
>> rollback;---rollback TRANSACTION (if failed);
# The nature of the transaction;
>> atomicity---cannot be split, either many statements are successful, or they are unsuccessful;
>> Consistency---must be the database from a consistent state, all the transition to another consistent state;
>> Isolation---Multi-threaded concurrent access, a transaction can not be disturbed by other firms;
>> Persistence---When the transaction is complete, the data should be saved permanently;
# Quarantine operation
The database system is responsible for isolating operations, and writing the code requires only setting the isolation level. If you do not design the corresponding
May cause the following problems;
A, dirty read: One transaction read to another transaction "uncommitted" data.
B, non-repeatable read: Reads a row of data from a table within a transaction, and multiple read results are different.
C, Virtual read (Phantom Read): Refers to a transaction within a transactions to read the inserted data, resulting in inconsistent read and backward reading.
# # database Connection Pool # #
# Basic Concepts;
# Custom connection pool;
The adoption of JDBC Big data