Import Java. SQL. *; import Java. io. *; public class insertimg {public static void main (string ARGs []) {try {class. forname ("Sun. JDBC. ODBC. jdbcodbcdriver "); connection con = drivermanager. getconnection ("JDBC: ODBC: dbimg"); string SQL = "insert into dbimg (image) values (?) "; Preparedstatement pstmt = con. preparestatement (SQL); fileinputstream Fi = new fileinputstream (". /room.jpg "); pstmt. setbinarystream (1, Fi, Fi. available (); pstmt.exe cute (); FI. close (); pstmt. close (); con. close ();} catch (exception e) {system. out. println (E. getmessage () ;}}output the image to the File Import Java. io. *; import Java. SQL. *; public class imgread {public static void main (string ARGs []) {try {class. forname ("Com. microsoft. JDBC. sqlserver. sqlserverdriver "); string url =" JDBC: Microsoft: SQL SERVER: // billgates: 1433 "; connection Cn = drivermanager. getconnection (URL, "sa", "8310"); statement ST = cn. createstatement (); string STR = "select IMG from test where id = 1"; resultset rs1_st.exe cutequery (STR); RS. next (); inputstream in = Rs. getbinarystream (1); fileoutputstream file = new fileoutputstream (". /88.mp3 "); byte C [] = New byte [1024]; int r = 0; while (r = in. Read (c ))! =-1) {file. write (C, 0, R);} file. close (); In. close ();} catch (exception e) {e. printstacktrace () ;}} outputs the image to the jlabel control import Java. AWT. *; import Java. applet. *; import Java. AWT. image. bufferedimage; import com.sun.image.codec.jpeg. *; import javax. swing. *; import Java. SQL. *; import Java. io. *; public class displayimg {public displayimg () {image IMG = NULL; try {class. forname ("Sun. JDBC. ODBC. jdbcodbcdriver "); connection con = drivermanager. getconnection ("JDBC: ODBC: dbimg"); statement stmt = con. createstatement (); string SQL = "select image from dbimg"; resultset rs1_stmt.exe cutequery (SQL); RS. next (); inputstream in = Rs. getbinarystream (1); required imagedecoder decoder = required codec. createjpegdecoder (in); IMG = decoder. decodeasbufferedimage (); RS. close (); con. close ();} catch (exception e) {system. out. println (E. getmessage ();} jframe F = new jframe (); jlabel label = new jlabel (); imageicon icon = new imageicon (IMG); label. seticon (icon); jscrollpane JSP = new jscrollpane (Label); Container content = f. getcontentpane (); content. add (JSP); F. setsize (535,400); F. setvisible (true);} public static void main (string ARGs []) {displayimg di = new displayimg () ;}} the driver of the above program database is inconsistent. Modify it by yourself. select the "image" type for the fields to store images in sqlserver.