# mysql insert set problem

I need some help.

set = {0, 0};
Print[set];
Needs["DatabaseLink"];
JDBCDrivers["MySQL(Connector/J)"]
conn = OpenSQLConnection[
JDBC["MySQL(Connector/J)", "localhost:3306/test"],
SQLExecute[conn, "INSERT INTO numbers VALUES ([set]) "]


I don't know know how to escape [set] in the insert statement

In the database the field type is text

-
set = {11, 2, 3}; -> i have modified as you suggested, now the problem is that only the first number 11 of the set is inserted -> SQLExecute[conn, "INSERT INTO numbers (text) VALUES (1) ", set] –  user5356 Jan 10 '13 at 21:14
i want to put the entire set in one field of the db table, not one colum -> one element of set / from doc : SQLExecute[conn, "INSERT INTO TEST (X,Y) VALUES (1, 2)", {5, 2.1}] it's my first time using mathematica –  user5356 Jan 10 '13 at 21:24

You can use this:

set = {{0, 0},{1,1},{2,2}}
SQLExecute[conn,"INSERT INTO numbers VALUES (?,?)", set]


If you want to do just one case, use:

 set = {{0, 0}}


The ? way is the fast one.

@user5356 You can handle it as a string, and use ToExpression to back it to MMA form again, like: ToExpression["{0,0}"]` you get {0,0} –  Murta Jan 10 '13 at 22:25