Sir please tell me how to import image in database

0 votes
Apr 1, 2020 in Database by Soumadip
• 120 points

reshown Apr 1, 2020 by Sirajul • 2,191 views

1 answer to this question.

0 votes

Hello soumadip,

(Assuming you are using mysql database)

You will  able to get it done by moving the image(fileName.jpg) file first in to below folder(in my case) C:\ProgramData\MySQL\MySQL Server 7.2\Uploads and then I executed below command and it works for me,

INSERT INTO Niraj(ID,IMAGE) VALUES(1,LOAD_FILE('C:/ProgramData/MySQL/MySQL Server 7.2/Uploads/fileName.jpg'));

Here assuming the images is on my local computer, in the images folder:

//Create the table
 CREATE TABLE images (
        picid int NOT NULL AUTO_INCREMENT,
        description VARCHAR(40),
        image BLOB,
        PRIMARY KEY (picid));

// Insert the row
INSERT INTO images VALUES
        (NULL,'picture of a frog','c\:images\frog.png');

Hope this helps.

Thank you!!

answered Apr 1, 2020 by Niroj
• 82,800 points
I can't find 'C:/ProgramData/MySQL/'   to upload my images to

Related Questions In Database

0 votes
0 answers

How to store image in SQLite database

I want to upload an image from ...READ MORE

Aug 22, 2022 in Database by Kithuzzz
• 38,000 points
• 4,161 views
0 votes
2 answers
0 votes
1 answer

How to load data of .csv file in MySQL Database Table?

At first, put the dataset in the ...READ MORE

answered Jul 5, 2019 in Database by Reshma
• 2,693 views
0 votes
2 answers

How to select the nth row in a SQL database table?

SELECT * FROM ( SELECT ID, NAME, ROW_NUMBER() ...READ MORE

answered Apr 23, 2020 in Database by anand
• 140 points
• 29,499 views
0 votes
1 answer

How to rename a column in a database table using SQL?

For SQL Server, use sp_rename USE AdventureWorks; GO EXEC sp_rename 'Customers.CustomerTerritory.TerritoryID', ...READ MORE

answered Feb 9, 2022 in Database by Neha
• 9,020 points
• 2,232 views
0 votes
0 answers

How to change column datatype in SQL database without losing data?

I have a SQL Server database, and ...READ MORE

Feb 25, 2022 in Database by Vaani
• 7,070 points
• 1,684 views
0 votes
1 answer

How to retrieve data from sqlite database in android and display it in TextView

When a button is clicked, the database ...READ MORE

answered Aug 11, 2022 in Database by narikkadan
• 86,360 points

edited Mar 5, 2025 • 6,898 views
0 votes
0 answers

Import .bak file to a database in SQL server

I have a file with .bak extension. How ...READ MORE

Aug 14, 2022 in Database by Kithuzzz
• 38,000 points
• 1,458 views
0 votes
1 answer

How to empty a redis database?

Hello @kartik, You have two options: FLUSHDB - clears currently ...READ MORE

answered May 4, 2020 in Database by Niroj
• 82,800 points
• 2,162 views
0 votes
1 answer

How to take MySQL database backup using MySQL Workbench?

Hii, You can export like this: Hope this is ...READ MORE

answered May 4, 2020 in Database by Niroj
• 82,800 points
• 2,423 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP