AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Oracle - 2D Array of integers

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases
View previous topic :: View next topic  
Author Message
Manuel DESLIS
Guest





PostPosted: Wed Nov 10, 2004 11:08 am    Post subject: Oracle - 2D Array of integers Reply with quote



Hi there

I try to store in a table (Oracle 9i) a matrix of integers, ie a 2D
array of integers.

And I can't make it work.

Here si my code :

// I have already done this on my data base :
// CREATE TYPE VECTOR AS VARRAY(10) OF NUMBER(10, 0)
// CREATE TYPE MATRIX AS VARRAY(10) OF VECTOR

// create 2 descriptors : vector and matrix
ArrayDescriptor descVector =
ArrayDescriptor.createDescriptor("VECTOR", connection);
ArrayDescriptor descMatrix =
ArrayDescriptor.createDescriptor("MATRIX", connection);

// create matrix
double[] line1 = {15, 25, 35};
ARRAY arrayLine1 = new ARRAY(descVector, connection, line1);
double[] line2 = {17, 27, 37};
ARRAY arrayLine2 = new ARRAY(descVector, connection, line2);
Object matrix[] = {arrayLine1, arrayLine2};
ARRAY arrayMatrix = new ARRAY(descMatrix, connection, matrix);

// insert the matrix
PreparedStatement ps = connection.prepareStatement("INSERT INTO
MY_TABLE VALUES (?)");
((OraclePreparedStatement) ps).setARRAY(1, arrayMatrix);
ps.execute();


Unfortunately, this doesn't work.
Anyone has a better idea ?

Thanks for your help, bye.

Manuel Deslis
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java and Databases All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.