网络编程 | 站长之家 | 网页制作 | 图形图象 | 操作系统 | 冲浪宝典 | 软件教学 | 网络办公 | 邮件系统 | 网络安全 | 认证考试 | 系统进程
Firefox | IE | Maxthon | 迅雷 | 电驴 | BitComet | FlashGet | QQ | QQ空间 | Vista | 输入法 | Ghost | Word | Excel | wps | Powerpoint
asp | .net | php | jsp | Sql | c# | Ajax | xml | Dreamweaver | FrontPages | Javascript | css | photoshop | fireworks | Flash | Cad | Discuz!
当前位置 > 网站建设学院 > 网络编程 > 数据库 > Oracle教程
Tag:注入,存储过程,分页,安全,优化,xmlhttp,fso,jmail,application,session,防盗链,stream,无组件,组件,md5,乱码,缓存,加密,验证码,算法,cookies,ubb,正则表达式,水印,索引,日志,压缩,base64,url重写,上传,控件,Web.config,JDBC,函数,内存,PDF,迁移,结构,破解,编译,配置,进程,分词,IIS,Apache,Tomcat,phpmyadmin,Gzip,触发器,socket
数据库:数据库教程,数据库技巧,Oracle教程,MySQL教程,Sybase教程,Access教程,DB2教程,数据库安全,数据库文摘
本月文章推荐
.如何在Oracle10g中启动和关闭OEM .
.Oracle中屏蔽英文提示信息方法二.
.如何使sendmail监听在其他端口?.
.在ADO.NET中使用Oracle存储程序.
.在Redhat Enterprise server 3上.
.Linux的信号机制.
.Oracle10g数据库的4种存储形式.
.Oracle9i Data Guard的灾难防护 .
.Oracle处理多媒体信息的原理及展.
.Oracle的EXP/IMP版本支持列表.
.一个优秀的分析trace文件的脚本.
.解读Oracle11g在商业银行的三大应.
.新手学习之Oracle trunc()函数的.
.如何在Oracle中使用游标来实现多.
.如何调试oracle, sql server存储.
.如何对CLOB字段进行全文检索?.
.Oracle9i如何支持动态重配置.
.认识与分析登录档.
.使用DBMS_UTILITY转换Block地址.
.Oracle DBA 数据库结构试题选2.

Oracle操作图片

发表日期:2008-2-9


Oracle 操作图片  
BloBTest.Java
Created with JBuilderpackage testapp; import java.sql.*; import java.io.*; public class Blobtest { public Blobtest() { } public static void main (String args []) throws SQLException, IOException { //write(); read(); } static void read() throws SQLException, IOException { DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); // Connect to the database // You can put a database name after the @ sign in the connection URL. Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@ebizser:1521:serverdb", "scott", "tiger"); // It's faster when you don't commit automatically conn.setAutoCommit (false); // Create a Statement Statement stmt = conn.createStatement (); // Do a query to get the row with NAME 'StreamExample' ResultSet rset = stmt.executeQuery ("select col2 from lobtest where userid=1"); // Get the first row if (rset.next ()) { // Get the data as a Stream from Oracle to the client InputStream gif_data = rset.getBinaryStream (1); // Open a file to store the gif data FileOutputStream os = new FileOutputStream ("example.jpe"); // Loop, reading from the gif stream and writing to the file int c; while ((c = gif_data.read ()) != -1) os.write (c); // Close the file os.close (); } // Close all the resources if (rset != null) rset.close(); if (stmt != null) stmt.close(); if (conn != null) conn.close(); } static void write() throws SQLException, IOException { DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver()); // Connect to the database // You can put a database name after the @ sign in the connection URL. Connection conn = //DriverManager.getConnection ("jdbc:oracle:thin:@ebizser:1521:serverdb", "scott", "tiger"); DriverManager.getConnection ("jdbc:oracle:oci8:@ebdb", "scott", "tiger"); // It's faster when you don't commit automatically conn.setAutoCommit (false); // Create a Statement File file = new File("C:\\Documents and Settings\\gzb.ECOM\\My Documents\\My Pictures\\28-3-16933_jinxishan34s.jpe"); InputStream is = new FileInputStream ("C:\\Documents and Settings\\gzb.ECOM\\My Documents\\My Pictures\\28-3-16933_jinxishan34s.jpe"); PreparedStatement pstmt = conn.prepareStatement ("insert into lobtest (userid, col2 ) values (?, ?)"); pstmt.setBinaryStream(2, is, (int)file.length ()); pstmt.setInt (1, 2); pstmt.execute (); if (pstmt != null) pstmt.close(); if (conn != null) conn.close(); } }
Blobtest.java
Created with JBuilder
上一篇:Oracle PL/SQL语言入门 人气:748
下一篇:Oracle不同版本的客户端和服务端的兼容问题 人气:652
浏览全部Oracle教程的内容 Dreamweaver插件下载 网页广告代码 祝你圣诞节快乐 2009年新年快乐