# Subscription for datachange on internal db sqltag?

**URL:** <https://forum.inductiveautomation.com/t/subscription-for-datachange-on-internal-db-sqltag/3368>\
**Category:** Module Development\
**Created:** [September 29, 2011, 4:13pm UTC](https://forum.inductiveautomation.com/t/subscription-for-datachange-on-internal-db-sqltag/3368 "2011-09-29T16:13:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [September 29, 2011, 4:13pm UTC](https://forum.inductiveautomation.com/t/subscription-for-datachange-on-internal-db-sqltag/3368/1 "2011-09-29T16:13:30Z")

</div>

what is the right way to catch the datachange on internal db sqltag ?

I try :  
public class DataChange implements TagChangeListener{   
public void tagChanged(TagChangeEvent e)  
{  
}

```
		public TagProp getTagProperty()
		{
		}
	}

```

TagListener tg = new TagListener();  
List listeners = new ArrayList(1);  
listeners.add(tg);  
context.getTagManager().subscribe(Arrays.asList(TagPathParser.parse(“default”,“test”)), listeners);

or is it possible to use the ProviderSubscriptionModel in hte example tag provider ???  
how to indicate to use as provider the defaut tag manager ???

---

<div class="post-metadata">

**Author:** ![Colby.Clegg](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/colby.clegg/32/3282_2.png) [@Colby.Clegg](https://forum.inductiveautomation.com/u/Colby.Clegg)\
**Post date:** [September 29, 2011, 4:50pm UTC](https://forum.inductiveautomation.com/t/subscription-for-datachange-on-internal-db-sqltag/3368/2 "2011-09-29T16:50:01Z")

</div>

Hey,

(First off, really quick: when posting code, it’s best to wrap it in the “``” tags, so you don’t lose formatting)

Yes, that code should be fine… besides the fact that you need to return something from “getTagProperty”, as I’m sure Eclipse is telling you. You can just return null to listen for all events, or return TagProp.Value to just listen to value (and quality) changes.

If I can be honest, I think you should stay away from the TagProvider example. That’s only going to be confusing at this stage, and I think it’s nowhere close to what you want to do.

For the default provider: there is no such thing as the “default” in the gateway. The default is set on a project by project basis, so it is only applicable in the Client scope. In the gateway, you’ll have to always specify the provider you want… which you’re doing in your code, by specifying the provider named “default”, which is created when Ignition is installed.

Regards,

---

<div class="post-metadata">

**Author:** ![Kevin.McClusky](https://avatars.discourse-cdn.com/v4/letter/k/47e85d/32.png) [@Kevin.McClusky](https://forum.inductiveautomation.com/u/Kevin.McClusky)\
**Post date:** [September 29, 2011, 4:59pm UTC](https://forum.inductiveautomation.com/t/subscription-for-datachange-on-internal-db-sqltag/3368/3 "2011-09-29T16:59:33Z")

</div>

It also looks like you’re not instantiating your DataChange class anywhere.

```auto
TagListener tg = new TagListener();
```

should probably be

```auto
DataChange tg = new DataChange();
```
