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

how to solve java.lang.NoSuchFieldError: RETURN_NULL_AND_BLANK in java

here ssa_msg_daily contains blank or null values in the table,so while compiling i am getting error as Exception in thread “main” java.lang.NoSuchFieldError: RETURN_NULL_AND_BLANK occurs @ XSSFWorkbook workbook = new XSSFWorkbook(); how can i handle this situation and i am using the resultset to convert to spreedsheet using apache poi Answer You’ve got a classpath issue. You have a mix of

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 identical (502332262), and

Get a BigInteger attribute from Cassandra ResultSet

I’m trying to get the number of key value pairs in a Cassandra column family. Following is the code I used. But when I ran this code, I’m getting following exception. According to datastax documentation ( getVarint should return a BigInteger. So why I am getting a exception here? What an I doing wrong? Answer You can get value as

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 when the field value

Oracle doesn’t remove cursors after closing result set

Note: we reuse single connection. Answer The init.ora parameter open_cursors defines the maximum of opened cursors a session can have at once. It has a default value of 50. If the application exceeds this number the error “ORA-01000: maximum open cursors exceeded” is raised. Therefore it’s mandatory to close the JDBC resources when they are not needed any longer, in