Hi,All
Recently,  i make Druid SQL queries using the Avatica JDBC driver,but i met
a question ;
if sql body contains  Chinese,then return nothing; so i open the source
code,i find a method:

when request contains Chinese,then sql body may translate into '???',so can
you give me some
advise.

*org.apache.calcite.avatica.remote.RemoteService.apply*

public String apply(String request) {
byte[] response = client.send(request.getBytes(StandardCharsets.UTF_8));
return new String(response, StandardCharsets.UTF_8);

my *pom file* is :

<dependency>
   <groupId>org.apache.calcite.avatica</groupId>
   <artifactId>avatica-core</artifactId>
   <version>1.17.0</version>
</dependency>


and *my connection code* is  like this:

// Connect to /druid/v2/sql/avatica/ on your Broker. String url =
"jdbc:avatica:remote:url=http://localhost:8082/druid/v2/sql/avatica/";; //
Set any connection context parameters you need here (see "Connection
context" below). // Or leave empty for default behavior. Properties
connectionProperties = new Properties(); try (Connection connection =
DriverManager.getConnection(url, connectionProperties)) { try ( final
Statement statement = connection.createStatement(); final ResultSet
resultSet = statement.executeQuery(query) ) { while (resultSet.next()) { //
process result set } } }

sql body like :

select '连接' as link, age from test where name = '小猫'

Reply via email to