# Script with SQL for second database

**URL:** <https://forum.sambapos.com/t/script-with-sql-for-second-database/14700>\
**Category:** V5 Question\
**Created:** [April 25, 2017, 9:15pm UTC](https://forum.sambapos.com/t/script-with-sql-for-second-database/14700 "2017-04-25T21:15:09Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![QMcKay](https://forum.sambapos.com/user_avatar/forum.sambapos.com/qmckay/32/27925_2.png) [@QMcKay](https://forum.sambapos.com/u/QMcKay)\
**Post date:** [April 25, 2017, 9:27pm UTC](https://forum.sambapos.com/t/script-with-sql-for-second-database/14700/2 "2017-04-25T21:27:20Z")

</div>

You will need to set up a separate Connection in JScript.

We talked about this a while back - the basic jist is in the following Topic…

This discusses connection to MSSQL and MySQL Databases using a connection made in JScript using IIRC ActiveX Object. Today, there will be better ways than ActiveX, like using `host.lib` or `host.type` helpers, but the theory is similar. If you stick with MSSQL, you will probably be better off since C# and .NET will have native support for MSSQL and that is where `host.lib/type` come in.

> [@Query MySQL from within Samba](https://forum.sambapos.com/t/query-mysql-from-within-samba/9379):
>
> Before anyone else gets confused Samba doesn’t use MySQL. I need to work a way to query a MySQL database for a planned integration with PBX phone system (for a start). Also have future plan of setting up an integration for a WiFi radius server but thats a way off yet. @QMcKay you probably the best one to ask on that… Is there any clean way to query a MySQL database? Only things on the forum I could find is people asking about samba running from MySQL database. I just want to query a databa…

---

_[View the full topic](https://forum.sambapos.com/t/script-with-sql-for-second-database/14700)._
