MySQL connector_j_5.1.34_2014.10

Source: Internet
Author: User
Tags throw exception

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.