Cannot insert String[] objects in PreparedStatements !!!
Hello guys,
I'm using PostgreSQL 7.0.3 for a website project.
I've got a table in the website database system which has a integer array type,
e.g.
create table preferences(
user_id integer references user,
music varchar(20)[5],
magazines varchar(20)[5],
channel varchar(10)[3]
)
I've also got an javabean which holds the use preferences object
publicclass userPref{
private String[] music;
private String[] magazines;
private String[] channel;
privateint userId;
// a constructor which uses reflection
public userPref(HttpServletRequest request){
...
}
}
know i would like to be able to insert some values in that
table using java.sql library.
i've got
Connection con = broker.getConnection();// the connection pool releases one connection
PreparedStatement ps = con.prepareStatement;
ps.setInt(1,user.getId());
...
But for the rest of the fields, what should I use ?
I saw that there was setArray method in the PreparedStatement that uses java.sql.Array Class
Is it the method that I've got to use. If so, do I need to implement it ?
Please help me,
touco

