ArrayList to Table

Cherokee Nelson

Greenhorn

Posts: 9

posted 5 months ago

I need to move my data from an ArrayList into a Table. This is specific to a derby type database. I am recieving Embedded Statements cannot be cast to java.util.collections. I cannot see any other way to get the array into the table
I have looked through the posts in the JDBC forum and I have not seen anything similar to my problem. I am new to JDBC, all of my database history strictly involves SQL. I have not noticed any code in this forum which makes me hesitant to post any. If anyone can help I would be grateful thank you

What data is in your ArrayList?
What does the code that is causing you issues look like?

If it's a List<SomeClass> where SomeClass is a representation of a row in a table, then loop over the array and do a batch insert.
If you are SELECTing from the table then build an instance of SomeClass for each row, adding it to a List.

Roel: That link is about PL-SQL, which is a different beast in so many ways. In that you would define a couple of TYPEs (one for the object, one for a table of that object) and then declare the procedure/function as taking the table TYPE.
That won't work for SQL.