Package Com.basicsql.scroll_page;import Java.io.file;import Java.io.fileinputstream;import Java.io.filenotfoundexception;import Java.io.fileoutputstream;import Java.io.ioexception;import Java.io.inputstream;import Java.sql.connection;import Java.sql.preparedstatement;import Java.sql.ResultSet;import Java.sql.sqlexception;import Com.basicsql.connutil.conndb;public class Savepic {public static Connection conn = null; public static PreparedStatement pstmt = null;/** * Add a file such as a picture in the database */public static void Insertpic () {String sql = "INSERT INTO Teacher (Id,name,photo) VALUES (Teacher_seq.nextval,?,?) "; try {conn = conndb.connoracle ();p stmt = conn.preparestatement (sql);p stmt.setstring (1, "Signma");//Database Insert Picture/word/ Excel, etc. file F = new file ("Src/pic.jpg"); FileInputStream fis = new FileInputStream (f);p Stmt.setbinarystream (2, FIS, (int) f.length ()); int n = pstmt.executeupdate (); SYSTEM.OUT.PRINTLN (n + "entry record Insert");} catch (SQLException e) {e.printstacktrace ();} catch (FileNotFoundException e) {E.printstacktracE ();} finally {conndb.pstmtclose (pstmt); CONNDB.CLOSECONN (conn);}} /** * Remove files from database */public static void Getpic () {String sql = "Select Id,name,photo from teacher where id=?"; try {conn = conndb.connoracle ();p stmt = conn.preparestatement (sql);p Stmt.setint (1, 2); ResultSet rs = Pstmt.executequery (), if (Rs.next ()) {FileOutputStream fos = new FileOutputStream (New File ("abc.jpg")); Nputstream is = Rs.getbinarystream ("photo"); byte[] buffer = new BYTE[4 * 1024];int length = 0;while ((length = Is.read (buf FER))! =-1) {fos.write (buffer, 0, length);} Fos.flush (); Fos.close (); Is.close ();}} catch (SQLException e) {e.printstacktrace ();} catch (FileNotFoundException e) {e.printstacktrace ();} catch (IOException e) {e.printstacktrace ();} finally {conndb.pstmtclose (pstmt); CONNDB.CLOSECONN (conn);}}}