Skip to main content

How to get a clob file from data base and pass one instance of that file to another java method....

Please note these forums are being decommissioned and use the new and improved forums at
1 reply [Last post]
Joined: 2011-02-09
Points: 0

Here is my sample code.

public File getFile(----)
File file=null;

try {
Connection conn = DriverManager.getConnection(url, username, pass);
System.out.println("Connected to EBS");
//String sql = "SELECT * FROM ebswo where woid='"+origURL+"'";
String sql = "SELECT * FROM ebswo where woid='wso002'";
Statement stmt = conn.prepareStatement(sql);
ResultSet rs = stmt.executeQuery(sql);
while ( {
docName = rs.getString(2);
System.out.println("Document Name in buildDocInfo>>>>>" + docName);

file = new File(docName);
Reader reader = rs.getCharacterStream(3);
FileWriter writer = new FileWriter(file);
char[] buffer = new char[1];
while ( > 0) {
System.out.println("File Created in buildDocInfo>>>>");

return file;

So my requirement is how can I get one instance of the file without storing the file in the local hard disk.

i.e I have to pass the file file instance dynamically with out storing the parent file into local drive.

please reply me soon..

Thanks In advance


Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2008-06-07
Points: 0

Most of the time, the thing you are passing your File instance into can accept byte[] or InputStream. If os, you do not need to create the file in your local disk. If it insists on an instance of type File, you are out of luck there.