PageRenderTime 125ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 1ms

/EQEmuJSM/mysql-connector-java-5.1.13/src/com/mysql/jdbc/ConnectionPropertiesImpl.java

http://cubbers-eqemu-utils.googlecode.com/
Java | 1604 lines | 1181 code | 280 blank | 143 comment | 56 complexity | 326cd2829011b2bbeecef7a20ed7d8fc MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, Apache-2.0

Large files files are truncated, but you can click here to view the full file

  1. /*
  2. Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
  3. The MySQL Connector/J is licensed under the terms of the GPL,
  4. like most MySQL Connectors. There are special exceptions to the
  5. terms and conditions of the GPL as it is applied to this software,
  6. see the FLOSS License Exception available on mysql.com.
  7. This program is free software; you can redistribute it and/or
  8. modify it under the terms of the GNU General Public License as
  9. published by the Free Software Foundation; version 2 of the
  10. License.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15. You should have received a copy of the GNU General Public License
  16. along with this program; if not, write to the Free Software
  17. Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
  18. 02110-1301 USA
  19. */
  20. package com.mysql.jdbc;
  21. import java.io.Serializable;
  22. import java.io.UnsupportedEncodingException;
  23. import java.sql.DriverPropertyInfo;
  24. import java.sql.SQLException;
  25. import java.util.ArrayList;
  26. import java.util.HashMap;
  27. import java.util.Iterator;
  28. import java.util.Map;
  29. import java.util.Properties;
  30. import java.util.TreeMap;
  31. import javax.naming.RefAddr;
  32. import javax.naming.Reference;
  33. import javax.naming.StringRefAddr;
  34. import com.mysql.jdbc.log.Log;
  35. import com.mysql.jdbc.log.StandardLogger;
  36. /**
  37. * Represents configurable properties for Connections and DataSources. Can also
  38. * expose properties as JDBC DriverPropertyInfo if required as well.
  39. *
  40. * @author Mark Matthews
  41. * @version $Id: ConnectionProperties.java,v 1.1.2.2 2005/05/17 14:58:56
  42. * mmatthews Exp $
  43. */
  44. public class ConnectionPropertiesImpl implements Serializable, ConnectionProperties {
  45. private static final long serialVersionUID = 4257801713007640580L;
  46. class BooleanConnectionProperty extends ConnectionProperty implements Serializable {
  47. private static final long serialVersionUID = 2540132501709159404L;
  48. /**
  49. * DOCUMENT ME!
  50. *
  51. * @param propertyNameToSet
  52. * @param defaultValueToSet
  53. * @param descriptionToSet
  54. * DOCUMENT ME!
  55. * @param sinceVersionToSet
  56. * DOCUMENT ME!
  57. */
  58. BooleanConnectionProperty(String propertyNameToSet,
  59. boolean defaultValueToSet, String descriptionToSet,
  60. String sinceVersionToSet, String category, int orderInCategory) {
  61. super(propertyNameToSet, Boolean.valueOf(defaultValueToSet), null, 0,
  62. 0, descriptionToSet, sinceVersionToSet, category,
  63. orderInCategory);
  64. }
  65. /**
  66. * @see com.mysql.jdbc.ConnectionPropertiesImpl.ConnectionProperty#getAllowableValues()
  67. */
  68. String[] getAllowableValues() {
  69. return new String[] { "true", "false", "yes", "no" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
  70. }
  71. boolean getValueAsBoolean() {
  72. return ((Boolean) this.valueAsObject).booleanValue();
  73. }
  74. /**
  75. * @see com.mysql.jdbc.ConnectionPropertiesImpl.ConnectionProperty#hasValueConstraints()
  76. */
  77. boolean hasValueConstraints() {
  78. return true;
  79. }
  80. /**
  81. * @see com.mysql.jdbc.ConnectionPropertiesImpl.ConnectionProperty#initializeFrom(java.util.Properties)
  82. */
  83. void initializeFrom(String extractedValue) throws SQLException {
  84. if (extractedValue != null) {
  85. validateStringValues(extractedValue);
  86. this.valueAsObject = Boolean.valueOf(extractedValue
  87. .equalsIgnoreCase("TRUE") //$NON-NLS-1$
  88. || extractedValue.equalsIgnoreCase("YES")); //$NON-NLS-1$
  89. } else {
  90. this.valueAsObject = this.defaultValue;
  91. }
  92. }
  93. /**
  94. * @see com.mysql.jdbc.ConnectionPropertiesImpl.ConnectionProperty#isRangeBased()
  95. */
  96. boolean isRangeBased() {
  97. return false;
  98. }
  99. void setValue(boolean valueFlag) {
  100. this.valueAsObject = Boolean.valueOf(valueFlag);
  101. }
  102. }
  103. abstract class ConnectionProperty implements Serializable {
  104. String[] allowableValues;
  105. String categoryName;
  106. Object defaultValue;
  107. int lowerBound;
  108. int order;
  109. String propertyName;
  110. String sinceVersion;
  111. int upperBound;
  112. Object valueAsObject;
  113. boolean required;
  114. String description;
  115. public ConnectionProperty() {}
  116. ConnectionProperty(String propertyNameToSet, Object defaultValueToSet,
  117. String[] allowableValuesToSet, int lowerBoundToSet,
  118. int upperBoundToSet, String descriptionToSet,
  119. String sinceVersionToSet, String category, int orderInCategory) {
  120. this.description = descriptionToSet;
  121. this.propertyName = propertyNameToSet;
  122. this.defaultValue = defaultValueToSet;
  123. this.valueAsObject = defaultValueToSet;
  124. this.allowableValues = allowableValuesToSet;
  125. this.lowerBound = lowerBoundToSet;
  126. this.upperBound = upperBoundToSet;
  127. this.required = false;
  128. this.sinceVersion = sinceVersionToSet;
  129. this.categoryName = category;
  130. this.order = orderInCategory;
  131. }
  132. String[] getAllowableValues() {
  133. return this.allowableValues;
  134. }
  135. /**
  136. * @return Returns the categoryName.
  137. */
  138. String getCategoryName() {
  139. return this.categoryName;
  140. }
  141. Object getDefaultValue() {
  142. return this.defaultValue;
  143. }
  144. int getLowerBound() {
  145. return this.lowerBound;
  146. }
  147. /**
  148. * @return Returns the order.
  149. */
  150. int getOrder() {
  151. return this.order;
  152. }
  153. String getPropertyName() {
  154. return this.propertyName;
  155. }
  156. int getUpperBound() {
  157. return this.upperBound;
  158. }
  159. Object getValueAsObject() {
  160. return this.valueAsObject;
  161. }
  162. abstract boolean hasValueConstraints();
  163. void initializeFrom(Properties extractFrom) throws SQLException {
  164. String extractedValue = extractFrom.getProperty(getPropertyName());
  165. extractFrom.remove(getPropertyName());
  166. initializeFrom(extractedValue);
  167. }
  168. void initializeFrom(Reference ref) throws SQLException {
  169. RefAddr refAddr = ref.get(getPropertyName());
  170. if (refAddr != null) {
  171. String refContentAsString = (String) refAddr.getContent();
  172. initializeFrom(refContentAsString);
  173. }
  174. }
  175. abstract void initializeFrom(String extractedValue) throws SQLException;
  176. abstract boolean isRangeBased();
  177. /**
  178. * @param categoryName
  179. * The categoryName to set.
  180. */
  181. void setCategoryName(String categoryName) {
  182. this.categoryName = categoryName;
  183. }
  184. /**
  185. * @param order
  186. * The order to set.
  187. */
  188. void setOrder(int order) {
  189. this.order = order;
  190. }
  191. void setValueAsObject(Object obj) {
  192. this.valueAsObject = obj;
  193. }
  194. void storeTo(Reference ref) {
  195. if (getValueAsObject() != null) {
  196. ref.add(new StringRefAddr(getPropertyName(), getValueAsObject()
  197. .toString()));
  198. }
  199. }
  200. DriverPropertyInfo getAsDriverPropertyInfo() {
  201. DriverPropertyInfo dpi = new DriverPropertyInfo(this.propertyName, null);
  202. dpi.choices = getAllowableValues();
  203. dpi.value = (this.valueAsObject != null) ? this.valueAsObject.toString() : null;
  204. dpi.required = this.required;
  205. dpi.description = this.description;
  206. return dpi;
  207. }
  208. void validateStringValues(String valueToValidate) throws SQLException {
  209. String[] validateAgainst = getAllowableValues();
  210. if (valueToValidate == null) {
  211. return;
  212. }
  213. if ((validateAgainst == null) || (validateAgainst.length == 0)) {
  214. return;
  215. }
  216. for (int i = 0; i < validateAgainst.length; i++) {
  217. if ((validateAgainst[i] != null)
  218. && validateAgainst[i].equalsIgnoreCase(valueToValidate)) {
  219. return;
  220. }
  221. }
  222. StringBuffer errorMessageBuf = new StringBuffer();
  223. errorMessageBuf.append("The connection property '"); //$NON-NLS-1$
  224. errorMessageBuf.append(getPropertyName());
  225. errorMessageBuf.append("' only accepts values of the form: "); //$NON-NLS-1$
  226. if (validateAgainst.length != 0) {
  227. errorMessageBuf.append("'"); //$NON-NLS-1$
  228. errorMessageBuf.append(validateAgainst[0]);
  229. errorMessageBuf.append("'"); //$NON-NLS-1$
  230. for (int i = 1; i < (validateAgainst.length - 1); i++) {
  231. errorMessageBuf.append(", "); //$NON-NLS-1$
  232. errorMessageBuf.append("'"); //$NON-NLS-1$
  233. errorMessageBuf.append(validateAgainst[i]);
  234. errorMessageBuf.append("'"); //$NON-NLS-1$
  235. }
  236. errorMessageBuf.append(" or '"); //$NON-NLS-1$
  237. errorMessageBuf
  238. .append(validateAgainst[validateAgainst.length - 1]);
  239. errorMessageBuf.append("'"); //$NON-NLS-1$
  240. }
  241. errorMessageBuf.append(". The value '"); //$NON-NLS-1$
  242. errorMessageBuf.append(valueToValidate);
  243. errorMessageBuf.append("' is not in this set."); //$NON-NLS-1$
  244. throw SQLError.createSQLException(errorMessageBuf.toString(),
  245. SQLError.SQL_STATE_ILLEGAL_ARGUMENT, getExceptionInterceptor());
  246. }
  247. }
  248. class IntegerConnectionProperty extends ConnectionProperty implements Serializable {
  249. private static final long serialVersionUID = -3004305481796850832L;
  250. public IntegerConnectionProperty(String propertyNameToSet,
  251. Object defaultValueToSet, String[] allowableValuesToSet,
  252. int lowerBoundToSet, int upperBoundToSet,
  253. String descriptionToSet, String sinceVersionToSet,
  254. String category, int orderInCategory) {
  255. super(propertyNameToSet, defaultValueToSet, allowableValuesToSet,
  256. lowerBoundToSet, upperBoundToSet, descriptionToSet, sinceVersionToSet,
  257. category, orderInCategory);
  258. }
  259. int multiplier = 1;
  260. IntegerConnectionProperty(String propertyNameToSet,
  261. int defaultValueToSet, int lowerBoundToSet,
  262. int upperBoundToSet, String descriptionToSet,
  263. String sinceVersionToSet, String category, int orderInCategory) {
  264. super(propertyNameToSet, new Integer(defaultValueToSet), null,
  265. lowerBoundToSet, upperBoundToSet, descriptionToSet,
  266. sinceVersionToSet, category, orderInCategory);
  267. }
  268. /**
  269. * DOCUMENT ME!
  270. *
  271. * @param propertyNameToSet
  272. * @param defaultValueToSet
  273. * @param descriptionToSet
  274. * @param sinceVersionToSet
  275. * DOCUMENT ME!
  276. */
  277. IntegerConnectionProperty(String propertyNameToSet,
  278. int defaultValueToSet, String descriptionToSet,
  279. String sinceVersionToSet, String category, int orderInCategory) {
  280. this(propertyNameToSet, defaultValueToSet, 0, 0, descriptionToSet,
  281. sinceVersionToSet, category, orderInCategory);
  282. }
  283. /**
  284. * @see com.mysql.jdbc.ConnectionProperties.ConnectionProperty#getAllowableValues()
  285. */
  286. String[] getAllowableValues() {
  287. return null;
  288. }
  289. /**
  290. * @see com.mysql.jdbc.ConnectionProperties.ConnectionProperty#getLowerBound()
  291. */
  292. int getLowerBound() {
  293. return this.lowerBound;
  294. }
  295. /**
  296. * @see com.mysql.jdbc.ConnectionProperties.ConnectionProperty#getUpperBound()
  297. */
  298. int getUpperBound() {
  299. return this.upperBound;
  300. }
  301. int getValueAsInt() {
  302. return ((Integer) this.valueAsObject).intValue();
  303. }
  304. /**
  305. * @see com.mysql.jdbc.ConnectionProperties.ConnectionProperty#hasValueConstraints()
  306. */
  307. boolean hasValueConstraints() {
  308. return false;
  309. }
  310. /**
  311. * @see com.mysql.jdbc.ConnectionProperties.ConnectionProperty#initializeFrom(java.lang.String)
  312. */
  313. void initializeFrom(String extractedValue) throws SQLException {
  314. if (extractedValue != null) {
  315. try {
  316. // Parse decimals, too
  317. int intValue = Double.valueOf(extractedValue).intValue();
  318. /*
  319. * if (isRangeBased()) { if ((intValue < getLowerBound()) ||
  320. * (intValue > getUpperBound())) { throw new
  321. * SQLException("The connection property '" +
  322. * getPropertyName() + "' only accepts integer values in the
  323. * range of " + getLowerBound() + " - " + getUpperBound() + ",
  324. * the value '" + extractedValue + "' exceeds this range.",
  325. * SQLError.SQL_STATE_ILLEGAL_ARGUMENT); } }
  326. */
  327. this.valueAsObject = new Integer(intValue * multiplier);
  328. } catch (NumberFormatException nfe) {
  329. throw SQLError.createSQLException("The connection property '" //$NON-NLS-1$
  330. + getPropertyName()
  331. + "' only accepts integer values. The value '" //$NON-NLS-1$
  332. + extractedValue
  333. + "' can not be converted to an integer.", //$NON-NLS-1$
  334. SQLError.SQL_STATE_ILLEGAL_ARGUMENT, getExceptionInterceptor());
  335. }
  336. } else {
  337. this.valueAsObject = this.defaultValue;
  338. }
  339. }
  340. /**
  341. * @see com.mysql.jdbc.ConnectionProperties.ConnectionProperty#isRangeBased()
  342. */
  343. boolean isRangeBased() {
  344. return getUpperBound() != getLowerBound();
  345. }
  346. void setValue(int valueFlag) {
  347. this.valueAsObject = new Integer(valueFlag);
  348. }
  349. }
  350. public class LongConnectionProperty extends IntegerConnectionProperty {
  351. private static final long serialVersionUID = 6068572984340480895L;
  352. LongConnectionProperty(String propertyNameToSet,
  353. long defaultValueToSet, long lowerBoundToSet,
  354. long upperBoundToSet, String descriptionToSet,
  355. String sinceVersionToSet, String category, int orderInCategory) {
  356. super(propertyNameToSet, new Long(defaultValueToSet), null,
  357. (int)lowerBoundToSet, (int)upperBoundToSet, descriptionToSet,
  358. sinceVersionToSet, category, orderInCategory);
  359. }
  360. LongConnectionProperty(String propertyNameToSet,
  361. long defaultValueToSet, String descriptionToSet,
  362. String sinceVersionToSet, String category, int orderInCategory) {
  363. this(propertyNameToSet,
  364. defaultValueToSet, 0,
  365. 0, descriptionToSet,
  366. sinceVersionToSet, category, orderInCategory);
  367. }
  368. void setValue(long value) {
  369. this.valueAsObject = new Long(value);
  370. }
  371. long getValueAsLong() {
  372. return ((Long) this.valueAsObject).longValue();
  373. }
  374. void initializeFrom(String extractedValue) throws SQLException {
  375. if (extractedValue != null) {
  376. try {
  377. // Parse decimals, too
  378. long longValue = Double.valueOf(extractedValue).longValue();
  379. this.valueAsObject = new Long(longValue);
  380. } catch (NumberFormatException nfe) {
  381. throw SQLError.createSQLException("The connection property '" //$NON-NLS-1$
  382. + getPropertyName()
  383. + "' only accepts long integer values. The value '" //$NON-NLS-1$
  384. + extractedValue
  385. + "' can not be converted to a long integer.", //$NON-NLS-1$
  386. SQLError.SQL_STATE_ILLEGAL_ARGUMENT, getExceptionInterceptor());
  387. }
  388. } else {
  389. this.valueAsObject = this.defaultValue;
  390. }
  391. }
  392. }
  393. class MemorySizeConnectionProperty extends IntegerConnectionProperty implements Serializable {
  394. private static final long serialVersionUID = 7351065128998572656L;
  395. private String valueAsString;
  396. MemorySizeConnectionProperty(String propertyNameToSet,
  397. int defaultValueToSet, int lowerBoundToSet,
  398. int upperBoundToSet, String descriptionToSet,
  399. String sinceVersionToSet, String category, int orderInCategory) {
  400. super(propertyNameToSet, defaultValueToSet, lowerBoundToSet,
  401. upperBoundToSet, descriptionToSet, sinceVersionToSet,
  402. category, orderInCategory);
  403. }
  404. void initializeFrom(String extractedValue) throws SQLException {
  405. valueAsString = extractedValue;
  406. if (extractedValue != null) {
  407. if (extractedValue.endsWith("k") //$NON-NLS-1$
  408. || extractedValue.endsWith("K") //$NON-NLS-1$
  409. || extractedValue.endsWith("kb") //$NON-NLS-1$
  410. || extractedValue.endsWith("Kb") //$NON-NLS-1$
  411. || extractedValue.endsWith("kB")) { //$NON-NLS-1$
  412. multiplier = 1024;
  413. int indexOfK = StringUtils.indexOfIgnoreCase(
  414. extractedValue, "k"); //$NON-NLS-1$
  415. extractedValue = extractedValue.substring(0, indexOfK);
  416. } else if (extractedValue.endsWith("m") //$NON-NLS-1$
  417. || extractedValue.endsWith("M") //$NON-NLS-1$
  418. || extractedValue.endsWith("G") //$NON-NLS-1$
  419. || extractedValue.endsWith("mb") //$NON-NLS-1$
  420. || extractedValue.endsWith("Mb") //$NON-NLS-1$
  421. || extractedValue.endsWith("mB")) { //$NON-NLS-1$
  422. multiplier = 1024 * 1024;
  423. int indexOfM = StringUtils.indexOfIgnoreCase(
  424. extractedValue, "m"); //$NON-NLS-1$
  425. extractedValue = extractedValue.substring(0, indexOfM);
  426. } else if (extractedValue.endsWith("g") //$NON-NLS-1$
  427. || extractedValue.endsWith("G") //$NON-NLS-1$
  428. || extractedValue.endsWith("gb") //$NON-NLS-1$
  429. || extractedValue.endsWith("Gb") //$NON-NLS-1$
  430. || extractedValue.endsWith("gB")) { //$NON-NLS-1$
  431. multiplier = 1024 * 1024 * 1024;
  432. int indexOfG = StringUtils.indexOfIgnoreCase(
  433. extractedValue, "g"); //$NON-NLS-1$
  434. extractedValue = extractedValue.substring(0, indexOfG);
  435. }
  436. }
  437. super.initializeFrom(extractedValue);
  438. }
  439. void setValue(String value) throws SQLException {
  440. initializeFrom(value);
  441. }
  442. String getValueAsString() {
  443. return valueAsString;
  444. }
  445. }
  446. class StringConnectionProperty extends ConnectionProperty implements Serializable {
  447. private static final long serialVersionUID = 5432127962785948272L;
  448. StringConnectionProperty(String propertyNameToSet,
  449. String defaultValueToSet, String descriptionToSet,
  450. String sinceVersionToSet, String category, int orderInCategory) {
  451. this(propertyNameToSet, defaultValueToSet, null, descriptionToSet,
  452. sinceVersionToSet, category, orderInCategory);
  453. }
  454. /**
  455. * DOCUMENT ME!
  456. *
  457. * @param propertyNameToSet
  458. * @param defaultValueToSet
  459. * @param allowableValuesToSet
  460. * @param descriptionToSet
  461. * @param sinceVersionToSet
  462. * DOCUMENT ME!
  463. */
  464. StringConnectionProperty(String propertyNameToSet,
  465. String defaultValueToSet, String[] allowableValuesToSet,
  466. String descriptionToSet, String sinceVersionToSet,
  467. String category, int orderInCategory) {
  468. super(propertyNameToSet, defaultValueToSet, allowableValuesToSet,
  469. 0, 0, descriptionToSet, sinceVersionToSet, category,
  470. orderInCategory);
  471. }
  472. String getValueAsString() {
  473. return (String) this.valueAsObject;
  474. }
  475. /**
  476. * @see com.mysql.jdbc.ConnectionPropertiesImpl.ConnectionProperty#hasValueConstraints()
  477. */
  478. boolean hasValueConstraints() {
  479. return (this.allowableValues != null)
  480. && (this.allowableValues.length > 0);
  481. }
  482. /**
  483. * @see com.mysql.jdbc.ConnectionPropertiesImpl.ConnectionProperty#initializeFrom(java.util.Properties)
  484. */
  485. void initializeFrom(String extractedValue) throws SQLException {
  486. if (extractedValue != null) {
  487. validateStringValues(extractedValue);
  488. this.valueAsObject = extractedValue;
  489. } else {
  490. this.valueAsObject = this.defaultValue;
  491. }
  492. }
  493. /**
  494. * @see com.mysql.jdbc.ConnectionPropertiesImpl.ConnectionProperty#isRangeBased()
  495. */
  496. boolean isRangeBased() {
  497. return false;
  498. }
  499. void setValue(String valueFlag) {
  500. this.valueAsObject = valueFlag;
  501. }
  502. }
  503. private static final String CONNECTION_AND_AUTH_CATEGORY = Messages.getString("ConnectionProperties.categoryConnectionAuthentication"); //$NON-NLS-1$
  504. private static final String NETWORK_CATEGORY = Messages.getString("ConnectionProperties.categoryNetworking"); //$NON-NLS-1$
  505. private static final String DEBUGING_PROFILING_CATEGORY = Messages.getString("ConnectionProperties.categoryDebuggingProfiling"); //$NON-NLS-1$
  506. private static final String HA_CATEGORY = Messages.getString("ConnectionProperties.categorryHA"); //$NON-NLS-1$
  507. private static final String MISC_CATEGORY = Messages.getString("ConnectionProperties.categoryMisc"); //$NON-NLS-1$
  508. private static final String PERFORMANCE_CATEGORY = Messages.getString("ConnectionProperties.categoryPerformance"); //$NON-NLS-1$
  509. private static final String SECURITY_CATEGORY = Messages.getString("ConnectionProperties.categorySecurity"); //$NON-NLS-1$
  510. private static final String[] PROPERTY_CATEGORIES = new String[] {
  511. CONNECTION_AND_AUTH_CATEGORY, NETWORK_CATEGORY,
  512. HA_CATEGORY, SECURITY_CATEGORY,
  513. PERFORMANCE_CATEGORY, DEBUGING_PROFILING_CATEGORY, MISC_CATEGORY };
  514. private static final ArrayList PROPERTY_LIST = new ArrayList();
  515. //
  516. // Yes, this looks goofy, but we're trying to avoid intern()ing here
  517. //
  518. private static final String STANDARD_LOGGER_NAME = StandardLogger.class.getName();
  519. protected static final String ZERO_DATETIME_BEHAVIOR_CONVERT_TO_NULL = "convertToNull"; //$NON-NLS-1$
  520. protected static final String ZERO_DATETIME_BEHAVIOR_EXCEPTION = "exception"; //$NON-NLS-1$
  521. protected static final String ZERO_DATETIME_BEHAVIOR_ROUND = "round"; //$NON-NLS-1$
  522. static {
  523. try {
  524. java.lang.reflect.Field[] declaredFields = ConnectionPropertiesImpl.class
  525. .getDeclaredFields();
  526. for (int i = 0; i < declaredFields.length; i++) {
  527. if (ConnectionPropertiesImpl.ConnectionProperty.class
  528. .isAssignableFrom(declaredFields[i].getType())) {
  529. PROPERTY_LIST.add(declaredFields[i]);
  530. }
  531. }
  532. } catch (Exception ex) {
  533. RuntimeException rtEx = new RuntimeException();
  534. rtEx.initCause(ex);
  535. throw rtEx;
  536. }
  537. }
  538. public ExceptionInterceptor getExceptionInterceptor() {
  539. return null;
  540. }
  541. /**
  542. * Exposes all ConnectionPropertyInfo instances as DriverPropertyInfo
  543. *
  544. * @param info
  545. * the properties to load into these ConnectionPropertyInfo
  546. * instances
  547. * @param slotsToReserve
  548. * the number of DPI slots to reserve for 'standard' DPI
  549. * properties (user, host, password, etc)
  550. * @return a list of all ConnectionPropertyInfo instances, as
  551. * DriverPropertyInfo
  552. * @throws SQLException
  553. * if an error occurs
  554. */
  555. protected static DriverPropertyInfo[] exposeAsDriverPropertyInfo(
  556. Properties info, int slotsToReserve) throws SQLException {
  557. return (new ConnectionPropertiesImpl() {
  558. }).exposeAsDriverPropertyInfoInternal(info, slotsToReserve);
  559. }
  560. private BooleanConnectionProperty allowLoadLocalInfile = new BooleanConnectionProperty(
  561. "allowLoadLocalInfile", //$NON-NLS-1$
  562. true,
  563. Messages.getString("ConnectionProperties.loadDataLocal"), //$NON-NLS-1$
  564. "3.0.3", SECURITY_CATEGORY, Integer.MAX_VALUE); //$NON-NLS-1$
  565. private BooleanConnectionProperty allowMultiQueries = new BooleanConnectionProperty(
  566. "allowMultiQueries", //$NON-NLS-1$
  567. false,
  568. Messages.getString("ConnectionProperties.allowMultiQueries"), //$NON-NLS-1$
  569. "3.1.1", SECURITY_CATEGORY, 1); //$NON-NLS-1$
  570. private BooleanConnectionProperty allowNanAndInf = new BooleanConnectionProperty(
  571. "allowNanAndInf", //$NON-NLS-1$
  572. false,
  573. Messages.getString("ConnectionProperties.allowNANandINF"), //$NON-NLS-1$
  574. "3.1.5", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  575. private BooleanConnectionProperty allowUrlInLocalInfile = new BooleanConnectionProperty(
  576. "allowUrlInLocalInfile", //$NON-NLS-1$
  577. false,
  578. Messages.getString("ConnectionProperties.allowUrlInLoadLocal"), //$NON-NLS-1$
  579. "3.1.4", SECURITY_CATEGORY, Integer.MAX_VALUE); //$NON-NLS-1$
  580. private BooleanConnectionProperty alwaysSendSetIsolation = new BooleanConnectionProperty(
  581. "alwaysSendSetIsolation", //$NON-NLS-1$
  582. true,
  583. Messages.getString("ConnectionProperties.alwaysSendSetIsolation"), //$NON-NLS-1$
  584. "3.1.7", PERFORMANCE_CATEGORY, Integer.MAX_VALUE); //$NON-NLS-1$
  585. private BooleanConnectionProperty autoClosePStmtStreams = new BooleanConnectionProperty(
  586. "autoClosePStmtStreams", //$NON-NLS-1$
  587. false,
  588. Messages.getString("ConnectionProperties.autoClosePstmtStreams"), //$NON-NLS-1$
  589. "3.1.12", //$NON-NLS-1$
  590. MISC_CATEGORY,
  591. Integer.MIN_VALUE);
  592. private BooleanConnectionProperty autoDeserialize = new BooleanConnectionProperty(
  593. "autoDeserialize", //$NON-NLS-1$
  594. false,
  595. Messages.getString("ConnectionProperties.autoDeserialize"), //$NON-NLS-1$
  596. "3.1.5", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  597. private BooleanConnectionProperty autoGenerateTestcaseScript = new BooleanConnectionProperty(
  598. "autoGenerateTestcaseScript", false, //$NON-NLS-1$
  599. Messages.getString("ConnectionProperties.autoGenerateTestcaseScript"), "3.1.9", //$NON-NLS-1$ //$NON-NLS-2$
  600. DEBUGING_PROFILING_CATEGORY, Integer.MIN_VALUE);
  601. private boolean autoGenerateTestcaseScriptAsBoolean = false;
  602. private BooleanConnectionProperty autoReconnect = new BooleanConnectionProperty(
  603. "autoReconnect", //$NON-NLS-1$
  604. false,
  605. Messages.getString("ConnectionProperties.autoReconnect"), //$NON-NLS-1$
  606. "1.1", HA_CATEGORY, 0); //$NON-NLS-1$
  607. private BooleanConnectionProperty autoReconnectForPools = new BooleanConnectionProperty(
  608. "autoReconnectForPools", //$NON-NLS-1$
  609. false,
  610. Messages.getString("ConnectionProperties.autoReconnectForPools"), //$NON-NLS-1$
  611. "3.1.3", HA_CATEGORY, 1); //$NON-NLS-1$
  612. private boolean autoReconnectForPoolsAsBoolean = false;
  613. private MemorySizeConnectionProperty blobSendChunkSize = new MemorySizeConnectionProperty(
  614. "blobSendChunkSize", //$NON-NLS-1$
  615. 1024 * 1024,
  616. 1,
  617. Integer.MAX_VALUE,
  618. Messages.getString("ConnectionProperties.blobSendChunkSize"), //$NON-NLS-1$
  619. "3.1.9", PERFORMANCE_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  620. private BooleanConnectionProperty autoSlowLog = new BooleanConnectionProperty(
  621. "autoSlowLog", true,
  622. Messages.getString("ConnectionProperties.autoSlowLog"),
  623. "5.1.4", DEBUGING_PROFILING_CATEGORY, Integer.MIN_VALUE);
  624. private BooleanConnectionProperty blobsAreStrings = new BooleanConnectionProperty(
  625. "blobsAreStrings", false,
  626. "Should the driver always treat BLOBs as Strings - specifically to work around dubious metadata "
  627. + "returned by the server for GROUP BY clauses?",
  628. "5.0.8", MISC_CATEGORY, Integer.MIN_VALUE);
  629. private BooleanConnectionProperty functionsNeverReturnBlobs = new BooleanConnectionProperty(
  630. "functionsNeverReturnBlobs", false,
  631. "Should the driver always treat data from functions returning BLOBs as Strings - specifically to work around dubious metadata "
  632. + "returned by the server for GROUP BY clauses?",
  633. "5.0.8", MISC_CATEGORY, Integer.MIN_VALUE);
  634. private BooleanConnectionProperty cacheCallableStatements = new BooleanConnectionProperty(
  635. "cacheCallableStmts", false, //$NON-NLS-1$
  636. Messages.getString("ConnectionProperties.cacheCallableStatements"), //$NON-NLS-1$
  637. "3.1.2", PERFORMANCE_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  638. private BooleanConnectionProperty cachePreparedStatements = new BooleanConnectionProperty(
  639. "cachePrepStmts", //$NON-NLS-1$
  640. false,
  641. Messages.getString("ConnectionProperties.cachePrepStmts"), //$NON-NLS-1$
  642. "3.0.10", PERFORMANCE_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  643. private BooleanConnectionProperty cacheResultSetMetadata = new BooleanConnectionProperty(
  644. "cacheResultSetMetadata", //$NON-NLS-1$
  645. false,
  646. Messages.getString("ConnectionProperties.cacheRSMetadata"), //$NON-NLS-1$
  647. "3.1.1", PERFORMANCE_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  648. private boolean cacheResultSetMetaDataAsBoolean;
  649. private BooleanConnectionProperty cacheServerConfiguration = new BooleanConnectionProperty(
  650. "cacheServerConfiguration", //$NON-NLS-1$
  651. false,
  652. Messages.getString("ConnectionProperties.cacheServerConfiguration"), //$NON-NLS-1$
  653. "3.1.5", PERFORMANCE_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  654. private IntegerConnectionProperty callableStatementCacheSize = new IntegerConnectionProperty(
  655. "callableStmtCacheSize", //$NON-NLS-1$
  656. 100,
  657. 0,
  658. Integer.MAX_VALUE,
  659. Messages.getString("ConnectionProperties.callableStmtCacheSize"), //$NON-NLS-1$
  660. "3.1.2", PERFORMANCE_CATEGORY, 5); //$NON-NLS-1$
  661. private BooleanConnectionProperty capitalizeTypeNames = new BooleanConnectionProperty(
  662. "capitalizeTypeNames", //$NON-NLS-1$
  663. true,
  664. Messages.getString("ConnectionProperties.capitalizeTypeNames"), //$NON-NLS-1$
  665. "2.0.7", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  666. private StringConnectionProperty characterEncoding = new StringConnectionProperty(
  667. "characterEncoding", //$NON-NLS-1$
  668. null,
  669. Messages.getString("ConnectionProperties.characterEncoding"), //$NON-NLS-1$
  670. "1.1g", MISC_CATEGORY, 5); //$NON-NLS-1$
  671. private String characterEncodingAsString = null;
  672. private StringConnectionProperty characterSetResults = new StringConnectionProperty(
  673. "characterSetResults", null, //$NON-NLS-1$
  674. Messages.getString("ConnectionProperties.characterSetResults"), "3.0.13", //$NON-NLS-1$ //$NON-NLS-2$
  675. MISC_CATEGORY, 6);
  676. private StringConnectionProperty clientInfoProvider = new StringConnectionProperty(
  677. "clientInfoProvider", "com.mysql.jdbc.JDBC4CommentClientInfoProvider", //$NON-NLS-1$ //$NON-NLS-2$
  678. Messages.getString("ConnectionProperties.clientInfoProvider"), //$NON-NLS-1$
  679. "5.1.0", //$NON-NLS-1$
  680. DEBUGING_PROFILING_CATEGORY, Integer.MIN_VALUE);
  681. private BooleanConnectionProperty clobberStreamingResults = new BooleanConnectionProperty(
  682. "clobberStreamingResults", //$NON-NLS-1$
  683. false,
  684. Messages.getString("ConnectionProperties.clobberStreamingResults"), //$NON-NLS-1$
  685. "3.0.9", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  686. private StringConnectionProperty clobCharacterEncoding = new StringConnectionProperty(
  687. "clobCharacterEncoding", //$NON-NLS-1$
  688. null,
  689. Messages.getString("ConnectionProperties.clobCharacterEncoding"), //$NON-NLS-1$
  690. "5.0.0", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  691. private BooleanConnectionProperty compensateOnDuplicateKeyUpdateCounts = new BooleanConnectionProperty(
  692. "compensateOnDuplicateKeyUpdateCounts",
  693. false,
  694. Messages.getString("ConnectionProperties.compensateOnDuplicateKeyUpdateCounts"),
  695. "5.1.7", MISC_CATEGORY, Integer.MIN_VALUE);
  696. private StringConnectionProperty connectionCollation = new StringConnectionProperty(
  697. "connectionCollation", //$NON-NLS-1$
  698. null,
  699. Messages.getString("ConnectionProperties.connectionCollation"), //$NON-NLS-1$
  700. "3.0.13", MISC_CATEGORY, 7); //$NON-NLS-1$
  701. private StringConnectionProperty connectionLifecycleInterceptors = new StringConnectionProperty(
  702. "connectionLifecycleInterceptors", //$NON-NLS-1$
  703. null,
  704. Messages.getString("ConnectionProperties.connectionLifecycleInterceptors"),
  705. "5.1.4", CONNECTION_AND_AUTH_CATEGORY, Integer.MAX_VALUE);
  706. private IntegerConnectionProperty connectTimeout = new IntegerConnectionProperty(
  707. "connectTimeout", 0, 0, Integer.MAX_VALUE, //$NON-NLS-1$
  708. Messages.getString("ConnectionProperties.connectTimeout"), //$NON-NLS-1$
  709. "3.0.1", CONNECTION_AND_AUTH_CATEGORY, 9); //$NON-NLS-1$
  710. private BooleanConnectionProperty continueBatchOnError = new BooleanConnectionProperty(
  711. "continueBatchOnError", //$NON-NLS-1$
  712. true,
  713. Messages.getString("ConnectionProperties.continueBatchOnError"), //$NON-NLS-1$
  714. "3.0.3", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  715. private BooleanConnectionProperty createDatabaseIfNotExist = new BooleanConnectionProperty(
  716. "createDatabaseIfNotExist", //$NON-NLS-1$
  717. false,
  718. Messages.getString("ConnectionProperties.createDatabaseIfNotExist"), //$NON-NLS-1$
  719. "3.1.9", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  720. private IntegerConnectionProperty defaultFetchSize = new IntegerConnectionProperty("defaultFetchSize", 0, Messages.getString("ConnectionProperties.defaultFetchSize"), "3.1.9", PERFORMANCE_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
  721. private BooleanConnectionProperty detectServerPreparedStmts = new BooleanConnectionProperty(
  722. "useServerPrepStmts", //$NON-NLS-1$
  723. false,
  724. Messages.getString("ConnectionProperties.useServerPrepStmts"), //$NON-NLS-1$
  725. "3.1.0", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  726. private BooleanConnectionProperty dontTrackOpenResources = new BooleanConnectionProperty(
  727. "dontTrackOpenResources", //$NON-NLS-1$
  728. false,
  729. Messages.getString("ConnectionProperties.dontTrackOpenResources"), "3.1.7", PERFORMANCE_CATEGORY, //$NON-NLS-1$ //$NON-NLS-2$
  730. Integer.MIN_VALUE);
  731. private BooleanConnectionProperty dumpQueriesOnException = new BooleanConnectionProperty(
  732. "dumpQueriesOnException", //$NON-NLS-1$
  733. false,
  734. Messages.getString("ConnectionProperties.dumpQueriesOnException"), //$NON-NLS-1$
  735. "3.1.3", DEBUGING_PROFILING_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  736. private BooleanConnectionProperty dynamicCalendars = new BooleanConnectionProperty(
  737. "dynamicCalendars", //$NON-NLS-1$
  738. false,
  739. Messages.getString("ConnectionProperties.dynamicCalendars"), //$NON-NLS-1$
  740. "3.1.5", PERFORMANCE_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  741. private BooleanConnectionProperty elideSetAutoCommits = new BooleanConnectionProperty(
  742. "elideSetAutoCommits", //$NON-NLS-1$
  743. false,
  744. Messages.getString("ConnectionProperties.eliseSetAutoCommit"), //$NON-NLS-1$
  745. "3.1.3", PERFORMANCE_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  746. private BooleanConnectionProperty emptyStringsConvertToZero = new BooleanConnectionProperty(
  747. "emptyStringsConvertToZero", true, //$NON-NLS-1$
  748. Messages.getString("ConnectionProperties.emptyStringsConvertToZero"), "3.1.8", //$NON-NLS-1$ //$NON-NLS-2$
  749. MISC_CATEGORY, Integer.MIN_VALUE);
  750. private BooleanConnectionProperty emulateLocators = new BooleanConnectionProperty(
  751. "emulateLocators", false, Messages.getString("ConnectionProperties.emulateLocators"), "3.1.0", MISC_CATEGORY, //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
  752. Integer.MIN_VALUE);
  753. private BooleanConnectionProperty emulateUnsupportedPstmts = new BooleanConnectionProperty(
  754. "emulateUnsupportedPstmts", //$NON-NLS-1$
  755. true,
  756. Messages.getString("ConnectionProperties.emulateUnsupportedPstmts"), //$NON-NLS-1$
  757. "3.1.7", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  758. private BooleanConnectionProperty enablePacketDebug = new BooleanConnectionProperty(
  759. "enablePacketDebug", //$NON-NLS-1$
  760. false,
  761. Messages.getString("ConnectionProperties.enablePacketDebug"), //$NON-NLS-1$
  762. "3.1.3", DEBUGING_PROFILING_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  763. private BooleanConnectionProperty enableQueryTimeouts = new BooleanConnectionProperty(
  764. "enableQueryTimeouts", //$NON-NLS-1$
  765. true,
  766. Messages.getString("ConnectionProperties.enableQueryTimeouts"), //$NON-NLS-1$
  767. "5.0.6", //$NON-NLS-1$
  768. PERFORMANCE_CATEGORY, Integer.MIN_VALUE);
  769. private BooleanConnectionProperty explainSlowQueries = new BooleanConnectionProperty(
  770. "explainSlowQueries", //$NON-NLS-1$
  771. false,
  772. Messages.getString("ConnectionProperties.explainSlowQueries"), //$NON-NLS-1$
  773. "3.1.2", DEBUGING_PROFILING_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  774. private StringConnectionProperty exceptionInterceptors = new StringConnectionProperty(
  775. "exceptionInterceptors", //$NON-NLS-1$
  776. null,
  777. Messages.getString("ConnectionProperties.exceptionInterceptors"),
  778. "5.1.8", MISC_CATEGORY, Integer.MIN_VALUE);
  779. /** When failed-over, set connection to read-only? */
  780. private BooleanConnectionProperty failOverReadOnly = new BooleanConnectionProperty(
  781. "failOverReadOnly", //$NON-NLS-1$
  782. true,
  783. Messages.getString("ConnectionProperties.failoverReadOnly"), //$NON-NLS-1$
  784. "3.0.12", HA_CATEGORY, 2); //$NON-NLS-1$
  785. private BooleanConnectionProperty gatherPerformanceMetrics = new BooleanConnectionProperty(
  786. "gatherPerfMetrics", //$NON-NLS-1$
  787. false,
  788. Messages.getString("ConnectionProperties.gatherPerfMetrics"), //$NON-NLS-1$
  789. "3.1.2", DEBUGING_PROFILING_CATEGORY, 1); //$NON-NLS-1$
  790. private BooleanConnectionProperty generateSimpleParameterMetadata = new BooleanConnectionProperty(
  791. "generateSimpleParameterMetadata", false, Messages.getString("ConnectionProperties.generateSimpleParameterMetadata"), "5.0.5", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  792. private boolean highAvailabilityAsBoolean = false;
  793. private BooleanConnectionProperty holdResultsOpenOverStatementClose = new BooleanConnectionProperty(
  794. "holdResultsOpenOverStatementClose", //$NON-NLS-1$
  795. false,
  796. Messages.getString("ConnectionProperties.holdRSOpenOverStmtClose"), //$NON-NLS-1$
  797. "3.1.7", PERFORMANCE_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  798. private BooleanConnectionProperty includeInnodbStatusInDeadlockExceptions = new BooleanConnectionProperty(
  799. "includeInnodbStatusInDeadlockExceptions",
  800. false,
  801. "Include the output of \"SHOW ENGINE INNODB STATUS\" in exception messages when deadlock exceptions are detected?",
  802. "5.0.7", DEBUGING_PROFILING_CATEGORY, Integer.MIN_VALUE);
  803. private BooleanConnectionProperty ignoreNonTxTables = new BooleanConnectionProperty(
  804. "ignoreNonTxTables", //$NON-NLS-1$
  805. false,
  806. Messages.getString("ConnectionProperties.ignoreNonTxTables"), //$NON-NLS-1$
  807. "3.0.9", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  808. private IntegerConnectionProperty initialTimeout = new IntegerConnectionProperty(
  809. "initialTimeout", 2, 1, Integer.MAX_VALUE, //$NON-NLS-1$
  810. Messages.getString("ConnectionProperties.initialTimeout"), //$NON-NLS-1$
  811. "1.1", HA_CATEGORY, 5); //$NON-NLS-1$
  812. private BooleanConnectionProperty isInteractiveClient = new BooleanConnectionProperty(
  813. "interactiveClient", //$NON-NLS-1$
  814. false,
  815. Messages.getString("ConnectionProperties.interactiveClient"), //$NON-NLS-1$
  816. "3.1.0", CONNECTION_AND_AUTH_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  817. private BooleanConnectionProperty jdbcCompliantTruncation = new BooleanConnectionProperty(
  818. "jdbcCompliantTruncation", //$NON-NLS-1$
  819. true,
  820. Messages.getString("ConnectionProperties.jdbcCompliantTruncation"), "3.1.2", MISC_CATEGORY, //$NON-NLS-1$ //$NON-NLS-2$
  821. Integer.MIN_VALUE);
  822. private boolean jdbcCompliantTruncationForReads =
  823. this.jdbcCompliantTruncation.getValueAsBoolean();
  824. protected MemorySizeConnectionProperty largeRowSizeThreshold = new MemorySizeConnectionProperty("largeRowSizeThreshold",
  825. 2048, 0, Integer.MAX_VALUE,
  826. Messages.getString("ConnectionProperties.largeRowSizeThreshold"),
  827. "5.1.1", PERFORMANCE_CATEGORY, Integer.MIN_VALUE);
  828. private StringConnectionProperty loadBalanceStrategy = new StringConnectionProperty(
  829. "loadBalanceStrategy", //$NON-NLS-1$
  830. "random", //$NON-NLS-1$
  831. null, //$NON-NLS-1$ //$NON-NLS-2$
  832. Messages.getString("ConnectionProperties.loadBalanceStrategy"), //$NON-NLS-1$
  833. "5.0.6", PERFORMANCE_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  834. private IntegerConnectionProperty loadBalanceBlacklistTimeout = new IntegerConnectionProperty(
  835. "loadBalanceBlacklistTimeout", 0, //$NON-NLS-1$
  836. 0, Integer.MAX_VALUE,
  837. Messages.getString("ConnectionProperties.loadBalanceBlacklistTimeout"), //$NON-NLS-1$
  838. "5.1.0", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  839. private IntegerConnectionProperty loadBalancePingTimeout = new IntegerConnectionProperty(
  840. "loadBalancePingTimeout", 0, //$NON-NLS-1$
  841. 0, Integer.MAX_VALUE,
  842. Messages.getString("ConnectionProperties.loadBalancePingTimeout"), //$NON-NLS-1$
  843. "5.1.13", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  844. private BooleanConnectionProperty loadBalanceValidateConnectionOnSwapServer = new BooleanConnectionProperty(
  845. "loadBalanceValidateConnectionOnSwapServer",
  846. false,
  847. Messages.getString("ConnectionProperties.loadBalanceValidateConnectionOnSwapServer"), //$NON-NLS-1$
  848. "5.1.13", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  849. private StringConnectionProperty loadBalanceConnectionGroup = new StringConnectionProperty(
  850. "loadBalanceConnectionGroup", //$NON-NLS-1$
  851. null, //$NON-NLS-1$ //$NON-NLS-2$
  852. Messages.getString("ConnectionProperties.loadBalanceConnectionGroup"), //$NON-NLS-1$
  853. "5.1.13", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  854. private StringConnectionProperty loadBalanceExceptionChecker = new StringConnectionProperty(
  855. "loadBalanceExceptionChecker", //$NON-NLS-1$
  856. "com.mysql.jdbc.StandardLoadBalanceExceptionChecker", //$NON-NLS-1$
  857. null, //$NON-NLS-1$ //$NON-NLS-2$
  858. Messages.getString("ConnectionProperties.loadBalanceExceptionChecker"), //$NON-NLS-1$
  859. "5.1.13", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  860. private StringConnectionProperty loadBalanceSQLStateFailover = new StringConnectionProperty(
  861. "loadBalanceSQLStateFailover", //$NON-NLS-1$
  862. null, //$NON-NLS-1$ //$NON-NLS-2$
  863. Messages.getString("ConnectionProperties.loadBalanceSQLStateFailover"), //$NON-NLS-1$
  864. "5.1.13", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  865. private StringConnectionProperty loadBalanceSQLExceptionSubclassFailover = new StringConnectionProperty(
  866. "loadBalanceSQLExceptionSubclassFailover", //$NON-NLS-1$
  867. null, //$NON-NLS-1$ //$NON-NLS-2$
  868. Messages.getString("ConnectionProperties.loadBalanceSQLExceptionSubclassFailover"), //$NON-NLS-1$
  869. "5.1.13", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  870. private BooleanConnectionProperty loadBalanceEnableJMX = new BooleanConnectionProperty(
  871. "loadBalanceEnableJMX", //$NON-NLS-1$
  872. false,
  873. Messages.getString("ConnectionProperties.loadBalanceEnableJMX"), //$NON-NLS-1$
  874. "5.1.13", MISC_CATEGORY, Integer.MAX_VALUE); //$NON-NLS-1$
  875. private StringConnectionProperty localSocketAddress = new StringConnectionProperty("localSocketAddress", //$NON-NLS-1$
  876. null, Messages.getString("ConnectionProperties.localSocketAddress"), //$NON-NLS-1$
  877. "5.0.5", CONNECTION_AND_AUTH_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  878. private MemorySizeConnectionProperty locatorFetchBufferSize = new MemorySizeConnectionProperty(
  879. "locatorFetchBufferSize", //$NON-NLS-1$
  880. 1024 * 1024,
  881. 0,
  882. Integer.MAX_VALUE,
  883. Messages.getString("ConnectionProperties.locatorFetchBufferSize"), //$NON-NLS-1$
  884. "3.2.1", PERFORMANCE_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  885. private StringConnectionProperty loggerClassName = new StringConnectionProperty(
  886. "logger", STANDARD_LOGGER_NAME, //$NON-NLS-1$
  887. Messages.getString("ConnectionProperties.logger", new Object[] {Log.class.getName(), STANDARD_LOGGER_NAME}), //$NON-NLS-1$
  888. "3.1.1", DEBUGING_PROFILING_CATEGORY, //$NON-NLS-1$ //$NON-NLS-2$
  889. 0);
  890. private BooleanConnectionProperty logSlowQueries = new BooleanConnectionProperty(
  891. "logSlowQueries", //$NON-NLS-1$
  892. false,
  893. Messages.getString("ConnectionProperties.logSlowQueries"), //$NON-NLS-1$
  894. "3.1.2", DEBUGING_PROFILING_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  895. private BooleanConnectionProperty logXaCommands = new BooleanConnectionProperty(
  896. "logXaCommands", //$NON-NLS-1$
  897. false,
  898. Messages.getString("ConnectionProperties.logXaCommands"), //$NON-NLS-1$
  899. "5.0.5", DEBUGING_PROFILING_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  900. private BooleanConnectionProperty maintainTimeStats = new BooleanConnectionProperty(
  901. "maintainTimeStats", //$NON-NLS-1$
  902. true,
  903. Messages.getString("ConnectionProperties.maintainTimeStats"), "3.1.9", PERFORMANCE_CATEGORY, //$NON-NLS-1$ //$NON-NLS-2$
  904. Integer.MAX_VALUE);
  905. private boolean maintainTimeStatsAsBoolean = true;
  906. private IntegerConnectionProperty maxQuerySizeToLog = new IntegerConnectionProperty(
  907. "maxQuerySizeToLog", //$NON-NLS-1$
  908. 2048,
  909. 0,
  910. Integer.MAX_VALUE,
  911. Messages.getString("ConnectionProperties.maxQuerySizeToLog"), //$NON-NLS-1$
  912. "3.1.3", DEBUGING_PROFILING_CATEGORY, 4); //$NON-NLS-1$
  913. private IntegerConnectionProperty maxReconnects = new IntegerConnectionProperty(
  914. "maxReconnects", //$NON-NLS-1$
  915. 3,
  916. 1,
  917. Integer.MAX_VALUE,
  918. Messages.getString("ConnectionProperties.maxReconnects"), //$NON-NLS-1$
  919. "1.1", HA_CATEGORY, 4); //$NON-NLS-1$
  920. private IntegerConnectionProperty retriesAllDown = new IntegerConnectionProperty(
  921. "retriesAllDown", //$NON-NLS-1$
  922. 120,
  923. 0,
  924. Integer.MAX_VALUE,
  925. Messages.getString("ConnectionProperties.retriesAllDown"), //$NON-NLS-1$
  926. "5.1.6", HA_CATEGORY, 4); //$NON-NLS-1$
  927. private IntegerConnectionProperty maxRows = new IntegerConnectionProperty(
  928. "maxRows", -1, -1, Integer.MAX_VALUE, //$NON-NLS-1$
  929. Messages.getString("ConnectionProperties.maxRows"), //$NON-NLS-1$
  930. Messages.getString("ConnectionProperties.allVersions"), MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  931. private int maxRowsAsInt = -1;
  932. private IntegerConnectionProperty metadataCacheSize = new IntegerConnectionProperty(
  933. "metadataCacheSize", //$NON-NLS-1$
  934. 50,
  935. 1,
  936. Integer.MAX_VALUE,
  937. Messages.getString("ConnectionProperties.metadataCacheSize"), //$NON-NLS-1$
  938. "3.1.1", PERFORMANCE_CATEGORY, 5); //$NON-NLS-1$
  939. private IntegerConnectionProperty netTimeoutForStreamingResults = new IntegerConnectionProperty(
  940. "netTimeoutForStreamingResults", 600, //$NON-NLS-1$
  941. 0, Integer.MAX_VALUE,
  942. Messages.getString("ConnectionProperties.netTimeoutForStreamingResults"), //$NON-NLS-1$
  943. "5.1.0", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  944. private BooleanConnectionProperty noAccessToProcedureBodies = new BooleanConnectionProperty(
  945. "noAccessToProcedureBodies",
  946. false,
  947. "When determining procedure parameter types for CallableStatements, and the connected user "
  948. + " can't access procedure bodies through \"SHOW CREATE PROCEDURE\" or select on mysql.proc "
  949. + " should the driver instead create basic metadata (all parameters reported as IN VARCHARs,"
  950. + " but allowing registerOutParameter() to be called on them anyway) instead "
  951. + " of throwing an exception?",
  952. "5.0.3", MISC_CATEGORY, Integer.MIN_VALUE);
  953. private BooleanConnectionProperty noDatetimeStringSync = new BooleanConnectionProperty(
  954. "noDatetimeStringSync", //$NON-NLS-1$
  955. false,
  956. Messages.getString("ConnectionProperties.noDatetimeStringSync"), //$NON-NLS-1$
  957. "3.1.7", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  958. private BooleanConnectionProperty noTimezoneConversionForTimeType = new BooleanConnectionProperty(
  959. "noTimezoneConversionForTimeType", //$NON-NLS-1$
  960. false,
  961. Messages.getString("ConnectionProperties.noTzConversionForTimeType"), //$NON-NLS-1$
  962. "5.0.0", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  963. private BooleanConnectionProperty nullCatalogMeansCurrent = new BooleanConnectionProperty(
  964. "nullCatalogMeansCurrent", //$NON-NLS-1$
  965. true,
  966. Messages.getString("ConnectionProperties.nullCatalogMeansCurrent"), //$NON-NLS-1$
  967. "3.1.8", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  968. private BooleanConnectionProperty nullNamePatternMatchesAll = new BooleanConnectionProperty(
  969. "nullNamePatternMatchesAll", //$NON-NLS-1$
  970. true,
  971. Messages.getString("ConnectionProperties.nullNamePatternMatchesAll"), //$NON-NLS-1$
  972. "3.1.8", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  973. private IntegerConnectionProperty packetDebugBufferSize = new IntegerConnectionProperty(
  974. "packetDebugBufferSize", //$NON-NLS-1$
  975. 20,
  976. 0,
  977. Integer.MAX_VALUE,
  978. Messages.getString("ConnectionProperties.packetDebugBufferSize"), //$NON-NLS-1$
  979. "3.1.3", DEBUGING_PROFILING_CATEGORY, 7); //$NON-NLS-1$
  980. private BooleanConnectionProperty padCharsWithSpace = new BooleanConnectionProperty(
  981. "padCharsWithSpace", //$NON-NLS-1$
  982. false,
  983. Messages.getString("ConnectionProperties.padCharsWithSpace"), //$NON-NLS-1$
  984. "5.0.6", //$NON-NLS-1$
  985. MISC_CATEGORY,
  986. Integer.MIN_VALUE);
  987. private BooleanConnectionProperty paranoid = new BooleanConnectionProperty(
  988. "paranoid", //$NON-NLS-1$
  989. false,
  990. Messages.getString("ConnectionProperties.paranoid"), //$NON-NLS-1$
  991. "3.0.1", SECURITY_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  992. private BooleanConnectionProperty pedantic = new BooleanConnectionProperty(
  993. "pedantic", false, Messages.getString("ConnectionProperties.pedantic"), "3.0.0", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
  994. MISC_CATEGORY, Integer.MIN_VALUE);
  995. private BooleanConnectionProperty pinGlobalTxToPhysicalConnection = new BooleanConnectionProperty(
  996. "pinGlobalTxToPhysicalConnection", false, Messages.getString("ConnectionProperties.pinGlobalTxToPhysicalConnection"), //$NON-NLS-1$
  997. "5.0.1", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  998. private BooleanConnectionProperty populateInsertRowWithDefaultValues = new BooleanConnectionProperty(
  999. "populateInsertRowWithDefaultValues", false, //$NON-NLS-1$
  1000. Messages.getString("ConnectionProperties.populateInsertRowWithDefaultValues"), //$NON-NLS-1$
  1001. "5.0.5", MISC_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  1002. private IntegerConnectionProperty preparedStatementCacheSize = new IntegerConnectionProperty(
  1003. "prepStmtCacheSize", 25, 0, Integer.MAX_VALUE, //$NON-NLS-1$
  1004. Messages.getString("ConnectionProperties.prepStmtCacheSize"), //$NON-NLS-1$
  1005. "3.0.10", PERFORMANCE_CATEGORY, 10); //$NON-NLS-1$
  1006. private IntegerConnectionProperty preparedStatementCacheSqlLimit = new IntegerConnectionProperty(
  1007. "prepStmtCacheSqlLimit", //$NON-NLS-1$
  1008. 256,
  1009. 1,
  1010. Integer.MAX_VALUE,
  1011. Messages.getString("ConnectionProperties.prepStmtCacheSqlLimit"), //$NON-NLS-1$
  1012. "3.0.10", PERFORMANCE_CATEGORY, 11); //$NON-NLS-1$
  1013. private BooleanConnectionProperty processEscapeCodesForPrepStmts =
  1014. new BooleanConnectionProperty("processEscapeCodesForPrepStmts", //$NON-NLS-1$
  1015. true,
  1016. Messages.getString("ConnectionProperties.processEscapeCodesForPrepStmts"), //$NON-NLS-1$
  1017. "3.1.12", //$NON-NLS-1$
  1018. MISC_CATEGORY, Integer.MIN_VALUE);
  1019. private StringConnectionProperty profilerEventHandler = new StringConnectionProperty(
  1020. "profilerEventHandler",
  1021. "com.mysql.jdbc.profiler.LoggingProfilerEventHandler",
  1022. Messages.getString("ConnectionProperties.profilerEventHandler"),
  1023. "5.1.6", DEBUGING_PROFILING_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  1024. private StringConnectionProperty profileSql = new StringConnectionProperty(
  1025. "profileSql", //$NON-NLS-1$
  1026. null,
  1027. Messages.getString("ConnectionProperties.profileSqlDeprecated"), //$NON-NLS-1$
  1028. "2.0.14", DEBUGING_PROFILING_CATEGORY, 3); //$NON-NLS-1$
  1029. private BooleanConnectionProperty profileSQL = new BooleanConnectionProperty(
  1030. "profileSQL", //$NON-NLS-1$
  1031. false,
  1032. Messages.getString("ConnectionProperties.profileSQL"), //$NON-NLS-1$
  1033. "3.1.0", DEBUGING_PROFILING_CATEGORY, 1); //$NON-NLS-1$
  1034. private boolean profileSQLAsBoolean = false;
  1035. private StringConnectionProperty propertiesTransform = new StringConnectionProperty(
  1036. NonRegisteringDriver.PROPERTIES_TRANSFORM_KEY,
  1037. null,
  1038. Messages.getString("ConnectionProperties.connectionPropertiesTransform"), //$NON-NLS-1$
  1039. "3.1.4", CONNECTION_AND_AUTH_CATEGORY, Integer.MIN_VALUE); //$NON-NLS-1$
  1040. private IntegerConnectionProperty queriesBeforeRetryMaster = new IntegerConnectionProperty(
  1041. "queriesBeforeRetryMaster", //$NON-NLS-1$
  1042. 50,
  1043. 1,
  1044. Integer.MAX_VALUE,
  1045. Messages.getString("ConnectionProperties.queriesBeforeRetryMaster"), //$NON-NLS-1$
  1046. "3.0.2", HA_CATEGORY, 7); //$NON-NLS-1$
  1047. private BooleanConnectionProperty queryTimeoutKill

Large files files are truncated, but you can click here to view the full file