Meaningless Drivel is fun!*
The moose likes JDBC and the fly likes insert image path in mysql database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Bookmark "insert image path in mysql database" Watch "insert image path in mysql database" New topic
Author

insert image path in mysql database

Pravin Shirke
Ranch Hand

Joined: Apr 05, 2008
Posts: 150

when i am trying to insert the image path in the mysql database it trims the file separator by default. so how do i insert it?
heres the code for it:

try
{
status="1";
System.out.println("Add");
System.out.println("THe path of the banner is "+universityBanner);
if(connectionActive)
{
conn.stmt.executeUpdate("insert into tblUniversity_Master(University_Short_Name,University_Long_Name,Registration_No,University_Address1,University_Address2,University_City,University_State,University_Country,University_Region,University_District,University_Zip_Code,Email_ID,Telephone_No,Fax_No,IsActive,Created_Date,Created_By,Modified_Date,Modified_By,University_Banner) values ('"+sName+"','"+lName+"','"+regno+"','"+address1+"','"+address2+"','"+city+"','"+state+"','"+country+"','"+region+"','"+district+"','"+zipCode+"','"+eMail+"','"+telNo+"','"+faxNo+"','"+status+"','"+str+"',"+createdBy+",'"+str+"',"+modifiedBy+",'"+universityBanner+"')");
}
}
catch(Exception e)
{
System.out.println(e.getMessage());
}

here universityBanner contains the image path which i get from this code

<input type="FILE" name="universityBanner" size="20" maxlength="250" disabled="true"/>

can any one help me??


[Vipassana] - It is seeing the reality as it is, And not as you want it to be.!!!
SCJP1.5.
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1321

it trims the file separator by default


don't understand what do you mean by above statement.

Suggestion : use preparedStatement


Saifuddin..
[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: insert image path in mysql database