Hi! I´m trying to get an array into a db and later on retrieving it.
I´m not sure if serialization is the way to go since I dont know how to do the first one.
************************************************** *****************************************
public void storeMemDB(String state, String cEmail, String cSms) {
try {
Class.forName("com.mysql.jdbc.Driver"); // använder denna databas anslutning
Connection con = DriverManager.getConnection(
"jdbc:mysql://localhost:3306/blabla",
"root", "blabla");
Statement s = con.createStatement();
String sql = "INSERT INTO member (memFname,memSname,memUname,memPass," +
"memEmail,memLocality,memGym,memCell,memWeight,mem Pulse,memFysic,wayOfContact)" +
"VALUES ('" +
this.fnamn + "','" +
this.enamn + "','" +
this.anamn + "','" +
this.losen + "','" +
this.email + "','" +
this.ort + "','" +
this.gym + "','" +
this.nummer + "','" +
this.vikt.add(getWeight()) + "','" +
this.puls.add(getHeartrate()) + "','" +
state + "','" +
this.contact.add(cEmail + cSms) + "')" ;
s.executeUpdate(sql);
}catch (ClassNotFoundException e1) {
System.out.println(e1.toString());
} catch (SQLException e2) {
System.out.println(e2.toString());
} catch (Exception e3) {
// Andra avbrott
System.out.println(e3.toString());
}
}
************************************************** ************************************
How should the db look like? Is it a blob , a varchar...? what?
I´m new to this and would preciate any help what so ever.
TANX a lot.
/Racoon.