This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Servlets and the fly likes tomcat can not show string properly gotten from oracle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "tomcat can not show string properly gotten from oracle" Watch "tomcat can not show string properly gotten from oracle" New topic

tomcat can not show string properly gotten from oracle

feihong wu

Joined: Oct 28, 2004
Posts: 3
I implemented a java class MyTest to retrive a field in a oracle table Test.The specialty is ,the field is a nested table of varchar2(8).I used thin oracle JDBC and the program runs normally.but when I tried to call
the MyTest in a Jsp/Jservlet to show the string in the nested table,I only
got "???" printed in the screen.what's the matter?does anyone come up with
such case before?thanks a great.

some notes
a.the string is properly showed if gotten from a common varchar2(8) field of oracle table.

b.I tried the combination of class12.jar+nls_charset12.jar and
ojdbc14.jar+orai18n.jar,but without any cheerful change.

c.I tried to change the charset in the Jsp/Jservlet...her I cant say I did it in a comprehensive way.but failed too.

d.all the record in the nested table are english string.

attached with the oracle table Test and part of the code of MyTest.hopefully it's simple enough.

the table test has only one column which is a nested table of varchar(8) like
create type string_tab varchar2(8);
create table test (attr string_tab) nested table attr stored as attr_tab;

and java class mytest is like:
class mytest{
public String get(){
String ret="";
......\\connect to the database
pstmt = conn.prepareStatement(
"select attr from test");
rs = pstmt.executeQuery();
if ( {
s = ( (OracleResultSet) rs).getARRAY("attr1");
ResultSet r = s.getResultSet();
if( {
ret = r.getString(2);
\\disconnect the database
return ret;
It is sorta covered in the JavaRanch Style Guide.
subject: tomcat can not show string properly gotten from oracle
It's not a secret anymore!