# Variable in a connection url?

**URL:** <https://matillioncommunity.discourse.group/t/variable-in-a-connection-url/1180>\
**Category:** Matillion ETL\
**Created:** [September 3, 2020, 9:05pm UTC](https://matillioncommunity.discourse.group/t/variable-in-a-connection-url/1180 "2020-09-03T21:05:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![shaun.odonnell1599166800668](https://avatars.discourse-cdn.com/v4/letter/s/7ba0ec/32.png) [@shaun.odonnell1599166800668](https://matillioncommunity.discourse.group/u/shaun.odonnell1599166800668)\
**Post date:** [September 3, 2020, 9:05pm UTC](https://matillioncommunity.discourse.group/t/variable-in-a-connection-url/1180/1 "2020-09-03T21:05:07Z")

</div>

I'm on day 2 of playing in Matillion and haven't been able to figure out whether I can use a variable in a connection url. For example, jdbc:jtds:sqlserver://${JDBCSTRING}

I get a "The syntax of the connection URL 'jdbc:jtds:sqlserver://' is invalid." error.

---

<div class="post-metadata">

**Author:** ![ELTuser77](https://avatars.discourse-cdn.com/v4/letter/e/c5a1d2/32.png) [@ELTuser77](https://matillioncommunity.discourse.group/u/ELTuser77)\
**Post date:** [September 4, 2020, 12:23pm UTC](https://matillioncommunity.discourse.group/t/variable-in-a-connection-url/1180/2 "2020-09-04T12:23:11Z")

</div>

Hi [@shaun.odonnell1599166800668](https://matillioncommunity.discourse.group/u/shaun.odonnell1599166800668)​

I assume you are using the Database Query component? I have replicated the above and it works fine. You can parameterise the entire URL or the host and database, as you are trying to do.

Ive changed my hostname and DB but you get the idea.

Your job variable JDBCSTRING - I assume you have entered a default value for this or you are passing the correct string representing \<hostname\>/\<database\>? Your error above implies the variable is empty as there is nothing after the double slash? If you are passing this as a variable from a parent job, the variable needs to be defined as public, just for info. If it is private, the calling job won't be able to set it via the 'set scalar variables' option.

---

<div class="post-metadata">

**Author:** ![ELTuser77](https://avatars.discourse-cdn.com/v4/letter/e/c5a1d2/32.png) [@ELTuser77](https://matillioncommunity.discourse.group/u/ELTuser77)\
**Post date:** [September 4, 2020, 12:25pm UTC](https://matillioncommunity.discourse.group/t/variable-in-a-connection-url/1180/3 "2020-09-04T12:25:25Z")

</div>

Screenshots now attached, apologies.

 ![0694G00000AvLBuQAN_0D74G000006XwOeSAK](https://us1.discourse-cdn.com/flex002/uploads/matillioncommunity/original/1X/7b69a45fe2a283d7066a76d2da0132f8d87c9c7a.png)

 ![0694G00000AvLBkQAN_0D74G000006XwOeSAK](https://us1.discourse-cdn.com/flex002/uploads/matillioncommunity/original/1X/e3097061561464bfffbfb3f96ecb7247e5598edd.png)

---

<div class="post-metadata">

**Author:** ![ELTuser77](https://avatars.discourse-cdn.com/v4/letter/e/c5a1d2/32.png) [@ELTuser77](https://matillioncommunity.discourse.group/u/ELTuser77)\
**Post date:** [September 4, 2020, 12:32pm UTC](https://matillioncommunity.discourse.group/t/variable-in-a-connection-url/1180/4 "2020-09-04T12:32:34Z")

</div>

Just for completeness - here is my URL string:

&nbsp;

**_jdbc:jtds:sqlserver://${JDBCSTRING}_**

---

<div class="post-metadata">

**Author:** ![shaun.odonnell1599166800668](https://avatars.discourse-cdn.com/v4/letter/s/7ba0ec/32.png) [@shaun.odonnell1599166800668](https://matillioncommunity.discourse.group/u/shaun.odonnell1599166800668)\
**Post date:** [September 4, 2020, 4:31pm UTC](https://matillioncommunity.discourse.group/t/variable-in-a-connection-url/1180/5 "2020-09-04T16:31:09Z")

</div>

Thanks a bunch. I did manage to get it working following your examples, and am not sure where I went wrong originally. I've now 'graduated' to a grid iterator and all is good!

---

<div class="post-metadata">

**Author:** ![ELTuser77](https://avatars.discourse-cdn.com/v4/letter/e/c5a1d2/32.png) [@ELTuser77](https://matillioncommunity.discourse.group/u/ELTuser77)\
**Post date:** [September 4, 2020, 6:57pm UTC](https://matillioncommunity.discourse.group/t/variable-in-a-connection-url/1180/6 "2020-09-04T18:57:16Z")

</div>

Great to hear [@shaun.odonnell1599166800668](https://matillioncommunity.discourse.group/u/shaun.odonnell1599166800668)​! Good luck!
