You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Kaleb Akalework (JIRA)" <ji...@apache.org> on 2016/09/26 17:09:20 UTC

[jira] [Created] (DBUTILS-130) QueryRunner cannot correctly insert unicode characters in Oracle Database.

Kaleb Akalework created DBUTILS-130:
---------------------------------------

             Summary: QueryRunner cannot correctly insert unicode characters in Oracle Database. 
                 Key: DBUTILS-130
                 URL: https://issues.apache.org/jira/browse/DBUTILS-130
             Project: Commons DbUtils
          Issue Type: Bug
    Affects Versions: 1.5
            Reporter: Kaleb Akalework


I have used queryRunner to insert unicode characters succesfully in MSSQL and IBM DB2. I was not able to successfully insert unicode into Oracle. Instead I see the reversed questions mark are inserted, in place of the acutal data. This is the code. The below code works fine If I'm using SQL Server 2016 or IBM DB2 10.5. 

	
Here is a sample java code I'm using. The followoing code works perfectly if executed against SQL Server database. 

to create the table use create table TEST (test NCLOB) 


private Object[][] getBulkWriteParams() throws SQLException{ 
List<Object[]> listOfParams = new ArrayList<>(); 
String s = "こんにちは"; 
//for(ContentEntry ce:cacheOfExtractedPages){ 
try{ 
listOfParams.add(new Object []{s}); 
} 
catch(Exception e){ 
int i= 1; 

} 
//} 
return listOfParams.toArray(new Object[0][0]); 
} 

public void insertQueryRunner(){ 
String s = "こんにちは"; 
String SQL = "insert into TEST VALUES( ?)"; 
try{ 

new QueryRunner().batch(connection, SQL, getBulkWriteParams()); 
}catch(Exception e){} 
}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)