Reputation: 8717
I'm just after a way to convert a ResultSet to string I've tried:
toReturn = result.getString(0);
I'm only after a proof that its working and thought this would be all that I need to return it via:
writer.write(toReturn);
TIA
Upvotes: 3
Views: 11362
Reputation: 14943
if toReturn is a string, then calling getString(indx) will return a string and you will get an error on that line if it was assigning a different type.
Upvotes: 0
Reputation: 403481
JDBC column indexes start at 1, not zero, so try result.getString(1)
Upvotes: 6