• Post Reply Bookmark Topic Watch Topic
  • New Topic

Using java.sql.array

 
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?
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!