不需要写连接数据库;
需要:写数据库的表(比如:Img表)
写实体类和实现数据插入的逻辑代码

解决方案 »

  1.   

    用fck吧
    一个clob字段接收提交的内容
    我的资源里有个飞鱼网页编辑器,下载后即可使用,LZ去看看
      

  2.   

    简单的插入和查询
    google下很多
    是插入路径吧,然后在页面引用?
      

  3.   

    同LS,使用FCK编辑器可以实现富文本的HTML代码插入,而图像还是用现成的上传组件,最好不要用数据库,太慢了。
      

  4.   

    LZ参考下吧,用流的形式插入到数据库 
     public static void main(String[] args) throws ClassNotFoundException,
                FileNotFoundException {
            PreparedStatement ps = null;
           Connection con = null;
           Class.forName("oracle.jdbc.driver.OracleDriver");
            try {
                con = DriverManager.getConnection(
                        "jdbc:oracle:thin:@172.31.168.172:1521:tiaeae",
                        "Dbatiaeae",
                        "dbaae");          
                File file=new File("C:\\Documents and Settings\\All Users\\Documents\\My Pictures\\Sample Pictures\\Blue hills.jpg");
                FileInputStream fis=new FileInputStream(file);
                ps=con.prepareStatement("insert into picture (picture)values(?)");
                int bytes=(int)file.length();
                System.out.println(bytes);
                ps.setBinaryStream(1,fis,bytes);
                ps.executeUpdate();
                fis.close();
            } catch (SQLException ex) {
                ex.printStackTrace();
            } catch (IOException ex) {
                /** @todo Handle this exception */
            } finally{
                try {
                    con.close();
                } catch (SQLException ex1) {
                   ex1.printStackTrace();
                }
             
            }    }