> Hi,
>
[quoted text clipped - 7 lines]
> while (rs.next()){
> System.out.println(rs.getString(1));
Use rs.getObject(1) instead.
HTH A.G.
Thijs David - 10 Dec 2003 18:18 GMT
rs.getObject(1) , doesn't work either :o((
David
> > Hi,
> >
[quoted text clipped - 11 lines]
>
> HTH A.G.
> Hi,
>
> I'm having a strange problem, each time I want to go through a
> ResultSet by using :
Hi. There's nothing wrong with your JDBC code. The exception
is a problem between the jdbc driver and DBMS, and it seems
to do with the character set the client expects, and the character
set in the DBMS. Check your driver, DBMS and JVM information
about the character set in effect.
Joe Weinstein at BEA
> query = "select * from TBL_test_ulrik";
> try{
[quoted text clipped - 40 lines]
>
> David
Thijs David - 10 Dec 2003 18:17 GMT
Hi,
Thx for the advice, but I still am questioning myself, why it works with one
table (with exactly the same column types) and not with the other one ???
David
> > Hi,
> >
[quoted text clipped - 52 lines]
> >
> > David
Joe Weinstein - 10 Dec 2003 18:38 GMT
> Hi,
>
> Thx for the advice, but I still am questioning myself, why it works with one
> table (with exactly the same column types) and not with the other one ???
>
> David
Actually, Andree may have an important point. If the DBMS's table has
data that is not appropriately converted to a String, then your getString()
call is the problem. DOing getObject() and processing the object according
to it's type should always put the problem/control into your hands.
Joe
>>>Hi,
>>>
[quoted text clipped - 52 lines]
>>>
>>>David
Thijs David - 10 Dec 2003 18:27 GMT
Hi,
It's even so that I can call three columns out of 4 without any kind of a
problem these three columns are all of type integer in the DBMS.
The fourth column is of type varchar(150) and gives me all the problems,
allthough another column in another table with exactly the same type doesn't
pose any problems.
David
> > Hi,
> >
[quoted text clipped - 52 lines]
> >
> > David
Joe Weinstein - 10 Dec 2003 18:41 GMT
> Hi,
>
[quoted text clipped - 3 lines]
> allthough another column in another table with exactly the same type doesn't
> pose any problems.
Ok. Varchar columns should certainly be retrievable by getString(),
so the issue is the characters stored, and the DBMS/driver failing
to convert those particular varchars to a string using the character set
of the client JVM. getObject() would typically know the data were varchars,
so it would typically create a String as the Object to return, so the
problem would not be avoided that way.
Try getBytes() and see what the JVM does when trying to create
a string from the raw bytes.
Joe Weinstein at BEA
>>>Hi,
>>>
[quoted text clipped - 52 lines]
>>>
>>>David
Thijs David - 10 Dec 2003 18:42 GMT
Hi Joe,
Thx for your tip...
Andree probably has a good tip also, and I'm going to apply the getObject()
so that afterwards I'll be converting it into the exact type (more control
on my hand indeed).
Your tip concerning different about different charactersets made me wonder,
so I began testing different charactersets in the DBMS and actually,
UNICODE-FSS seems to work fine for the moment, hopefully it stays that
way...
Anyway, thx a lot...
David
> > Hi,
> >
[quoted text clipped - 52 lines]
> >
> > David
Attention: the exception is throwed while we using the next()-method not using the getXXX()-method.
You can specify the column's character sets, such as GBK or GB2312 if you will store Chinese characters in this column, instead of NONE.
So you should re-create your database as the alter sql command do not support to change the character sets.