Java Code Examples for com.mysql.cj.jdbc.JdbcConnection#isReadOnly()
The following examples show how to use
com.mysql.cj.jdbc.JdbcConnection#isReadOnly() .
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: MultiHostConnectionProxy.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Synchronizes session state between two connections. * * @param source * The connection where to get state from. * @param target * The connection where to set state. */ void syncSessionState(JdbcConnection source, JdbcConnection target) throws SQLException { if (source == null || target == null) { return; } ModifiableProperty<Boolean> sourceUseLocalSessionState = source.getPropertySet() .getBooleanModifiableProperty(PropertyDefinitions.PNAME_useLocalSessionState); boolean prevUseLocalSessionState = sourceUseLocalSessionState.getValue(); sourceUseLocalSessionState.setValue(true); boolean readOnly = source.isReadOnly(); sourceUseLocalSessionState.setValue(prevUseLocalSessionState); syncSessionState(source, target, readOnly); }
Example 2
Source File: MultiHostConnectionProxy.java From FoxTelem with GNU General Public License v3.0 | 5 votes |
/** * Synchronizes session state between two connections. * * @param source * The connection where to get state from. * @param target * The connection where to set state. * @throws SQLException * if an error occurs */ void syncSessionState(JdbcConnection source, JdbcConnection target) throws SQLException { if (source == null || target == null) { return; } RuntimeProperty<Boolean> sourceUseLocalSessionState = source.getPropertySet().getBooleanProperty(PropertyKey.useLocalSessionState); boolean prevUseLocalSessionState = sourceUseLocalSessionState.getValue(); sourceUseLocalSessionState.setValue(true); boolean readOnly = source.isReadOnly(); sourceUseLocalSessionState.setValue(prevUseLocalSessionState); syncSessionState(source, target, readOnly); }