Problem While Storing image File
Hi Every Body.........
here iam working wth swings..
i am getting a problem while storing image file into data base.
my dayabase contains:
studentID varchar(30)
photo mediumblob nullallowed.
.
i am using bean class. to handle database.and i'm using map.
************************************************** ****
my setter method is:
setPhoto(File f)
{
this.f=f;
hsm.put("photo",FileIn);//here i am using map.
}
************************************************** *****
And My Bean Class is....
while(ir.hasNext())
{
Map.Entry me=(Map.Entry)ir.next();
i++;
Object key = me.getKey(); // Get the next key.
Object value =me.getValue();
if(value instanceof File)
{
try
{
System.out.println("Enter The Dragon...");
File fone=(File)value;
InputStream streamedFile = new FileInputStream(fone);
int len=(int)fone.length();
System.out.println("File Length is........"+len);
System.out.println("Fle........."+streamedFile);
ps.setBinaryStream(i,(InputStream)streamedFile,len );/////[u]here i am gettimg exception........Please Give idea /////</u>System.out.println("edbc Excecuted...");
}
catch(Exception e)
{System.out.println("Error While Converting Image File..."+e.toString());
}
************************************************** *********
i amgetting exception in setBiaryStream();
Please Give me Solution
Thanks in Advance
G.kiran
|