使用oracle数据库和java语言,实现在数据库中插入图像和文档? 不需要写连接数据库;需要:写数据库的表(比如:Img表)写实体类和实现数据插入的逻辑代码 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用fck吧一个clob字段接收提交的内容我的资源里有个飞鱼网页编辑器,下载后即可使用,LZ去看看 简单的插入和查询google下很多是插入路径吧,然后在页面引用? 同LS,使用FCK编辑器可以实现富文本的HTML代码插入,而图像还是用现成的上传组件,最好不要用数据库,太慢了。 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(); } } } 请教一个关于SESSION的问题 帮忙看看代码是否正确啊 点登录按钮没反应 把网站设为信任站点就能登录 不知道咋回事 谢谢啊 解决问题,50分奖励!!! 获取表单的list structs中<br>问题! 关于文件下载问题.判断文件是否存在后想弹出对话框且还是在该下载页面 关于STRUTS在TOMCAT上部署调试的小问题 简单字符串子串问题——马上结分 100分求一个将很大的String插入Oracle Clob的例子!具体见内 谁有JPad Pro4.3注册码? ssh项目中,hibernate多对一更新操作失败 为什么用DatabaseMetaData获取mysql备注信息 不会成功??
一个clob字段接收提交的内容
我的资源里有个飞鱼网页编辑器,下载后即可使用,LZ去看看
google下很多
是插入路径吧,然后在页面引用?
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();
}
} }