Version 5.1 complies with JDBC3.0 and JDBC4.0 specifications
Compatible with mysql4.1-5.7
JDBC4.1 specification for JDK7 support after 5.1.21
Before MySQL4.1, UTF8 is not supported.
Com.mysql.jdbc.Driver is the recommended driver,org.gjt.mm.mysql.driver is the previous
Jdbcurl format:
Jdbc:mysql://[host:3306].../[database]»
[? PROPERTYNAME1] [=propertyvalue1] [&propertyname2] [=propertyvalue2] ...
If database is not specified, it is recommended to use Connection.setcatalog () instead of using the SQL statement "using database"
The disaster tolerant host only supports autocommit mode, because transactions are not guaranteed
And only read-only queries can be made
There are several ways to configure connection properties:
1.java.sql.datasource.setxxx ()
2.drivermanager.getconnection (Properties) passed in
3.drivermanager.getconnection (URL), or Java.sql.DataSource.setURL ()
Can be the following properties:
User,passwod, passwordcharacterencoding
connecttimeout=0 milliseconds Interactiveclient=false idle time instead of wait time
Allowmultiqueries =false, no semicolon in statement, no effect on batch processing
Defaultfetchsize =0
Useunicode default True
Characterencoding Default Automatic detection
Charactersetresults
Continuebatchonerror =true
Emptystringsconverttozero =true, empty string will become ' 0 '
MaxRows =-1 The number of rows returned is unlimited
Tinyint1isbit =true, Transformedbitisboolean =false
Usetimezone, the time zone is automatically converted between client and server, false by default
Zerodatetimebehavior=exception, date all 0 is considered an exception, optional "exception", "Round" and "Converttonull".
Named pipes can be 30%-50% faster than TCP/IP, but will be worse under windows
The connection.isclosed () method only detects if the close () method is called
Want to really detect can run a SQL, throw exception is shut down
Foreign keys can only be used on InnoDB
Try not to use Statement.cancel ()
MySQL does not support cursors
Character_set_server system variables, setting the encoding of the server
When you set the encoding on the client, use Java-style, UTF-8,GBK,
In the server settings encoding, to use the MySQL style, UTF8,GBK
MySQL connector_j_5.1.34_2014.10