Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ResultSet to String java?

Tags:

java

jdbc

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

like image 426
James MV Avatar asked Jun 28 '26 07:06

James MV


1 Answers

JDBC column indexes start at 1, not zero, so try result.getString(1)

like image 83
skaffman Avatar answered Jun 29 '26 20:06

skaffman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!