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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle Clob and characters from 0x80-0xa0 (128-160)

Re: Oracle Clob and characters from 0x80-0xa0 (128-160)

From: Ilia <nospam_at_deathtospam.com>
Date: Mon, 14 Jul 2003 20:33:27 GMT
Message-ID: <rsEQa.113224$8B.96592@twister.nyroc.rr.com>


  int num = stmt.executeUpdate("delete from test");

  // t.in contains 256 characters 0x00-0xff, -Dfile.encoding=ISO-8859-1 ensures that we use ISO-8859-1
  String chars = Misc.getFileAsString("c:/tmp/t.in");

  // table test contains two columns, first is varchar2 (256), second is a CLOB
  pstmt = dbconn.prepareStatement("insert into test values (?,?)");

  pstmt.setString(1, chars.substring(128, 1));
  pstmt.setString(2, chars.substring(128, 1));
  pstmt.executeUpdate();

  ResultSet rset = stmt.executeQuery("select * from test");

  rset.next();
  String newchars = rset.getString(1);
  Clob newcharsclob = rset.getClob(2);
  String newchars2 = newcharsclob.getSubString(1, (int)newcharsclob.length());

  close(dbconn);

  System.out.println(newchars);
  System.out.println(newchars2);

The first displays Euro, the second displays ?

When I look at the data with Toad, database contains Euro in both fields, so I am guessing it's JDBC. I assume Toad uses some other database interface.

"bung ho" <bung_ho_at_hotmail.com> wrote in message news:567a1b1.0307141043.4186097a_at_posting.google.com...
> woops. i don't know why it doesn't work for you then, it prints out
> the euro for me fine (and i have almost the exact same setup as you).
> maybe you should post your code (the CLOB insert as well as the
> retrieval and print statements)
>
> the fact that it's only 0x80-0x9f still makes me think it has
> something to do with Cp1252 vs. ISO-8859-1.
>
>
>
> "Ilia" <nospam_at_deathtospam.com> wrote in message
news:<zsDPa.101359$8B.52664_at_twister.nyroc.rr.com>...
> > Thank you for your interest, here is more info:
> >
> > I run java program on Windows XP professional, JVM 1.3.1 with
> > a -Dfile.encoding=ISO-8859-1 JVM parameter. Oracle server is running
under
> > Linux 7.3.
> >
> > With this parameter, code
> >
> > char c = 0x80
> > System.out.println(c);
> >
> > prints out a Euro symbol.
> >
> > You are right and the range is 0x80-0x9f.
> >
Received on Mon Jul 14 2003 - 15:33:27 CDT

Original text of this message

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