Skip to Content
0
Former Member
Feb 20, 2006 at 03:43 AM

File upload and download in server through web Dynpro

20 Views

Hai all,

i want to store one document in SQL Server 2000 through Webdyn pro. I inserted

one document through java into SQL Server 2000 using the following method which name is

insertFile(...).

void insertFile(FileDBTransfer fdb, Connection cn, String FileName)throws IOException, FileNotFoundException, SQLException

{

int FileLength;

FileInputStream fis;

PreparedStatement pstmt;

int last=FileName.lastIndexOf("/");

String docname=FileName.substring(last+1,FileName.length());

fis = fdb.getFileInputStream(FileName);

FileLength= fdb.getFileLength(FileName);

pstmt = cn.prepareStatement("insert into ReportArchive values(?,?)");

pstmt.setString(1,docname);

pstmt.setBinaryStream(2, fis, FileLength); //method to insert a stream of bytes

pstmt.executeUpdate();

}// end insertZipFile

Here i have given file name like "c:\test\test.pdf" it's work fine.

My J2EE server is running different machine and my Netweaver is another machine.

If both server and IDE in same machine it's work fine. But both are in different machine,

i have some problems.

If i try like this server always go and check his own path, not client machine

so it will error like "given source not found". So if i get client machine's path

then i will store easily into SQL Server 2000.

Whenever i run, it should check the client machine path instead of server path.

Thanks in advance,

K.Saravanan.