cancel
Showing results for 
Search instead for 
Did you mean: 

Error in reading a file:

Former Member
0 Kudos

Hello all,

I got the error below:

Exception java.io.FileNotFoundException: D:\Home$\BLOB.txt (No such file or directory)

the code is:

PreparedStatement pSt = con.prepareStatement("insert into CLOB_COL Values(?,?)") ;

pSt.setString(1,"U");

<b>FileInputStream fis=new FileInputStream(element.getFileName()); //getting error here</b>

byte[] b= new byte[fis.available()+1];

fis.read(b);

pSt.setBytes(3,b);

pSt.execute();

pSt.close();

Please suggest:

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos
sridhar_k2
Active Contributor
0 Kudos

Pradeep,

You are getting that exception, bcz it cant find the file path.

Generally it looks for tht file in the current working directory.

You can specify the file exact location (path) like this.

FileInputStream fis=new FileInputStream("C:
Documents and Settings
user
testfile.txt");

use '
' where ever you have to use '\'.

Check this API for FileInputStream.

http://java.sun.com/j2se/1.4.2/docs/api/java/io/FileInputStream.html

Regards,

Sridhar

Former Member
0 Kudos

make sure that the user is having permissions for the folder that contains the file.Right click on the folders name and share that folder that folder

Message was edited by:

Armin Reichert

Former Member
0 Kudos

hello,

Folder has permission to access the file.

I am able to open file from run command.

Please suggest other solution: