Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How to store Array of Strings in MS-Access

807599Apr 16 2007 — edited Apr 17 2007
Dear all,

i am facing a problame from the couple of days can any one plzzzzzzz guide what should i do to over come my problame....>

I want to store a String array in Microsoft Access database but i couldn't find the way how can i do so

public class ArrayJDBC {
/** Creates a new instance of ArrayJDBC */
public ArrayJDBC() {
}

public static void main(String[] args){
System.out.println("main started");
new ArrayJDBC().enterArray();
System.out.println("main after data entry");
}

public void enterArray(){
Connection con = null;
PreparedStatement pstm = null;
String dataSource = "checkArray";
String query = "INSERT INTO array(Object) VALUES(?)";
String[] strArray = {"one","two","three"};


con = new JDBCConnection().makeConnection(dataSource);

try{
pstm = con.prepareStatement(query);
System.out.println("pstmt created");

pstm.setObject(1,strArray);
System.out.println("array seted as object");

int r = pstm.executeUpdate();

System.out.println("data updated "+r);

pstm.close();
con.close();
}catch(SQLException se){
System.out.println("Data could not be update "+se);
}


}

}

this is my class the conncection is already established.
i use updateObject() method but it doesnt work..

plz guide me that how can i store
strArray in Microsoft Access and also tell me that what should be the data type in my database i.e ms-access
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 15 2007
Added on Apr 16 2007
4 comments
316 views