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 -> Re: JDBC string binding problem

Re: JDBC string binding problem

From: Oracle Geek <ora82_at_oracle.co.uk>
Date: Tue, 13 Nov 2001 16:16:14 -0000
Message-ID: <9srh34$nqo$1@reader-00.news.insnet.cw.net>


I cant believe that no one can help this poor lad. Someone must know something, surely...

"Chris Ball" <cab@@exel.co.uk> wrote in message news:9sh0p1$j90$1_at_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 Tue Nov 13 2001 - 10:16:14 CST

Original text of this message

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