Java修改oracle表注释,中文乱码,怎么解决

在程序中运行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();
                }
            }
        }

数据库的连接字符串是怎么写的,加上字符串编码处理参数。

你这个java代码源文件的编码,和数据库的不一致导致。