mirror of https://github.com/apache/druid.git
Merge pull request #1983 from metamx/fix-mysql-57
fix #1701 - MySQL 5.7 defaults break database character set check
This commit is contained in:
commit
7545ab7188
|
@ -30,6 +30,7 @@ import org.apache.commons.dbcp2.BasicDataSource;
|
|||
import org.skife.jdbi.v2.DBI;
|
||||
import org.skife.jdbi.v2.Handle;
|
||||
import org.skife.jdbi.v2.tweak.HandleCallback;
|
||||
import org.skife.jdbi.v2.util.BooleanMapper;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
@ -77,16 +78,14 @@ public class MySQLConnector extends SQLMetadataConnector
|
|||
{
|
||||
// ensure database defaults to utf8, otherwise bail
|
||||
boolean isUtf8 = handle
|
||||
.createQuery("SHOW VARIABLES where variable_name = 'character_set_database' and value = 'utf8'")
|
||||
.list()
|
||||
.size() == 1;
|
||||
.createQuery("SELECT @@character_set_database = 'utf8'")
|
||||
.map(BooleanMapper.FIRST)
|
||||
.first();
|
||||
|
||||
if (!isUtf8) {
|
||||
throw new ISE(
|
||||
"Database default character set is not UTF-8." + System.lineSeparator()
|
||||
+ " Druid requires its MySQL database to be created using UTF-8 as default character set."
|
||||
+ " If you are upgrading from Druid 0.6.x, please make all tables have been converted to utf8 and change the database default."
|
||||
+ " For more information on how to convert and set the default, please refer to section on updating from 0.6.x in the Druid 0.7.1 release notes."
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue