Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Using java.sql.array  RSS feed

 
Anita Raj
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need help about working with arrays in an access database.
1) How do you use array in create table statement?

stmt.executeUpdate("CREATE TABLE tblA (ID INT PRIMARY KEY, Var2 INT, Var3 VARCHAR(50), ???)");
//I want Var4 to be an array
2) How do you insert values into Var4, which is initially an empty array?
3) Retrieving an array. Is this correct?
ResultSet rs = stmt.executeQuery(
"SELECT Var4 FROM tblA WHERE ID = 200");
rs.next();
Array arrVar4 = rs.getArray("Var4");
4) How do you update Var4 using updateArray?
 
SJ Adnams
Ranch Hand
Posts: 925
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In Oracle you do it like this:
ArrayDescriptor desc = ArrayDescriptor.createDescriptor("<array name>", connection);
ARRAY newArray = new ARRAY(...);
Don't know if it applies to access?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!