Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Problems with CLOB in JDBC
Originally posted by Tobias Kj?R Tobiasen
> Subhashini.K wrote:
> > hi
> > y don't u use this.
> > If u have any special characters
> > u can use AsciiStream from oracle.
> > getAsciiOutputStream
> > public OutputStream getAsciiOutputStream() throws
> SQLException
> >
> > Oracle extension. Write ascii stream to the CLOB.
> Hi.
>
> I have tried this. But how do I get the correct encoding of the ascii
> stream? In the example below I have to state the encoding of the
> bytes. But
> I do not know the encoding used by the database. Is there a way
> to get the
> String encoded using the encoding of the database?
>
> OutputStream stream = clob.getAsciiOutputStream();
> stream.write(myString.getBytes(encoding));
>
> T2K
Hi Tobias
File file = new File("symbol.doc");
FileInputStream in = new FileInputStream(file);
OutputStream out = clob.getAsciiOutputStream();
out.flush();
byte[] buffer = new byte[1024];
int len;
while ((len = in.read(buffer)) != -1){
out.write(buffer, 0, length);
out.close();
in.close();
For ur encoding:
stmt.executeUpdate(new String(
("insert into test (text) values('$B4A;z(B')" ).getBytes("SJIS"),0));
I don't know much about the languages.
This encoding is for Japanese
just see this for encoding chinese
http://life.nthu.edu.tw/~b831604/freebsd/JSP/chinese.html
and
http://forum.java.sun.com/thread.jsp?thread=151469&forum=16&messa-
ge=1378087
hope this will help u.
subha
-- Posted via http://dbforums.comReceived on Mon Feb 03 2003 - 06:05:48 CST