Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Longraw conversion help needed for a newbee

Status
Not open for further replies.

aspengal

Technical User
Dec 27, 2004
41
US
I have an ORACLE 9i database which has a longraw column. This has the all the data from the .doc,.xls,.bmp,.pdf files that the users upload thru the application. I would like to download all these files from the database into a fileshare and used the below java program. Unfortunately, it has converted all the Microsoft files properly, but the bmp,jpeg,pdf,obd files have not converted properly and are all junk and cannot be opened. Can someone tell me what is wrong with this and what I should use to make it work?

Thank You

****************
import java.sql.*;
import java.io.*;

public class binext{
public static void main(String[] args) throws Exception{

String url = "jdbc:microsoft:sqlserver://XXXXX;DatabaseName=XXXX";
String uid = "XXX";
String pw = "XXXX";

try { // Load driver class
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
}
catch (java.lang.ClassNotFoundException e) {
System.err.println("ClassNotFoundException: " +e);
}
String Query;
int FileLength;
Connection cn;
ResultSet rs;
int file_id_seq;
String FileName;

file_id_seq = Integer.parseInt(args[0]);
FileName = args[1];

//instantiate the class
FileDBTransfer fdb = new FileDBTransfer();

Connection con = null;

con = DriverManager.getConnection(url,uid,pw);
rs = fdb.getRS(con,"SELECT document_data FROM sar_fac_file_cabinet where file_id_seq=" + file_id_seq);
fdb.getBinaryFile(args[1], rs);
con.close();

}//end main
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top