Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How could I insert a java object into a database field defined as 'BLO

Status
Not open for further replies.

TomBarns

Programmer
Feb 14, 2001
10
US
Hi All
How could I insert a java object into a database field defined as 'BLOB',please any sample code.
thanks alot.
 
Hi,

This is what you can do:-

int result = st.executeUpdate("insert into biblio (BLOB) values ('abc'));

st - an instance of Statement class
biblio - table name
BLOB - column name
'abc' - a String value inserted into the column
result - an int value representing the rows edited. 0 for none.

This code only works if the insert statement does not break any constraints for the table BLOB.

There are also other ways you can insert data into a table like using preparedstatements.

Regards,
Leon If you need additional help, you can email to me at zaoliang@hotmail.com I don't guaranty that I will be able to solve your problems but I will try my best :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top