在程序中运行sql,到数据库查看乱码,有没有什么办法,线上环境遇到的,除了修改环境字符集变量还有别的方法吗?
try (Connection conn = this.jdbcDataSource.getJdbcConnection(this.dsId)) {
PreparedStatement ps = null;
try {
String initSql = "COMMENT ON COLUMN T.KEY IS '方法'";
ps = conn.prepareStatement(initSql);
ps.executeUpdate();
}finally {
if(ps != null){
ps.close();
}
}
}