Member since
08-24-2021
11
Posts
0
Kudos Received
0
Solutions
06-12-2022
05:57 PM
hi @ShankerSharma ,How can I solve this problem?
... View more
06-10-2022
01:37 AM
the table DDL as : create table mid.user_info(id int,name string,address string,email string,insert_time timestamp,primary key(id)) partition by hash(id) partitions 6 stored as kudu; my java code such as: import java.sql.*;
import java.time.LocalDateTime;
public class test {
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Class.forName("com.cloudera.impala.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:impala://impala.db.com:8006/mid;AuthMech=0;UseNativeQuery=1;", "impala", "impala");
String sql = "upsert into user_info(id, name, address, email, insert_time) values (?,?,?,?,?)";
PreparedStatement statement = conn.prepareStatement(sql);
statement.setInt(1,106);
statement.setString(2, "张三");
statement.setString(3, "上海");
statement.setString(4, "John@xyz.com");
statement.setTimestamp(5, Timestamp.valueOf(LocalDateTime.now()));
statement.addBatch();
statement.executeBatch();
statement.close();
conn.close();
}
} I get a bad result when I execute it,The Chinese string appears to be truncated: How can I solve this problem? please!
... View more
Labels:
- Labels:
-
Apache Impala
06-10-2022
12:36 AM
I'm sure my source code file has UTF-8 encoding and I compiling the class by maven. When my SQL is set to : upsert into user_info(id, name, address, email, insert_time) values (?,cast(? as string),cast(? as string),?,?) it's works, but the url parameter “UseNativeQuery=1” does't works!
... View more
06-10-2022
12:06 AM
There is another problem here。 My java code: import java.sql.*;
import java.time.LocalDateTime;
public class test {
public static void main(String[] args) throws ClassNotFoundException, SQLException {
Class.forName("com.cloudera.impala.jdbc.Driver");
Connection conn = DriverManager.getConnection("jdbc:impala://impala.db.com:8006/mid;AuthMech=0;UseNativeQuery=1;", "impala", "impala");
String sql = "upsert into user_info(id, name, address, email, insert_time) values (?,?,?,?,?)";
PreparedStatement statement = conn.prepareStatement(sql);
statement.setInt(1,106);
statement.setString(2, "张三");
statement.setString(3, "上海");
statement.setString(4, "John@xyz.com");
statement.setTimestamp(5, Timestamp.valueOf(LocalDateTime.now()));
statement.addBatch();
statement.executeBatch();
statement.close();
conn.close();
}
} I get a bad result when I execute it,The Chinese string appears to be truncated
... View more
06-09-2022
11:02 PM
It works by adding the parameter “UseNativeQuery=1” to the URL! thanks a lot!
... View more
06-09-2022
06:19 PM
when I create case,I got like this page, Maybe I don't have clearance?
... View more
06-09-2022
02:53 AM
the table DDL is: create table mid.user_info(id int,name string,address string,email string,insert_time timestamp,primary key(id)) partition by hash(id) partitions 6 stored as kudu; public class test { public static void main(String[] args) throws ClassNotFoundException, SQLException { Class.forName("com.cloudera.impala.jdbc.Driver"); Connection connection = DriverManager.getConnection("jdbc:impala://impala.db.com:8006/default;auth=noSasl", "impala", "6712dxgvwe"); String sql = "upsert into mid.user_info(id, name, address, email, insert_time) values(?,?,?,?,?)"; PreparedStatement statement = connection.prepareStatement(sql); statement.setInt(1, 100); statement.setString(2, "John"); statement.setString(3, "New York"); statement.setString(4, "John@iis.com"); statement.setTimestamp(5, Timestamp.valueOf(LocalDateTime.now())); statement.addBatch(); statement.executeBatch(); statement.close(); connection.close(); } } when I execute it, I got a error as: Exception in thread "main" java.sql.SQLException: [Cloudera][ImpalaJDBCDriver](500051) ERROR processing query/statement. Error Code: 0, SQL state: TStatus(statusCode:ERROR_STATUS, sqlState:HY000, errorMessage:AnalysisException: Unknown column 'UPSERT_time' in column permutation ), Query: UPSERT INTO `mid`.`user_info`(`id`, `name`, `address`, `email`, `UPSERT_time`) VALUES (100, CAST('John' AS CHAR(4)), CAST('New York' AS CHAR(8)), CAST('John@iis.com' AS CHAR(12)), '2022-06-09 17:52:10.3808341'). at com.cloudera.impala.hivecommon.api.HS2Client.executeStatementInternal(Unknown Source) at com.cloudera.impala.hivecommon.api.HS2Client.executeStatement(Unknown Source) at com.cloudera.impala.hivecommon.dataengine.HiveJDBCNativeQueryExecutor.executeHelper(Unknown Source) at com.cloudera.impala.hivecommon.dataengine.HiveJDBCNativeQueryExecutor.execute(Unknown Source) at com.cloudera.impala.jdbc.common.SPreparedStatement.executePreparedAnyBatch(Unknown Source) at com.cloudera.impala.jdbc.common.SPreparedStatement.executeBatch(Unknown Source) Caused by: com.cloudera.impala.support.exceptions.GeneralException: [Cloudera][ImpalaJDBCDriver](500051) ERROR processing query/statement. Error Code: 0, SQL state: TStatus(statusCode:ERROR_STATUS, sqlState:HY000, errorMessage:AnalysisException: Unknown column 'UPSERT_time' in column permutation ), Query: UPSERT INTO `mid`.`user_info`(`id`, `name`, `address`, `email`, `UPSERT_time`) VALUES (100, CAST('John' AS CHAR(4)), CAST('New York' AS CHAR(8)), CAST('John@iis.com' AS CHAR(12)), '2022-06-09 17:52:10.3808341'). ... 6 more
... View more
06-08-2022
08:31 PM
impala jdbc driver can using method replaceFirst("insert","upsert") to replace the first "insert" keyword?
... View more
06-08-2022
07:55 PM
I am using the latest version of impala JDBC Driver 2.6.27.1032, when my sql is "upsert into my.testtable(id,name,insert_time) values(?,?,?)" and using preparestatement, then the column "insert_time" will be replaced to "upsert_time", so my sql be changed to "upsert into my.testtable(id,name,upsert_time) values(?,?,?)" and i get a error "errorMessage:AnalysisException: Unknown column 'UPSERTby' in column permutation",。 How can I solve this problem? please!
... View more
Labels:
- Labels:
-
Apache Impala