public static void main(String[] args) {
BasicDataSource dataSource = test();
try{
Class.forName("org.apache.calcite.jdbc.Driver");
Properties info = new Properties();
info.setProperty("lex", "JAVA");
Connection connection = DriverManager.getConnection("jdbc:calcite:", info);
CalciteConnection calciteConnection = connection.unwrap(CalciteConnection.class);
SchemaPlus rootSchema = calciteConnection.getRootSchema();
Schema schema = JdbcSchema.create(rootSchema, "hr", dataSource,
null, "name");
rootSchema.add("hr", schema);
Statement statement = calciteConnection.createStatement();
ResultSet resultSet = statement.executeQuery(
"select * from hr.bi_report where report_name = '店铺基础资料'");
System.out.println(resultSet);
resultSet.close();
statement.close();
connection.close();
}catch (Exception e){
e.printStackTrace();
}
}
private static BasicDataSource test(){
try{
Class.forName("com.mysql.cj.jdbc.Driver");
BasicDataSource dataSource = new BasicDataSource();
dataSource.setUrl("jdbc:mysql://localhost/bi");
dataSource.setUsername("root");
dataSource.setPassword("root");
return dataSource;
}catch (Exception e){
e.printStackTrace();
}
return null;
} 会报错Caused by: org.apache.calcite.runtime.CalciteException: Failed to encode '店铺基础资料' in character set 'ISO-8859-1'
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) 我设置了calcite.default.charset = utf8 会解析中文 _utf8'店铺基础资料' 怎么设置才行呢