User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MS SQL section within the Web Development category of DaniWeb, a massive community of 374,023 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,775 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS SQL advertiser:
Views: 6804 | Replies: 0
Reply
Join Date: Jun 2004
Posts: 1
Reputation: santoshmaya is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
santoshmaya santoshmaya is offline Offline
Newbie Poster

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

  #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
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb MS SQL Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the MS SQL Forum

All times are GMT -4. The time now is 11:26 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC