Skip to content

Tag: resultset

Save a Resultset to an Array in java

I want to save the result of a whole Mysql table in an array it returns this to me from the database run: brandon Brandon Julio Daniel BUILD SUCCESSFUL (total time: 1 second) I want to save what is in the database in an array to be able to implement it with a sort and search method that’s why I

ResultSet to HashMap

I am trying to pass the output of a ResultSet to Java HashMap. While the Output1 is showing all the records(from the DB). The put command only takes the last value from the ResultSet in. Output1: Output2: How do I make the put command to iterate over the results from the ResultSet? Answer All your IDs are ide…

Checking for a null int value from a Java ResultSet

In Java I’m trying to test for a null value, from a ResultSet, where the column is being cast to a primitive int type. From the code fragment above, is there a better way to do this, and I assume that the second wasNull() test is redundant? Educate us, and Thanks Answer The default for ResultSet.getInt …