⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lab17.txt

📁 jdbc 源代码
💻 TXT
字号:
		jdbc 试验17          ...day4
## 实验目标:
   使用oracle的empty_blob()函数,和特定的语法,将
   二进制大对象存入oracle数据库。
## 实验步骤:
   1、利用sqlplus在oracle数据库中建立如下的表:
      create table t_blob(
          id number(10) primary key,
	  filename varchar(15) not null,
	  blobData blob);
   2、编写测试类,包含main方法
   3、在main方法中适当的位置写入如下代码:
      ** con.prepareStatement(
            "insert into t_blob values(?,?,empty_blob())");
      ** con.prepareStatement(
             "select blobData from t_blob 
	               where id=? for update");
      ** Blob blob = rs.getBlob(i)
      ** InputStream in = 
               new FileInputStream(fname);
	  OutputStream out = 
	       blob.setBinaryStream(0);
      ** ps.setBlob(blob)
   4、copy 一个比较大的文件到类根目录
   5、执行该类,将大文件存入oracle

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -