# Image management in MSSQL

**URL:** <https://forum.inductiveautomation.com/t/image-management-in-mssql/3113>\
**Category:** Ignition\
**Created:** [July 20, 2011, 2:47pm UTC](https://forum.inductiveautomation.com/t/image-management-in-mssql/3113 "2011-07-20T14:47:01Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![TimE](https://avatars.discourse-cdn.com/v4/letter/t/ee59a6/32.png) [@TimE](https://forum.inductiveautomation.com/u/TimE)\
**Post date:** [July 20, 2011, 2:47pm UTC](https://forum.inductiveautomation.com/t/image-management-in-mssql/3113/1 "2011-07-20T14:47:01Z")

</div>

I am in the process of creating a Lockout/Tagout project and would like to add a picture of each of the lockout points. I know how to use the image manager and store the images to the gateway but I am wondering about going further and storing the images in an SQL table. I will have over a thousand pictures before I am done.

For those of you that may have had a project similar to this, which way is better in the long run?

How do I use the image component and bind the image path to an SQL table?

Thank you for the help.

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [July 20, 2011, 3:12pm UTC](https://forum.inductiveautomation.com/t/image-management-in-mssql/3113/2 "2011-07-20T15:12:14Z")

</div>

The only downside to storing images in the database is that the database can get rather large. It all depends on the size of each image. It is a nice method since you don’t have to go into the designer to add new images and use them. In the long run I don’t think there is much difference.

If you do go down the database route you can put a label on the window (not an image) and use the following code to set the image:`from javax.swing import ImageIcon
blob = system.db.runScalarQuery("SELECT imageblob FROM images WHERE id = 1")
icon = ImageIcon(blob)
event.source.parent.getComponent('Label').setIcon(icon)`You can also write the image to a temporary file and set the image path of the image to that. I think it is better to stay away from reading and writing files. Hope this helps.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [July 20, 2011, 3:47pm UTC](https://forum.inductiveautomation.com/t/image-management-in-mssql/3113/3 "2011-07-20T15:47:23Z")

</div>

In my installation, I have IIS running concurrently with with Ignition’s Apache Server. I save the pictures under IIS and then store the URL into the database. I do this with PDF’s as well.

---

<div class="post-metadata">

**Author:** ![diat150](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@diat150](https://forum.inductiveautomation.com/u/diat150)\
**Post date:** [July 23, 2011, 1:59pm UTC](https://forum.inductiveautomation.com/t/image-management-in-mssql/3113/4 "2011-07-23T13:59:05Z")

</div>

Jordan, could you explain how to do this? Id like to use this on one of my systems.

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [July 25, 2011, 7:59pm UTC](https://forum.inductiveautomation.com/t/image-management-in-mssql/3113/5 "2011-07-25T19:59:00Z")

</div>

I’ll post what I have later on tonight. Been an exceptionally busy day today. On the bright side I have a job to be busy at! 😃

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [July 26, 2011, 9:43am UTC](https://forum.inductiveautomation.com/t/image-management-in-mssql/3113/6 "2011-07-26T09:43:55Z")

</div>

OK, here’s what I have set up:

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/1X/371bcaeabb407c9e7ec60a3987e6386fb56da3a1.png)  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/1X/ea7000619cf599ac56222421adba911f748c54b7.png)  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/1X/4f93db6c31be63baec4b2fa424a19bfb5c1e96be.png)  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/1X/7eaef0dc99d32f823c34192d443af67c6955cf58.png)  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/1X/3a513f96966c768a13cc629bed823bfbdbe1d252.png)

---

<div class="post-metadata">

**Author:** ![JordanCClark](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jordancclark/32/83362_2.png) [@JordanCClark](https://forum.inductiveautomation.com/u/JordanCClark)\
**Post date:** [July 26, 2011, 9:45am UTC](https://forum.inductiveautomation.com/t/image-management-in-mssql/3113/7 "2011-07-26T09:45:14Z")

</div>

Bonus tip:  
 ![](https://us1.discourse-cdn.com/inductiveautomation/original/1X/1bd8515a074ea2192dce5a803ad26526bda33322.png)

---

<div class="post-metadata">

**Author:** ![mikevkrell](https://avatars.discourse-cdn.com/v4/letter/m/aeb1de/32.png) [@mikevkrell](https://forum.inductiveautomation.com/u/mikevkrell)\
**Post date:** [November 19, 2018, 8:59pm UTC](https://forum.inductiveautomation.com/t/image-management-in-mssql/3113/8 "2018-11-19T20:59:39Z")

</div>

I know this is a tad late of a reply, but i dont know of another way to reach out to you. I am curious about your lockout tagout project that you created. I have been tasked to create one and i have been fishing around looking to find something that already exists. Let me know if you are willing to share. thanks
