This topic has been archived. It cannot be replied.
-
工作学习 / IT技术讨论 / a jdbc problem
-netman(NetMan);
2000-11-1
{1470}
(#12763@0)
-
sorry, the definetion of "int i=0" should out of while()'s body. It seemed the while() is continued, but I still can't get correct data.
-netman(NetMan);
2000-11-1
(#12765@0)
-
By the way, why do you introduce index i? you are mixing a for-loop with a while-loop. Not good...
-jabber(jabber);
2000-11-1
(#12783@0)
-
I can't get the correct result, and I want to see how the while() goes, so I intruduce int i.
-netman(NetMan);
2000-11-1
(#12789@0)
-
Let us try to pin down the problem
-jabber(jabber);
2000-11-1
{518}
(#12780@0)
-
Actually,I've put some data into the table...Jabber,thank you for your care.
I've put two rows of data into the table, but the program never show me them, and the value of rSet.next() seems never to be false, so I got the endless while loop like this:
The age is: 0
The name is:
>>>>>>> 0
The age is: 0
The name is:
>>>>>>> 1
The age is: 0
The name is:
>>>>>>> 2
The age is: 0
The name is:
>>>>>>> 3
........
-netman(NetMan);
2000-11-1
{380}
(#12786@0)
-
A few suggestions1) Check if ResultSet is null;
2) get ResultMetaData
3) Analyse this ResultMetaData to see the strcture
I know you have been annoyed by this thing, but we are supposed to handle such things. This is the reason we are paid. :-):
-jabber(jabber);
2000-11-1
{235}
(#12810@0)
-
My program has no problemJabber, I changed the databae to Ms sql server, the program worked very well !
Now I doubt the problem is the translation of chinese and english in java's database driver . My machine is chinese WinNt+jdk1.2+chinese db2 5.0 client. In my program, I connect to an English db2 server in an AIX machine. I know javac has an option "encoding ..." , is it used to change language ?
-netman(NetMan);
2000-11-2
{383}
(#12865@0)
-
Actually, I talked my colleage for your code and he said your code is OK.Sorry, I have not yet used "encoding" option. Since you are a veteran, I just need simply mention the following fact: Go to sun's site and browse JDK specification, you will know what "encoding" means.
-jabber(jabber);
2000-11-2
{207}
(#12916@0)
-
I'm not a veteran ,but a novice in java field.惭愧惭愧, thanks Jabber. :)
-netman(NetMan);
2000-11-3
(#13006@0)