InterviewSolution
Saved Bookmarks
| 1. |
How Can I Convert A Java Array To A Java.sql.array? |
|
Answer» A Java array is a first CLASS object and all of the references basically USE PreparedStatement.setObject() or ResultSet.updateObject() methods for putting the array to an ARRAY in the database. Here's a basic EXAMPLE: String[] as = { "One", "Two", "Three" };... PreparedStatement ps = con.prepareStatement( "UPDATE MYTABLE SET ArrayNums = ? WHERE MyKey = ?" ); ... ps.setObject( 1, as ); A Java array is a first class object and all of the references basically use PreparedStatement.setObject() or ResultSet.updateObject() methods for putting the array to an ARRAY in the database. Here's a basic example: |
|