Java Code Examples for com.mysql.jdbc.Util#isJdbc42()
The following examples show how to use
com.mysql.jdbc.Util#isJdbc42() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConnectionTest.java From r-course with MIT License | 5 votes |
/** * Checks if setting useCursorFetch to "true" automatically enables * server-side prepared statements. */ public void testCouplingOfCursorFetch() throws Exception { if (!versionMeetsMinimum(5, 0)) { return; } Connection fetchConn = null; try { Properties props = new Properties(); props.setProperty("useServerPrepStmts", "false"); // force the issue props.setProperty("useCursorFetch", "true"); fetchConn = getConnectionWithProps(props); String classname = "com.mysql.jdbc.ServerPreparedStatement"; if (Util.isJdbc42()) { classname = "com.mysql.jdbc.JDBC42ServerPreparedStatement"; } else if (Util.isJdbc4()) { classname = "com.mysql.jdbc.JDBC4ServerPreparedStatement"; } assertEquals(classname, fetchConn.prepareStatement("SELECT 1").getClass().getName()); } finally { if (fetchConn != null) { fetchConn.close(); } } }
Example 2
Source File: ConnectionTest.java From Komondor with GNU General Public License v3.0 | 5 votes |
/** * Checks if setting useCursorFetch to "true" automatically enables * server-side prepared statements. */ public void testCouplingOfCursorFetch() throws Exception { if (!versionMeetsMinimum(5, 0)) { return; } Connection fetchConn = null; try { Properties props = new Properties(); props.setProperty("useServerPrepStmts", "false"); // force the issue props.setProperty("useCursorFetch", "true"); fetchConn = getConnectionWithProps(props); String classname = "com.mysql.jdbc.ServerPreparedStatement"; if (Util.isJdbc42()) { classname = "com.mysql.jdbc.JDBC42ServerPreparedStatement"; } else if (Util.isJdbc4()) { classname = "com.mysql.jdbc.JDBC4ServerPreparedStatement"; } assertEquals(classname, fetchConn.prepareStatement("SELECT 1").getClass().getName()); } finally { if (fetchConn != null) { fetchConn.close(); } } }