# Sync pre/post Events - reuse existing db Connection info

**URL:** <https://community.cdata.com/t/sync-pre-post-events-reuse-existing-db-connection-info/584>\
**Category:** CData Sync\
**Tags:** sql, question, cdata-sync, event\
**Created:** [December 26, 2023, 7:40pm UTC](https://community.cdata.com/t/sync-pre-post-events-reuse-existing-db-connection-info/584 "2023-12-26T19:40:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![DougN\_Nouria](https://avatars.discourse-cdn.com/v4/letter/d/e0b2c6/32.png) [@DougN\_Nouria](https://community.cdata.com/u/DougN_Nouria)\
**Post date:** [December 26, 2023, 7:40pm UTC](https://community.cdata.com/t/sync-pre-post-events-reuse-existing-db-connection-info/584/1 "2023-12-26T19:40:56Z")

</div>

You can use post-job Events to run some arbitrary SQL (like a stored procedure) at the end of your Job.

The documentation says you have to make your own connection, as below.&nbsp; But I’d really rather not embed cleartext credentials in multiple jobs.&nbsp; Is there a way to specify a CData connection (which we’ve already established at this point), in the Event?

What I’d&nbsp; **really** &nbsp;like is the ability to run arbitrary SQL commands against the target table, after each Task completes, not just at the end of the Job.&nbsp; Seems like this could be a parameter that we supply as we define each Task.

```auto
<api:set attr="db.driver" value="System.Data.SqlClient"/> <api:set attr="db.conn" value="Data Source=sqlserver;Initial Catalog=Test;User ID=user;Password=pass;"/> <api:set attr="db.query">INSERT INTO MyLog (JobName, RunDate, Results) VALUES ('[_input.JobName]', '[null | now()]', '[_input.JobStatus]')</api:set>

```

---

<div class="post-metadata">

**Author:** ![DougN\_Nouria](https://avatars.discourse-cdn.com/v4/letter/d/e0b2c6/32.png) [@DougN\_Nouria](https://community.cdata.com/u/DougN_Nouria)\
**Post date:** [December 26, 2023, 7:49pm UTC](https://community.cdata.com/t/sync-pre-post-events-reuse-existing-db-connection-info/584/2 "2023-12-26T19:49:43Z")

</div>

Nevermind -- I think “Transformations” feature is what I really should be using here.

---

<div class="post-metadata">

**Author:** ![Ankit\_Singh](https://sea3.discourse-cdn.com/cdata/user_avatar/community.cdata.com/ankit_singh/32/1614_2.png) [@Ankit\_Singh](https://community.cdata.com/u/Ankit_Singh)\
**Post date:** [December 27, 2023, 6:45am UTC](https://community.cdata.com/t/sync-pre-post-events-reuse-existing-db-connection-info/584/3 "2023-12-27T06:45:30Z")

</div>

Hey @DougN_Nouria

Glad you figured it out. You can use an **‘After Job’** Trigger to trigger your transformation once a job run completes:&nbsp;[CData Sync - SQL Transformations | 23.4.8843](https://cdn.cdata.com/help/ASJ/sync/SQL-Transformations.html#trigger-category).
