Hi guys,
i'm a question for you.
My jsf application receive in input a file,store it into an array of
byte and put it into a table tbl of a mysql db.
The table has 2 field
Nome=Int autoincrement
Data=LongBlob
When i use
Connection db=dbs.getConnection();
PreparedStatement pst = db.prepareStatement("INSERT INTO tbl(Nome,Data)
VALUES (?,?)");
pst.setInt(1,*); what have i to put for *???????????
pst.setBytes(2, data);
pst.executeUpdate();
pst.close();
I read from teory i have to pass null for autoincremented value but my
compiler expects an it for setInt(Int,Int).
How can i do?
Thanks...
Dag Sunde - 03 Jul 2006 12:21 GMT
> Hi guys,
> i'm a question for you.
[quoted text clipped - 18 lines]
> compiler expects an it for setInt(Int,Int).
> How can i do?
You ignore the autoinc column in code when inserting.
You have already told the db to handle that.
Change the above to something like:
Connection db=dbs.getConnection();
PreparedStatement pst = db.prepareStatement("INSERT INTO
tbl(Data) VALUES (?)");
pst.setBytes(1, data);
pst.executeUpdate();
pst.close();

Signature
Dag.
gbattine - 03 Jul 2006 12:30 GMT
Thanks very much Dag....
i've resolved my problem thanks to you....