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