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
}
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
}