 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
David Thijs Guest
|
Posted: Wed Dec 10, 2003 8:12 am Post subject: SQLException while using next()-method in scrolling a Result |
|
|
Hi,
I'm having a strange problem, each time I want to go through a
ResultSet by using :
query = "select * from TBL_test_ulrik";
try{
rs = s.executeQuery(query);
int i=0;
while (rs.next()){
System.out.println(rs.getString(1));
}
}
catch (SQLException se){
se.printStackTrace();
}
I get the following error-message
java.sql.SQLException: [interclient][interbase]arithmetic exception,
numeric overflow, or string truncation
[interclient][interbase]Cannot transliterate character between
character sets
at interbase.interclient.ResultSet.remote_FETCH_ROWS(Unknown Source)
at interbase.interclient.ResultSet.getNextCursorPosition(Unknown
Source)
at interbase.interclient.ResultSet.next(Unknown Source)
at tree_db.DBConnection_Tris.roepWaardenOp(DBConnection_Tris.java:93)
at tree_db.ReadTextFile_Tris.zoekinDB(ReadTextFile_Tris.java:155)
at tree_db.ReadTextFile_Tris.maakKeuze(ReadTextFile_Tris.java:33)
at tree_db.ReadTextFile_Tris.<init>(ReadTextFile_Tris.java:14)
at tree_db.ReadTextFile_Tris.main(ReadTextFile_Tris.java:159)
What is strange is that the same structure for executing another query
on another table doesn't give me this error-message.
Is there someone who can help me ??
Greetings,
David
|
|
| Back to top |
|
 |
Andree Große Guest
|
Posted: Wed Dec 10, 2003 4:24 pm Post subject: Re: SQLException while using next()-method in scrolling a Re |
|
|
David Thijs wrote:
| Quote: | Hi,
I'm having a strange problem, each time I want to go through a
ResultSet by using :
query = "select * from TBL_test_ulrik";
try{
rs = s.executeQuery(query);
int i=0;
while (rs.next()){
System.out.println(rs.getString(1));
|
Use rs.getObject(1) instead.
HTH A.G.
|
|
| Back to top |
|
 |
Joe Weinstein Guest
|
Posted: Wed Dec 10, 2003 4:25 pm Post subject: Re: SQLException while using next()-method in scrolling a Re |
|
|
David Thijs wrote:
| Quote: | 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
| Quote: |
query = "select * from TBL_test_ulrik";
try{
rs = s.executeQuery(query);
int i=0;
while (rs.next()){
System.out.println(rs.getString(1));
}
}
catch (SQLException se){
se.printStackTrace();
}
I get the following error-message
java.sql.SQLException: [interclient][interbase]arithmetic exception,
numeric overflow, or string truncation
[interclient][interbase]Cannot transliterate character between
character sets
at interbase.interclient.ResultSet.remote_FETCH_ROWS(Unknown Source)
at interbase.interclient.ResultSet.getNextCursorPosition(Unknown
Source)
at interbase.interclient.ResultSet.next(Unknown Source)
at tree_db.DBConnection_Tris.roepWaardenOp(DBConnection_Tris.java:93)
at tree_db.ReadTextFile_Tris.zoekinDB(ReadTextFile_Tris.java:155)
at tree_db.ReadTextFile_Tris.maakKeuze(ReadTextFile_Tris.java:33)
at tree_db.ReadTextFile_Tris.<init>(ReadTextFile_Tris.java:14)
at tree_db.ReadTextFile_Tris.main(ReadTextFile_Tris.java:159)
What is strange is that the same structure for executing another query
on another table doesn't give me this error-message.
Is there someone who can help me ??
Greetings,
David
|
|
|
| Back to top |
|
 |
Thijs David Guest
|
Posted: Wed Dec 10, 2003 6:17 pm Post subject: Re: SQLException while using next()-method in scrolling a Re |
|
|
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
"Joe Weinstein" <joeNOSPAM (AT) bea (DOT) com> wrote
| Quote: |
David Thijs wrote:
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{
rs = s.executeQuery(query);
int i=0;
while (rs.next()){
System.out.println(rs.getString(1));
}
}
catch (SQLException se){
se.printStackTrace();
}
I get the following error-message
java.sql.SQLException: [interclient][interbase]arithmetic exception,
numeric overflow, or string truncation
[interclient][interbase]Cannot transliterate character between
character sets
at interbase.interclient.ResultSet.remote_FETCH_ROWS(Unknown Source)
at interbase.interclient.ResultSet.getNextCursorPosition(Unknown
Source)
at interbase.interclient.ResultSet.next(Unknown Source)
at tree_db.DBConnection_Tris.roepWaardenOp(DBConnection_Tris.java:93)
at tree_db.ReadTextFile_Tris.zoekinDB(ReadTextFile_Tris.java:155)
at tree_db.ReadTextFile_Tris.maakKeuze(ReadTextFile_Tris.java:33)
at tree_db.ReadTextFile_Tris.<init>(ReadTextFile_Tris.java:14)
at tree_db.ReadTextFile_Tris.main(ReadTextFile_Tris.java:159)
What is strange is that the same structure for executing another query
on another table doesn't give me this error-message.
Is there someone who can help me ??
Greetings,
David
|
|
|
| Back to top |
|
 |
Thijs David Guest
|
Posted: Wed Dec 10, 2003 6:18 pm Post subject: Re: SQLException while using next()-method in scrolling a Re |
|
|
rs.getObject(1) , doesn't work either ((
David
"Andree Große" <A.Grosse2 (AT) deutschepost (DOT) de> wrote
| Quote: | David Thijs wrote:
Hi,
I'm having a strange problem, each time I want to go through a
ResultSet by using :
query = "select * from TBL_test_ulrik";
try{
rs = s.executeQuery(query);
int i=0;
while (rs.next()){
System.out.println(rs.getString(1));
Use rs.getObject(1) instead.
HTH A.G.
|
|
|
| Back to top |
|
 |
Thijs David Guest
|
Posted: Wed Dec 10, 2003 6:27 pm Post subject: Re: SQLException while using next()-method in scrolling a Re |
|
|
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
"Joe Weinstein" <joeNOSPAM (AT) bea (DOT) com> wrote
| Quote: |
David Thijs wrote:
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{
rs = s.executeQuery(query);
int i=0;
while (rs.next()){
System.out.println(rs.getString(1));
}
}
catch (SQLException se){
se.printStackTrace();
}
I get the following error-message
java.sql.SQLException: [interclient][interbase]arithmetic exception,
numeric overflow, or string truncation
[interclient][interbase]Cannot transliterate character between
character sets
at interbase.interclient.ResultSet.remote_FETCH_ROWS(Unknown Source)
at interbase.interclient.ResultSet.getNextCursorPosition(Unknown
Source)
at interbase.interclient.ResultSet.next(Unknown Source)
at tree_db.DBConnection_Tris.roepWaardenOp(DBConnection_Tris.java:93)
at tree_db.ReadTextFile_Tris.zoekinDB(ReadTextFile_Tris.java:155)
at tree_db.ReadTextFile_Tris.maakKeuze(ReadTextFile_Tris.java:33)
at tree_db.ReadTextFile_Tris.<init>(ReadTextFile_Tris.java:14)
at tree_db.ReadTextFile_Tris.main(ReadTextFile_Tris.java:159)
What is strange is that the same structure for executing another query
on another table doesn't give me this error-message.
Is there someone who can help me ??
Greetings,
David
|
|
|
| Back to top |
|
 |
Joe Weinstein Guest
|
Posted: Wed Dec 10, 2003 6:38 pm Post subject: Re: SQLException while using next()-method in scrolling a Re |
|
|
Thijs David wrote:
| Quote: | 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
| Quote: |
"Joe Weinstein" <joeNOSPAM (AT) bea (DOT) com> wrote in message
news:3FD748EC.4080307 (AT) bea (DOT) com...
David Thijs wrote:
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{
rs = s.executeQuery(query);
int i=0;
while (rs.next()){
System.out.println(rs.getString(1));
}
}
catch (SQLException se){
se.printStackTrace();
}
I get the following error-message
java.sql.SQLException: [interclient][interbase]arithmetic exception,
numeric overflow, or string truncation
[interclient][interbase]Cannot transliterate character between
character sets
at interbase.interclient.ResultSet.remote_FETCH_ROWS(Unknown Source)
at interbase.interclient.ResultSet.getNextCursorPosition(Unknown
Source)
at interbase.interclient.ResultSet.next(Unknown Source)
at tree_db.DBConnection_Tris.roepWaardenOp(DBConnection_Tris.java:93)
at tree_db.ReadTextFile_Tris.zoekinDB(ReadTextFile_Tris.java:155)
at tree_db.ReadTextFile_Tris.maakKeuze(ReadTextFile_Tris.java:33)
at tree_db.ReadTextFile_Tris.<init>(ReadTextFile_Tris.java:14)
at tree_db.ReadTextFile_Tris.main(ReadTextFile_Tris.java:159)
What is strange is that the same structure for executing another query
on another table doesn't give me this error-message.
Is there someone who can help me ??
Greetings,
David
|
|
|
| Back to top |
|
 |
Joe Weinstein Guest
|
Posted: Wed Dec 10, 2003 6:41 pm Post subject: Re: SQLException while using next()-method in scrolling a Re |
|
|
Thijs David wrote:
| Quote: | 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.
|
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
| Quote: |
"Joe Weinstein" <joeNOSPAM (AT) bea (DOT) com> wrote in message
news:3FD748EC.4080307 (AT) bea (DOT) com...
David Thijs wrote:
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{
rs = s.executeQuery(query);
int i=0;
while (rs.next()){
System.out.println(rs.getString(1));
}
}
catch (SQLException se){
se.printStackTrace();
}
I get the following error-message
java.sql.SQLException: [interclient][interbase]arithmetic exception,
numeric overflow, or string truncation
[interclient][interbase]Cannot transliterate character between
character sets
at interbase.interclient.ResultSet.remote_FETCH_ROWS(Unknown Source)
at interbase.interclient.ResultSet.getNextCursorPosition(Unknown
Source)
at interbase.interclient.ResultSet.next(Unknown Source)
at tree_db.DBConnection_Tris.roepWaardenOp(DBConnection_Tris.java:93)
at tree_db.ReadTextFile_Tris.zoekinDB(ReadTextFile_Tris.java:155)
at tree_db.ReadTextFile_Tris.maakKeuze(ReadTextFile_Tris.java:33)
at tree_db.ReadTextFile_Tris.<init>(ReadTextFile_Tris.java:14)
at tree_db.ReadTextFile_Tris.main(ReadTextFile_Tris.java:159)
What is strange is that the same structure for executing another query
on another table doesn't give me this error-message.
Is there someone who can help me ??
Greetings,
David
|
|
|
| Back to top |
|
 |
Thijs David Guest
|
Posted: Wed Dec 10, 2003 6:42 pm Post subject: Re: SQLException while using next()-method in scrolling a Re |
|
|
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
"Joe Weinstein" <joeNOSPAM (AT) bea (DOT) com> wrote
| Quote: |
David Thijs wrote:
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{
rs = s.executeQuery(query);
int i=0;
while (rs.next()){
System.out.println(rs.getString(1));
}
}
catch (SQLException se){
se.printStackTrace();
}
I get the following error-message
java.sql.SQLException: [interclient][interbase]arithmetic exception,
numeric overflow, or string truncation
[interclient][interbase]Cannot transliterate character between
character sets
at interbase.interclient.ResultSet.remote_FETCH_ROWS(Unknown Source)
at interbase.interclient.ResultSet.getNextCursorPosition(Unknown
Source)
at interbase.interclient.ResultSet.next(Unknown Source)
at tree_db.DBConnection_Tris.roepWaardenOp(DBConnection_Tris.java:93)
at tree_db.ReadTextFile_Tris.zoekinDB(ReadTextFile_Tris.java:155)
at tree_db.ReadTextFile_Tris.maakKeuze(ReadTextFile_Tris.java:33)
at tree_db.ReadTextFile_Tris.<init>(ReadTextFile_Tris.java:14)
at tree_db.ReadTextFile_Tris.main(ReadTextFile_Tris.java:159)
What is strange is that the same structure for executing another query
on another table doesn't give me this error-message.
Is there someone who can help me ??
Greetings,
David
|
|
|
| Back to top |
|
 |
redv Guest
|
Posted: Sat Feb 14, 2004 12:22 pm Post subject: Re: SQLException while using next()-method in scrolling a Re |
|
|
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.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|