File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases 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 and Relational Databases
Bookmark "insert image path in mysql database" Watch "insert image path in mysql database" New topic

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:

System.out.println("THe path of the banner is "+universityBanner);
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)

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.!!!
Muhammad Saifuddin
Ranch Hand

Joined: Dec 06, 2005
Posts: 1323

it trims the file separator by default

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

Suggestion : use preparedStatement

[Blog][Linkedin] How To Ask Questions On JavaRanch My OpenSource
I agree. Here's the link:
subject: insert image path in mysql database
jQuery in Action, 3rd edition