SQL Server as external data source

Study Forum (Inactive)
SQL Server as external data source rick.watts  2010-11-29 12:49
Status: Closed
 
Hi. Can anyone help me set up a SQL Server database as an external data source? We have LabKey running against a PostgreSQL database and can successfully access external SAS data sets. However we'd like to use LabKey to report on data from a SQL Server database. The instructions in the documentation seem to relate to replacing Postgres with SQL server, which is not what we want.

Do we need to install the BigIron module as the documentation implies?

What should I put for the data source element in labkey.xml?

Thanks.

Rick.
 
 
adam responded:  2010-11-29 13:33
Yes, you'll need to install the bigiron module, since it includes the SQL Server dialect... the layer that translates generic commands into SQL Server syntax. (If you can connect to SAS/SHARE then you must have it installed.) You'll also need the SQL Server JDBC driver (jtds.jar... this ships with LabKey and should be in your <tomcat>/common/lib directory).

The datasource element in labkey.xml should look something like this:

  <Resource name="jdbc/msSqlDataSource" auth="Container"
        type="javax.sql.DataSource"
        username="sa"
        password="password"
        driverClassName="net.sourceforge.jtds.jdbc.Driver"
        url="jdbc:jtds:sqlserver://localhost/labkey"
        maxActive="20"
        maxIdle="10" accessToUnderlyingConnectionAllowed="true"/>

You'll need to substitute the appropriate url, username, and password. Start up the server and the log should show you if LabKey was able to connect to the msSqlDataSource. If it can, you should be able to define external schemas as you have with SAS/SHARE.

Adam