java - Turning a ResultSet into 2DArray/HashMap/Lists of Lists -
I think I have become a code-blind.
I am currently doing a small project, a friend and we are using JDBC to choose from our database.
What I need is that after running the selection statement, I get back some sort of '2D' list of all the data.
I think I want something like this - array [columnname] [all data inside selected column]
Pseudo code
// Calculate all the rows in a column / calculate the column // Add the column name to the 'array' (int i = 1; i & Lt; = columnCount; I ++) columns.add (resultSetMeta.getColumnName (i)); // Adds the result of the first column to 'array'. // How can I add results to numbers? For (int i = 1; i & lt; = rowCount; i ++) {while (resultSet.next ()) rows.add (resultSet.getString (i)); } Columns and ROs Input (columns, rows); A table - What is the most appropriate data type to use to replicate 'array list, array, or hashmaps'?
What is the best way to create ResultSet in a 2D datatype?
When repeats through a ResultSet , how can I go to the next column?
You can use the keypad to add important value, Where as the key you add your results metadata and values as values.
hashMap & lt; string, object & gt; p = new hashmop & lt; String, Object & gt; (); P.put ("ResultSetkey1", "ResultSetvalue1"); P.put ("ResultSetkey2", "ResultSetvalue2"); In addition, I want to say that resultsetUtils
Comments
Post a Comment