Created
June 18, 2016 08:52
-
-
Save vamdt/59acacb001fcc13139931d8bc617d959 to your computer and use it in GitHub Desktop.
UTF8MB4ConnectionCustomizer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.vamdt.api.common | |
import com.mchange.v2.c3p0.AbstractConnectionCustomizer; | |
import java.sql.Connection; | |
import java.sql.Statement; | |
public class UTF8MB4ConnectionCustomizer extends AbstractConnectionCustomizer { | |
@Override | |
public void onAcquire(Connection c, String parentDataSourceIdentityToken) throws Exception { | |
Statement statement = c.createStatement(); | |
statement.executeUpdate("SET NAMES utf8mb4"); | |
statement.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment