(急得要命!)oracle数据库表中某一LONG字段内容是word类型的文档(ole形式嵌入),如何取出该字段内嵌的word文档内容? 写过jdbc操作BLOB和VB操作LONG RAW,却没试过用jdbc操作long raw类型,但我想用resultSet.getBinaryStream()获取Stream然后送到一个file类型应该没有太大的问题。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 long raw ?? long ??long是按照ascii形式存的 long raw ?? long ??long是按照ascii形式存的 这是客户端程序的事,与oracle无关 我随意试了一下,用getBytes()能返回long raw中的内容:import java.sql.*;import java.io.*;import connections.*;public class Class4 { public static void main(String[] args) { Connection conn; Statement stmt; ResultSet rs; String sql; byte[] sample; sql = "Select * from ts"; try { conn = ConnectionFactory.getConnection(); stmt = conn.createStatement(); rs = stmt.executeQuery(sql); if (rs.next()) { System.out.println("Output:"); sample = rs.getBytes("sample"); System.out.println((sample.length)); } } catch (Exception e) { e.printStackTrace(); }/* finally { if (rs!=null) { ConnectionFactory.close(rs); } ConnectionFactory.close(stmt); ConnectionFactory.close(conn); }*/ }}//connections.ConnectionFactory是我自己写的一个类,用来建立jdbc:thin的connection 我随意试了一下,用getBytes()能返回long raw中的内容:import java.sql.*;import java.io.*;import connections.*;public class Class4 { public static void main(String[] args) { Connection conn; Statement stmt; ResultSet rs; String sql; byte[] sample; sql = "Select * from ts"; try { conn = ConnectionFactory.getConnection(); stmt = conn.createStatement(); rs = stmt.executeQuery(sql); if (rs.next()) { System.out.println("Output:"); sample = rs.getBytes("sample"); System.out.println((sample.length)); } } catch (Exception e) { e.printStackTrace(); }/* finally { if (rs!=null) { ConnectionFactory.close(rs); } ConnectionFactory.close(stmt); ConnectionFactory.close(conn); }*/ }}//connections.ConnectionFactory是我自己写的一个类,用来建立jdbc:thin的connection 我试了以后虽然从库中取出了数据但都是些怪字符,放入word里也是一样的怪字符。如何取出其正常的文本内容. 应先用函数取出该行LONG数据的长度,再取出数据。 Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery("select wordfield from wordTable"); sample = rs.getBytes("wordfield"); System.out.println((sample.length)); for (int i = 0; i < sample.length; i++) { System.out.println(sample[i]); }输出得到的是怪字符 取出数据后,放入ole,通过ole ,用word打开就是了。用别的软件打开当然是乱麻了,他们怎么认识word的格式呢/ 这个问题是不是与在SQL server 中根据类型为text的字段中的内容(即图片文件的地址)打开响应图片或监控其大小的问题相似呢? 我想不是的,word内容是直接放入字段内的,不是在字段内存入word文件的路径 ext界面如何实时的去向服务端发送请求,并接受响应 jsp页面中调用javascript问题 工程突然报错 js效果:鼠标经过区域 图片放大 效果如ppg的产品展示 用tomcat5.5.17打开一个以前的项目打不开。 一个关于JSP导成Excel的问题 ASP.NET+C#开发的客户管理系统,直接下载 jsp页面无法及时更新 javabean中的sql语句问题 在线等!急~~~~~~~~~~~~~~~~~` ssh整合调用自动生成的dao,通过spring配置sessionfactory注入调用报错 表单提交的问题。 请问这种效果如何实现?
long ??long是按照ascii形式存的
long ??long是按照ascii形式存的
import java.sql.*;
import java.io.*;
import connections.*;public class Class4 {
public static void main(String[] args) {
Connection conn;
Statement stmt;
ResultSet rs;
String sql;
byte[] sample;
sql = "Select * from ts";
try {
conn = ConnectionFactory.getConnection();
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
if (rs.next()) {
System.out.println("Output:");
sample = rs.getBytes("sample");
System.out.println((sample.length));
}
} catch (Exception e) {
e.printStackTrace();
}/* finally {
if (rs!=null) { ConnectionFactory.close(rs); }
ConnectionFactory.close(stmt);
ConnectionFactory.close(conn);
}*/
}
}//connections.ConnectionFactory是我自己写的一个类,用来建立jdbc:thin的connection
import java.sql.*;
import java.io.*;
import connections.*;public class Class4 {
public static void main(String[] args) {
Connection conn;
Statement stmt;
ResultSet rs;
String sql;
byte[] sample;
sql = "Select * from ts";
try {
conn = ConnectionFactory.getConnection();
stmt = conn.createStatement();
rs = stmt.executeQuery(sql);
if (rs.next()) {
System.out.println("Output:");
sample = rs.getBytes("sample");
System.out.println((sample.length));
}
} catch (Exception e) {
e.printStackTrace();
}/* finally {
if (rs!=null) { ConnectionFactory.close(rs); }
ConnectionFactory.close(stmt);
ConnectionFactory.close(conn);
}*/
}
}//connections.ConnectionFactory是我自己写的一个类,用来建立jdbc:thin的connection
ResultSet rs = stmt.executeQuery("select wordfield from wordTable");
sample = rs.getBytes("wordfield");
System.out.println((sample.length));
for (int i = 0; i < sample.length; i++) {
System.out.println(sample[i]);
}
输出得到的是怪字符
根据类型为text的字段中的内容(即图片文件的地址)打开响应图片或监控其大小的问题相似呢?