I need an exampls program in java to store image datatype in ms-sql

Reply

Join Date: Jun 2004
Posts: 1
Reputation: santoshmaya is an unknown quantity at this point 
Solved Threads: 0
santoshmaya santoshmaya is offline Offline
Newbie Poster

I need an exampls program in java to store image datatype in ms-sql

 
0
  #1
Jun 7th, 2004
Hi,
I need an exampls program in java to store image datatype in ms-sql database.i am writing a jsp file in that i wanted attach a file.in oracle i wriiten like this,but i need in ms-sql.i required urgently.pls help me.

code in java using oracle.
i need it in ms-sql.
public ArrayList save(com.virinchi.capture.attachment.FileAttachment fileAttach)
{
FileHandler fh = getFileHandler();
int iCount=0;
int iSize=fileAttach.getFiles().getCount();
ArrayList attachmentIds=new ArrayList();
String folder = fileAttach.getRequest().getParameter("Folder");
try
{
for (iCount=0;iCount<iSize;iCount++)
{
String fileName ="";
String fileSize="";
com.virinchi.capture.attachment.File myFile = fileAttach.getFiles().getFile(iCount);
InputStream file = myFile.getFileInputStream();
byte[] bt = new byte[file.available()];
file.read(bt);
ByteArrayInputStream bais = new ByteArrayInputStream(bt);
fileName=myFile.getFileName();
fileSize=myFile.getSize()+"";
String s[]= new String[4];
if (fileName.length()==0 || myFile.getSize()==0)
{
System.out.println("Empty File");
}
else
{
s[0]=fh.save(fileName,fileSize,bais);
s[1]=fileName;
s[2]=fileSize;
s[3]=folder;
attachmentIds.add(s);
}
}
}
catch(Exception e)
{
}
return attachmentIds;
}

regards,
santoshmaya
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 9761 | Replies: 0
Thread Tools Search this Thread



Tag cloud for MS SQL
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC