Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> JDBC string binding problem

JDBC string binding problem

From: Chris Ball <cab_at_@exel.co.uk>
Date: Fri, 9 Nov 2001 16:36:31 -0000
Message-ID: <9sh0p1$j90$1@reader-00.news.insnet.cw.net>


I am getting a "Character set mismatch error" when trying to insert a string into a nvarchar column on an oracle database. When inserting a literal string, the operation works, but when string binding is used, the above error is returned. The examples below illustrate this.

Anyone got any ideas?

Chris.

try {
strSQL = "select achar2 from ahm where achar1 = 'achar1 row 2'"; Statement sstmt = con.createStatement(); result = sstmt.executeQuery(strSQL);
while (result.next()) {
data = result.getString(1);
MyOutput("SELECT 1: DATA FETCHED: partnum = <" + data + ">");
}
}

catch (Exception e) {
MyOutput(e.getMessage());
System.exit(1);
}

Above fails with the following error: ORA-12704: character set mismatch

try {
strSQL = "select achar2 from ahm where achar1 = N'achar1 row 2'"; Statement sstmt = con.createStatement(); result = sstmt.executeQuery(strSQL);
while (result.next()) {
data = result.getString(1);
MyOutput("SELECT 1: DATA FETCHED: partnum = <" + data + ">");
}
}

catch (Exception e) {
MyOutput(e.getMessage());
System.exit(1);
}

Above works: Received on Fri Nov 09 2001 - 10:36:31 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US