home *** CD-ROM | disk | FTP | other *** search
/ Chip 2003 July / CMCD0703.ISO / Software / Freeware / Programare / bugzero / WEB-INF / lib / mysql-connector-java-3.0.8-stable-bin.jar / README < prev   
Encoding:
Text File  |  2003-05-23  |  33.5 KB  |  737 lines

  1. MySQL Connector/J 3.0.7 Stable (formerly MM.MySQL)
  2. MySQL AB's JDBC Driver for MySQL
  3. Copyright (c) 2002 MySQL AB
  4.  
  5. CONTENTS
  6.  
  7. * License
  8. * System Requirements
  9. * Introduction
  10. * Usage and Installation
  11. * Troubleshooting
  12. * Known Bugs
  13. * Support
  14.  
  15. LICENSE
  16.  
  17. MySQL Connector/J is licensed under the GPL or a commercial license
  18. from MySQL AB. 
  19.  
  20. If you have licensed this product under the GPL, please see the COPYING
  21. file for more information. 
  22.  
  23. If you have licensed this product under a commercial license from
  24. MySQL AB, please see the file "MySQLEULA.txt" that comes with this 
  25. distribution for the terms of the license.
  26.  
  27. If you need non-GPL licenses for commercial distribution please contact 
  28. me <mark@mysql.com> or <sales@mysql.com>.
  29.  
  30.  
  31. SYSTEM REQUIREMENTS
  32.  
  33. * Any Java virtual machine supporting JDBC-2.0 or newer (JDK-1.2 or newer)
  34. * Any MySQL server supporting version 9 or 10 of the MySQL protocol
  35.  
  36. Because MySQL is not fully ANSI SQL-92 compliant, it is not possible to 
  37. create a fully JDBC-compliant driver for MySQL.  However, this driver 
  38. strives to implement as much of the JDBC API as is feasible.
  39.  
  40. INTRODUCTION
  41.  
  42. MySQL Connector/J is an implemntation of the JDBC API for the MySQL relational
  43. database server. It strives to conform as much as possible to the API
  44. as specified by JavaSoft. It is known to work with many third-party 
  45. products, including Borland JBuilder, IBM Visual Age for Java, SQL/J,
  46. JBoss, Weblogic, IBM WebSphere, Cocobase, ObjectRelationalBridge, etc.
  47.  
  48. USAGE AND INSTALLATION
  49.  
  50. MySQL Connector/J is distributed as a .zip or .tar.gz archive containing 
  51. the sources and class files as well as a class-file only "binary" .jar 
  52. archive named "mysql-connector-java-3.0.7-stable-bin.jar".
  53.  
  54. You will need to use the appropriate gui or command-line utility to un-archive 
  55. the distribution (for example, WinZip for the .zip archive, and "tar" for 
  56. the .tar.gz archive).
  57.  
  58. Once you have un-archived the distribution archive,
  59. you can install the driver in one of two ways:
  60.  
  61. Either copy the "com" and "org" subdirectories and all of their contents
  62. to anywhere you like, and put the directory holding the "com" and "org"
  63. subdirectories in your classpath, or...
  64.  
  65. Put mysql-connector-java-3.0.7-stable-bin.jar in your classpath, either by adding the 
  66. FULL path to it to your CLASSPATH enviornment variable, or putting it
  67. in $JAVA_HOME/jre/lib/ext.
  68.  
  69. If you are using a servlet engine or application server, you will have
  70. to read your vendor's documentation for more information on how to
  71. configure third-party class libraries, as most application servers
  72. ignore the CLASSPATH environment variable. If you are developing
  73. servlets and/or JSPs, and your application server is J2EE-compliant, 
  74. you should put the driver's .jar file in the WEB-INF/lib subdirectory
  75. of your webapp, as this is the standard location for third party 
  76. class libraries in J2EE web applications. You can also use the
  77. MysqlDataSource, MysqlConnectionPoolDataSource or MysqlXADataSource 
  78. classes in the com.mysql.jdbc.jdbc2.optional package, if your J2EE 
  79. application server supports/requires them. MysqlDataSource supports the 
  80. following parameters (through standard "set" mutators):
  81.  
  82.     user
  83.     password
  84.     serverName (see the next section about fail-over hosts)
  85.     databaseName
  86.     port
  87.  
  88. If you are going to use the driver with the JDBC DriverManager, you would use
  89. "com.mysql.jdbc.Driver" as the class that implements java.sql.Driver.
  90.  
  91. You might use this name in a Class.forName() call to load the driver:
  92.  
  93.     Class.forName("com.mysql.jdbc.Driver").newInstance();
  94.  
  95. To connect to the database, you need to use a JDBC url with the following 
  96. format ([xxx] denotes optional url components):
  97.  
  98.   jdbc:mysql://[hostname][,failoverhost...][:port]/[dbname][?param1=value1][¶m2=value2].....
  99.  
  100. The driver now has fail-over support. This allows the driver to fail-over to any number
  101. of "slave" hosts and still perform read-only queries. Fail-over only happens when the
  102. connection is in a autoCommit(true) state, because fail-over can not happen reliably
  103. when a transaction is in progress. Most good application servers and connection pools
  104. set autoCommit to 'true' at the end of every transaction/connection use.
  105.  
  106. The fail-over functionality has the following behavior:
  107.  
  108. If the URL parameter "autoReconnect" is false:
  109.     
  110.     Failover only happens at connection initialization, and failback occurs 
  111.     when the driver determines that the first host has become available again
  112.     
  113. If the URL parameter "autoReconnect" is true:
  114.  
  115.     Failover happens when the driver determines that the connection has failed
  116.     (before _every_ query), and falls back to the first host when it determines
  117.     that the host has become available again (after queriesBeforeRetryMaster 
  118.     queries have been issued).
  119.     
  120. In either case, whenever you are connected to a "failed-over" server, the connection
  121. will be set to read-only status, so queries that would modify data will have exceptions
  122. thrown (the query will _never_ be seen by the MySQL server).
  123.  
  124. Connector/J supports access to MySQL via named pipes on Windows NT/2000/XP using the
  125. 'NamedPipeSocketFactory' as a plugin-socket factory via the 'socketFactory' property.
  126. If you don't use a 'namedPipePath' property, the default of '\\.\pipe\MySQL' will be 
  127. used. 
  128.  
  129. If you use the NamedPipeSocketFactory, the hostname and port number values in the
  130. JDBC url will be ignored.
  131.  
  132. Adding the following parameter to your URL will enable the NamedPipeSocketFactory:
  133.  
  134. socketFactory=com.mysql.jdbc.NamedPipeSocketFactory
  135.  
  136. Named pipes only work when connecting to a MySQL server on the same physical machine 
  137. as the one the JDBC driver is being used on. 
  138.  
  139. In simple performance tests, it appears that named pipe access is between 30%-50% 
  140. faster than the standard TCP/IP access.
  141.  
  142. You can create your own socket factories by following the example code in 
  143. NamedPipeSocketFactory, or StandardSocketFactory.
  144.  
  145. URL Parameters (can be passed as properties in 
  146. DriverManager.getConnection() as well):
  147.  
  148. ==============================================================================
  149. Name                | Use                                       | Default 
  150. ==============================================================================
  151. user                | The user to connect as                    | none 
  152. --------------------+-------------------------------------------+-------------
  153. password            | The password to use when connecting       | none 
  154. --------------------+-------------------------------------------+-------------
  155. autoReconnect       | should the driver attempt to              | false
  156.                     | re-connect if the connection dies?        |
  157.                     | (true/false)                              |         
  158. --------------------+-------------------------------------------+-------------
  159. maxReconnects       | if autoReconnect is enabled, how many     | 3
  160.                     | times should the driver attempt to        |
  161.                     | reconnect?                                |
  162. --------------------+-------------------------------------------+-------------
  163. initialTimeout      | if autoReconnect is enabled, the          | 2
  164.                     | initial time to wait between              |
  165.                     | re-connect attempts (seconds)             |
  166. --------------------+-------------------------------------------+-------------
  167. queriesBeforeRetry  | Specifies how many queries to issue when  | 50
  168. Master              | failed over before attempting to          |
  169.                     | reconnect to the master                   |
  170. --------------------+-------------------------------------------+-------------
  171. maxRows             | The maximum number of rows to return      | 0
  172.                     | (0 means return all rows)                 |
  173. --------------------+-------------------------------------------+-------------
  174. useUnicode          | should the driver use Unicode character   | true 
  175.                     | encodings when handling                   | 
  176.                     | strings? If not used with                 |
  177.                     | characterEncoding, the driver will        |
  178.                     | attempt to determine the character set    |
  179.                     | in use on the server, and adjust          |
  180.                     | accordingly (true/false)                  |
  181.                     |                                           |
  182.                     | See the CHARACTER SETS section for more   |
  183.                     | information.                              |     
  184. --------------------+-------------------------------------------+-------------            
  185. characterEncoding   | if useUnicode is true, what character     | none
  186.                     | encoding should the driver use when       |
  187.                     | dealing with strings?                     | 
  188.                     |                                           |
  189.                     | See the CHARACTER SETS section for more   |
  190.                     | information.                              |                 
  191. --------------------+-------------------------------------------+-------------
  192. relaxAutoCommit        | if the version of MySQL the driver        | false
  193.                     | connects to does not support              |
  194.                     | transactions, allow calls to commit,      |
  195.                     | rollback and setAutoCommit? (true/false)    |
  196. --------------------+-------------------------------------------+-------------
  197. ignoreNonTxTables   | Should the driver not throw an exception  | false
  198.                     | when calling rollback() on non-tx-tables? |
  199.                     | Use this when mixing non-tx and tx-tables |
  200.                     | and you are sure you want the behavior.   | 
  201.                     | (true/false)                              |
  202. --------------------+-------------------------------------------+-------------
  203. ultraDevHack        | Create PreparedStatements for             | false
  204.                     | prepareCall(), because UltraDev           |
  205.                     | is broken? (true/false)                   |
  206. --------------------+-------------------------------------------+-------------            
  207. capitalizeTypeNames | Capitalize type names in                  | false
  208.                     | DatabaseMetaData? (usually only           |
  209.                     | usefull when using WebObjects)            |
  210. --------------------+-------------------------------------------+-------------
  211. profileSql          | Dump queries and execution/fetch times    | false
  212.                     | to STDERR. Useful for optimizing queries  |
  213.                     | that are auto-generated as in CMP EJBs    |   
  214.                     | (true/false)                              |
  215. --------------------+-------------------------------------------+-------------
  216. connectTimeout      | Timeout for socket connect (in            | 0
  217.                     | milliseconds), with 0 being no timeout.   |
  218.                     | Only works on JDK-1.4 or newer. Defaults  |
  219.                     | to '0'.                                   |
  220. --------------------+-------------------------------------------+-------------
  221. socketTimeout       | When set to something other than '0', the | 0
  222.                     | driver will throw a SQLException when     |   
  223.                     | this timeout (in ms) has expired, and     |
  224.                     | invalidate (close) the connection.        |
  225.                     | The SQLState when this happens will be    |
  226.                     | "08S01", just as when communication fails |
  227.                     | for other reasons.                        |
  228.                     |                                           |
  229.                     | Your application should have code to      |
  230.                     | recover from this event (by creating a    |
  231.                     | new connection, for example)              |
  232. --------------------+-------------------------------------------+-------------
  233. paranoid            | Don't show "sensitive" information in     | false
  234.                     | exceptions and error messages, and clear  |
  235.                     | "sensitive" information from internal     |   
  236.                     | data structures when possible             | 
  237.                     | (true/false)                              |
  238. --------------------+-------------------------------------------+-------------
  239. useHostsInPrivileges| Add '@hostname' to users in               | true 
  240.                     | DatabaseMetaData.getColumn/               |
  241.                     | TablePrivileges()                         |
  242. --------------------+-------------------------------------------+-------------
  243. useTimezone         | Convert time/date values between server   | false 
  244.                     | and client timezones?                     |
  245. --------------------+-------------------------------------------+-------------
  246. serverTimezone      | Use when there is no mapping between your | null 
  247.                     | server timezone and Java timezone. Must   |
  248.                     | use timezone ID supported by your JVM.    |
  249. --------------------+-------------------------------------------+-------------
  250. useSSL              | Should Connector/J use SSL when           | false 
  251.                     | communicating with the server, if the     |
  252.                     | server supports it? (see the SSL SUPPORT  |
  253.                     | section of this document for important    |
  254.                     | information for making this work.         |
  255. --------------------+-------------------------------------------+-------------
  256. useStreamLengthsIn\ | Should Connector/J honor stream lengths   | true
  257. PrepStmts           | when calling PreparedStatement            |
  258.                     | setBinary/AsciiStream() and ResultSet     |
  259.                     | updateBinary/AsciiStream() ?   (note: the |
  260.                     | parameter name is one word with no '\')   |
  261. --------------------+-------------------------------------------+-------------
  262. continueBatchOnError| Should Connector/J continue processing    | true
  263.                     | batch commands if one statement fails?    |
  264.                     |                                           |
  265.                     | The JDBC spec allows either way.          |
  266. --------------------+-------------------------------------------+-------------
  267. allowLoadLocalInfile| Should Connector/J allow/support 'LOAD    | true
  268.                     | DATA LOCAL INFILE' queries (your server   |
  269.                     | must also allow these types of queries)   |
  270. --------------------+-------------------------------------------+-------------
  271. socketFactory       | The name of the class that the driver     | com.mysql.\
  272.                     | should use for creating socket            | jdbc.\
  273.                     | connections to the server. This class     | Standard\
  274.                     | must implement the interface              | Socket\
  275.                     | 'com.mysql.jdbc.SocketFactory' and have   | Factory
  276.                     | a public no-args constructor.             |
  277. --------------------+-------------------------------------------+-------------
  278. strictUpdates       | Should the driver ensure that all primary | true
  279.                     | keys of a given table are selected before |
  280.                     | allowing the result set to be made        |
  281.                     | updatable? (required by JDBC spec,        |
  282.                     | defaults to 'true').                      |
  283. ------------------------------------------------------------------------------
  284.                   
  285. A simple connection example looks like:
  286.  
  287.     Class.forName("com.mysql.jdbc.Driver").newInstance();
  288.     
  289.     java.sql.Connection conn;
  290.     
  291.     conn = DriverManager.getConnection(
  292.         "jdbc:mysql://localhost/test?user=blah&password=blah");
  293.     
  294. If you need further JDBC tutorial information, please see
  295. http://www.java.sun.com/products/jdbc/
  296.  
  297. The driver supports batch updates for Statements and PreparedStatements.
  298. Batch updates will be processed in entirety, if any of the updates raise a
  299. SQLException, a java.sql.BatchUpdateException will be thrown after all updates
  300. have been processed, with update count values of '-3' for any statements that
  301. were not completed (see section 6.1 in the JDBC-2.1 API spec for more details).
  302.  
  303. Various DataSource implementations exist, all under the 
  304. com.mysql.jdbc.jdbc2.optional package. They are "MysqlDataSource",
  305. and "MysqlConnectionPoolDataSource". Refer to your 
  306. application server documentation for information on how to use these classes.
  307. An example of using the standard DataSource ("MysqlDataSource") can be found
  308. in the "testsuite" directory.
  309.  
  310. If you need to "stream" result sets, row-by-row, the driver
  311. now supports this. What you need to do is create a statement in the
  312. following manner:
  313.  
  314.   stmt = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, 
  315.                             java.sql.ResultSet.CONCUR_READ_ONLY);
  316.                             
  317.   stmt.setFetchSize(Integer.MIN_VALUE);
  318.   
  319. This serves as a signal to the driver to "stream" result sets
  320. row-by-row. After this any result sets created with the statement
  321. will be retrieved row-by-row.
  322.  
  323. There are some caveats with this approach. You will have
  324. to read all of the rows in the result set (or close it)
  325. before you can issue any other queries on the connection,
  326. or an exception will be thrown. Some of the positioning methods
  327. will not work as well, especially ones that require 'knowledge'
  328. of the entire result set, like isBeforeFirst(), isAfterLast()
  329. (when the result set is empty), absolute(), relative(), isLast()
  330. (call .next() and check for a 'false' return value instead). This
  331. is because the driver does not know how many rows are going to be
  332. returned.
  333.  
  334. This version of the driver also supports large packet sizes
  335. (up to the limits of your server) when you're using MySQL-4.0
  336. or newer. Your JVM will need to be able to allocate enough
  337. memory to store the entire large packet, as well as an overhead
  338. of 16 megabytes or so. Usually, you can control this by passing
  339. the "-XmxNNNm" flag to your JVM, where NNN is the number of 
  340. megabytes of memory that the JVM should be allowed to allocate.
  341.  
  342. CHARACTER SETS
  343.  
  344. MySQL Connector/J now handles character sets in a more transparent way
  345. than MM.MySQL did. The driver attempts to determine the character
  346. set of the MySQL server you are connecting to, and map it to the
  347. Java character set that is appropriate. This mapping is kept up to
  348. date with new server releases. In almost all cases you will not
  349. need to set the "useUnicode" or "characterEncoding" parameters,
  350. as the driver will do this for you. Because of this the "useUnicode"
  351. parameter has the default value of "true". If you need to force
  352. the old behavior of the driver, you need to add "useUnicode=false"
  353. to your URL.
  354.  
  355. For single-byte character sets, the driver uses an optimized 
  356. character translation scheme that yields performance that is as
  357. good or better than MM.MySQL or the first 3.0 version of 
  358. MySQL Connector/J. Multi-byte character sets use your JVM's built
  359. in character translation support, and on average this is 5-10%
  360. slower than single-byte character support.
  361.  
  362. If you have a character set that was not created by MySQL AB, a
  363. driver version older than the version of MySQL server you are using,
  364. or for some reason can not get the mapping to work, you can force
  365. the character set using the "useUnicode=true" and 
  366. "characterEncoding=some_charset" parameters in your URL to tell
  367. the driver which character set to use, where "some_charset" is
  368. a character set that your JVM supports.
  369.  
  370. You can also store UTF-8 encoded data in MySQL server versions 
  371. prior to 4.1 by using 'useUnicode=true&characterEncoding=UTF8' 
  372. as parameters in your JDBC URL. You might encounter wierd collation
  373. results (sorting/comparing) because UTF-8 encompasses all Unicode
  374. character sets, so this is best used when you sort/search on
  375. keys in a normal (latin1) character set.
  376.  
  377. SSL SUPPORT
  378.  
  379. SSL in MySQL Connector/J encrypts all data (other than the initial
  380. handshake) between the JDBC driver and the server. The performance 
  381. penalty for enabling SSL is an increase in query  processing time 
  382. between 35% and 50%, depending on the size of the query, and the 
  383. amount of data it returns.
  384.  
  385. For SSL Support to work, you must have the following:
  386.  
  387.  * A JDK that includes JSSE (Java Secure Sockets Extension), 
  388.    like JDK-1.4.1 or newer, or a JDK that you can add JSSE
  389.    to, like JDK-1.2.x or JDK-1.3.x by following the instructions
  390.    at http://java.sun.com/products/jsse/index-103.html
  391.    
  392.  * A MySQL server that supports SSL and has been compiled 
  393.    and configured to do so, which is MySQL-4.0.4 or later,
  394.    see:
  395.    
  396.    http://www.mysql.com/doc/en/Secure_connections.html
  397.    
  398.  * A client certificate (covered later in this section)
  399.  
  400.  You will first need to import the MySQL server CA Certificate into
  401.  a Java truststore. A sample MySQL server CA Certificate is located
  402.  in the 'SSL' subdirectory of the MySQL source distribution. This is 
  403.  what SSL will use to determine if you are communicating with a secure
  404.  MySQL server.
  405.  
  406.  To use Java's 'keytool' to create a truststore in the current directory
  407.  , and import the server's CA certificate ('cacert.pem'), you can do the 
  408.  following (assuming that'keytool' is in your path. It's located in the 
  409.  'bin' subdirectory of your JDK or JRE):
  410.  
  411. shell> keytool -import -alias mysqlServerCACert -file cacert.pem \
  412.         -keystore truststore
  413.         
  414. Keytool will respond with the following information:
  415.  
  416. ------------------------------------------------------
  417. Enter keystore password:  *********
  418. Owner: EMAILADDRESS=walrus@mysql.com, CN=Walrus, O=MySQL AB, L=Orenburg, ST=Some
  419. -State, C=RU
  420. Issuer: EMAILADDRESS=walrus@mysql.com, CN=Walrus, O=MySQL AB, L=Orenburg, ST=Som
  421. e-State, C=RU
  422. Serial number: 0
  423. Valid from: Fri Aug 02 16:55:53 CDT 2002 until: Sat Aug 02 16:55:53 CDT 2003
  424. Certificate fingerprints:
  425.          MD5:  61:91:A0:F2:03:07:61:7A:81:38:66:DA:19:C4:8D:AB
  426.          SHA1: 25:77:41:05:D5:AD:99:8C:14:8C:CA:68:9C:2F:B8:89:C3:34:4D:6C
  427. Trust this certificate? [no]:  yes
  428. Certificate was added to keystore
  429. ------------------------------------------------------
  430.         
  431. You will then need to generate a client certificate, so that the MySQL 
  432. server knows that it is talking to a secure client:
  433.  
  434. shell> keytool -genkey -keyalg rsa -alias mysqlClientCertificate \
  435.       -keystore keystore
  436.  
  437. Keytool will prompt you for the following information, and create a keystore
  438. named 'keystore' in the current directory. You should respond with 
  439. information that is appropriate for your situation:
  440.  
  441. ------------------------------------------------------
  442. Enter keystore password:  *********
  443. What is your first and last name?
  444.   [Unknown]:  Matthews
  445. What is the name of your organizational unit?
  446.   [Unknown]:  Software Development
  447. What is the name of your organization?
  448.   [Unknown]:  MySQL AB
  449. What is the name of your City or Locality?
  450.   [Unknown]:  Flossmoor
  451. What is the name of your State or Province?
  452.   [Unknown]:  IL
  453. What is the two-letter country code for this unit?
  454.   [Unknown]:  US
  455. Is <CN=Matthews, OU=Software Development, O=MySQL AB,
  456.  L=Flossmoor, ST=IL, C=US> correct?
  457.   [no]:  y
  458.  
  459. Enter key password for <mysqlClientCertificate>
  460.         (RETURN if same as keystore password):
  461. ------------------------------------------------------
  462.  
  463. Finally, to get JSSE to use the keystore and truststore that you
  464. have generated, you need to set the following system properties
  465. when you start your JVM, replacing 'path_to_keystore_file' with
  466. the full path to the keystore file you created, 
  467. 'path_to_truststore_file' with the path to the truststore file
  468. you created, and using the appropriate password values for each
  469. property.
  470.  
  471.  -Djavax.net.ssl.keyStore=path_to_keystore_file
  472.  -Djavax.net.ssl.keyStorePassword=********* 
  473.  -Djavax.net.ssl.trustStore=path_to_truststore_file 
  474.  -Djavax.net.ssl.trustStorePassword=********* 
  475.  
  476. You will also need to set 'useSSL' to 'true' in your connection
  477. parameters for MySQL Connector/J, either by adding 'useSSL=true'
  478. to your URL, or by setting the property 'useSSL' to 'true' in 
  479. the java.util.Properties instance you pass to 
  480. DriverManager.getConnection().
  481.  
  482. Testing the SSL Layer:
  483.  
  484. You can test that SSL is working by turning on JSSE debugging 
  485. (as detailed below), and look for the following key events:
  486.  
  487. ------------------------------------------------------
  488.  ...
  489.  *** ClientHello, v3.1
  490.  RandomCookie:  GMT: 1018531834 bytes = { 199, 148, 180, 215, 74, 12, 54, 244, 0, 168, 55, 103, 215, 64, 16, 138, 225, 190, 132, 153, 2, 217, 219, 239, 202, 19, 121, 78 }
  491.  Session ID:  {}
  492.  Cipher Suites:  { 0, 5, 0, 4, 0, 9, 0, 10, 0, 18, 0, 19, 0, 3, 0, 17 }
  493.  Compression Methods:  { 0 }
  494.  ***
  495.  [write] MD5 and SHA1 hashes:  len = 59
  496.  0000: 01 00 00 37 03 01 3D B6   90 FA C7 94 B4 D7 4A 0C  ...7..=.......J.
  497.  0010: 36 F4 00 A8 37 67 D7 40   10 8A E1 BE 84 99 02 D9  6...7g.@........
  498.  0020: DB EF CA 13 79 4E 00 00   10 00 05 00 04 00 09 00  ....yN..........
  499.  0030: 0A 00 12 00 13 00 03 00   11 01 00                 ...........
  500.  main, WRITE:  SSL v3.1 Handshake, length = 59
  501.  main, READ:  SSL v3.1 Handshake, length = 74
  502.  *** ServerHello, v3.1
  503.  RandomCookie:  GMT: 1018577560 bytes = { 116, 50, 4, 103, 25, 100, 58, 202, 79, 185, 178, 100, 215, 66, 254, 21, 83, 187, 190, 42, 170, 3, 132, 110, 82, 148, 160, 92 }
  504.  Session ID:  {163, 227, 84, 53, 81, 127, 252, 254, 178, 179, 68, 63, 182, 158, 30, 11, 150, 79, 170, 76, 255, 92, 15, 226, 24, 17, 177, 219, 158, 177, 187, 143}
  505.  Cipher Suite:  { 0, 5 }
  506.  Compression Method: 0
  507.  ***
  508.  %% Created:  [Session-1, SSL_RSA_WITH_RC4_128_SHA]
  509.  ** SSL_RSA_WITH_RC4_128_SHA
  510.  [read] MD5 and SHA1 hashes:  len = 74
  511.  0000: 02 00 00 46 03 01 3D B6   43 98 74 32 04 67 19 64  ...F..=.C.t2.g.d
  512.  0010: 3A CA 4F B9 B2 64 D7 42   FE 15 53 BB BE 2A AA 03  :.O..d.B..S..*..
  513.  0020: 84 6E 52 94 A0 5C 20 A3   E3 54 35 51 7F FC FE B2  .nR..\ ..T5Q....
  514.  0030: B3 44 3F B6 9E 1E 0B 96   4F AA 4C FF 5C 0F E2 18  .D?.....O.L.\...
  515.  0040: 11 B1 DB 9E B1 BB 8F 00   05 00                    ..........
  516.  main, READ:  SSL v3.1 Handshake, length = 1712
  517.  ...
  518. ------------------------------------------------------
  519.  
  520. Debugging the SSL Layer:
  521.  
  522.  JSSE provides debugging (to STDOUT) when you set the following system property:
  523.  
  524.      -Djavax.net.debug=all
  525.      
  526.  This will tell you what keystores and truststores are being used, as well as
  527.  what is going on during the SSL handshake and certificate exchange. It will be
  528.  helpful when trying to determine what is not working when trying to get an
  529.  SSL connection to happen.
  530.  
  531.  
  532.  
  533. TROUBLESHOOTING
  534.  
  535. There are a few issues that seem to be encountered often by users of 
  536. MySQL Connector/J. 
  537.  
  538. This section deals with their symptoms, and their resolutions. If you have
  539. further issues, see the "SUPPORT" section below.
  540.  
  541.   Issue: 
  542.  
  543.   "When I try to connect to the database with MySQL Connector/J, I get the
  544.   following exception:
  545.  
  546.   SQLException: Server configuration denies access to data source
  547.   SQLState: 08001
  548.   VendorError: 0
  549.  
  550.   What's going on? I can connect with the MySQL client."
  551.  
  552.   Resolution: 
  553.  
  554.   MySQL Connector/J must use TCP/IP sockets to connect to MySQL, as 
  555.   Java does not support Unix Domain Sockets. Therefore, when MySQL Connector/J
  556.   connects to MySQL, the security manager in MySQL server will use the
  557.   HOSTS table to determine whether or not the connection should be allowed.
  558.  
  559.   You must add grants to allow this to happen. The following is an example
  560.   of how to do this (but not the most secure).
  561.  
  562.   From the mysql command-line client, issue the following command
  563.  
  564.   "GRANT ALL PRIVILEGES ON [dbname].* to '[user]'@'[hostname]' identified by 
  565.   '[password]'"
  566.  
  567.   replacing [dbname] with the name of your database, [user] with the username,
  568.   [hostname] with the host that MySQL Connector/J will be connecting from, and 
  569.   [password] with the password you want to use. Be aware that RedHat linux is 
  570.   broken with respect to the hostname portion for the case when you are 
  571.   connecting from localhost. You need to use "localhost.localdomain" for the 
  572.   [hostname] value in this case.
  573.  
  574.   Follow this by issuing the "FLUSH PRIVILEGES" command.
  575.   
  576.   NOTE:
  577.   
  578.   Testing your connectivity with the "mysql" command-line client will not
  579.   work unless you add the "--host" flag, and use something other than 
  580.   "localhost" for the host. The "mysql" command-line client will use Unix
  581.   domain sockets if you use the special hostname "localhost". If you are
  582.   testing connectivity to "localhost", use "127.0.0.1" as the hostname
  583.   instead.
  584.  
  585.   I suggest you read the permissions/security section of your MySQL server 
  586.   manual for a much more detailed explanation of how this works.
  587.   
  588.   ----
  589.  
  590.   Issue: 
  591.  
  592.   "My application throws a SQLException 'No Suitable Driver'".
  593.  
  594.   Resolution: 
  595.  
  596.   One of two things are happening. Either the driver is not in
  597.   your CLASSPATH (see the "USAGE AND INSTALLATION" section above), or your
  598.   URL format is incoorect (once again see "USAGE AND INSTALLATION").
  599.  
  600.   ----
  601.  
  602.   Issue: 
  603.  
  604.   "I'm trying to use MySQL Connector/J in an applet or application and I 
  605.   get an exception similar to: 
  606.   
  607.   SQLException: Cannot connect to MySQL server on host:3306. Is there 
  608.   a MySQL server running on the machine/port you are trying to connect to? 
  609.   (java.security.AccessControlException) 
  610.   SQLState:     08S01 
  611.   VendorError:  0 
  612.   
  613.   What's wrong?"
  614.  
  615.   Resolution:
  616.   
  617.   Either you're running an Applet, your MySQL server has been installed
  618.   with the "--skip-networking" option set, or your MySQL server has a 
  619.   firewall sitting in front of it.
  620.   
  621.   Applets can only make network connections back to the machine that the
  622.   webserver that served the .class files for the applet. This means that
  623.   mysql must run on the same machine (or you must have some sort of port
  624.   re-direction) for this to work. This also means that you will not be
  625.   able to test applets from your local filesystem, you must always deploy
  626.   them to a webserver.
  627.   
  628.   MySQL Connector/J can only communicate with MySQL using TCP/IP, as
  629.   Java does not support Unix domain sockets. TCP/IP communication with
  630.   MySQL might be affected if MySQL was started with the
  631.   "--skip-networking" flag, or if it is firewalled.
  632.   
  633.   If MySQL has been started with the "--skip-networking" option set 
  634.   (The Debian Linux install does this for example), you need to comment
  635.   it out in the file /etc/mysql/my.cnf or /etc/my.cnf. Of course your
  636.   my.cnf file might also exist in the "data" directory of your MySQL
  637.   server, or anywhere else (depending on how MySQL was compiled for 
  638.   your system). Binaries created by MySQL AB always look in /etc/my.cnf
  639.   and [datadir]/my.cnf.
  640.   
  641.   If your MySQL server has been firewalled, you will need to have the
  642.   firewall configured to allow TCP/IP connections from the host where
  643.   your Java code is running to the MySQL server on the port that MySQL
  644.   is listening (by default, 3306).
  645.   
  646.  
  647.   ----
  648.  
  649.   Issue: 
  650.  
  651.   "I have a servlet/application that works fine for a day, and then stops 
  652.   working overnight".
  653.  
  654.   Resolution: 
  655.  
  656.   MySQL closes connections after 8 hours of inactivity. You either
  657.   need to use a connection pool that handles stale connections or use the 
  658.   "autoReconnect" parameter (see "USAGE AND INSTALLATION"). Also, you should
  659.   be catching SQLExceptions in your application and dealing with them, rather
  660.   than propagating them all the way until your application exits, this is just
  661.   good software development. MySQL Connector/J will set the SQLState (see 
  662.   java.sql.SQLException.getSQLState() in your APIDOCS) to "08S01" when it 
  663.   encounters network-connectivity issues during the processing of a query. 
  664.   Your application code should then attempt to re-connect to MySQL at this 
  665.   point.
  666.  
  667.   ----
  668.  
  669.   Issue:
  670.  
  671.   "I'm trying to use JDBC-2.0 updatable result sets, and I get an exception
  672.   saying my result set is not updatable..."
  673.  
  674.   Resolution:
  675.  
  676.   Because MySQL does not have row identifiers, MySQL Connector/J can only update
  677.   result sets that have come from queries that select the primary key(s) and
  678.   only span one table (i.e. no joins). This is outlined in the JDBC specification.
  679.  
  680.  
  681. KNOWN BUGS
  682.  
  683. There are some parts of the JDBC-3.0 spec that are not implemented (mostly 
  684. because they can't be until MySQL supports the underlying features required
  685. to implement them). 
  686.  
  687. The following methods are not implemented:
  688.  
  689.     Blob.truncate()
  690.  
  691.     Connection.setSavePoint()
  692.     Connection.setTypeMap(Map)
  693.     Connection.getTypeMap()
  694.     Connection.prepareCall(String)
  695.     Connection.releaseSavepoint(Savepoint)
  696.     Connection.rollback(Savepoint)
  697.  
  698.     PreparedStatement.setArray(int, Array)
  699.     PreparedStatement.getMetaData()
  700.     PreparedStatement.setRef()
  701.     PreparedStatement.getParameterMetaData()
  702.  
  703.     ResultSet.getArray(int)
  704.     ResultSet.getArray(colName)
  705.     ResultSet.getObject(int, Map)
  706.     ResultSet.getObject(String, Map)
  707.     ResultSet.getRef(int)
  708.     ResultSet.getRef(String)
  709.     ResultSet.rowDeleted()
  710.     ResultSet.rowInserted()
  711.     ResultSet.rowUpdated()
  712.     ResultSet.updateArray(int, Array)
  713.     ResultSet.updateArray(String, Array)
  714.     ResultSet.updateRef(int, Ref)
  715.     ResultSet.updateRef(String, Ref)
  716.  
  717. If you see something that is not implemented, and you have an idea on how to
  718. do it, go ahead and let me know. I'm always looking for help and/or feedback
  719. about the driver.
  720.  
  721.  
  722. SUPPORT
  723.  
  724. Community-based support is available on the mysql-java mailing list 
  725. available from http://www.mysql.com/documentation/lists.html 
  726.  
  727. MySQL-AB offers commercial support, and non-GPL commercial licenses for
  728. this software. Contact me <mark@mysql.com> or <sales@mysql.com> for more 
  729. information.
  730.  
  731. --
  732. This software is OSI Certified Open Source Software.
  733. OSI Certified is a certification mark of the Open Source Initiative.
  734.  
  735. --
  736.  
  737.