Share your ideas for the JMP Scripting Unsession at Discovery Summit by September 17th. We hope to see you there!
Choose Language Hide Translation Bar
Highlighted
A_J
A_J
Level I

Sending OBDC Data Source connection with Add-in or Creating it through JSL

Hi all, 

 

I am trying to create an Add-in that pulls data from an SQL Server as data source, and I would need to distribute this Add-in to other users.

 

The Add-in works perfectly, but the OBDC connection used by the Add-in is not being sent with it. Unfortunately, not everyone would be able/know how to create an OBDC connection to the SQL server in an easy way. 

 

Does anyone know how I could either send the OBDC connection with the Add-in file, or re-create this OBDC connection through a JSL script? 

 

Thanks for the help in advance!

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
ih
ih
Level VII

Re: Sending OBDC Data Source connection with Add-in or Creating it through JSL

If you only need to access SQL databases from windows, or if the user has a SQL odbc driver installed then this this might work without configuring a DSN on the client machine:

 

 

New SQL Query(
	Connection(
		"ODBC:DRIVER=SQL Server;SERVER=sqlserverhostname\sqlinstancename;Trusted_Connection=Yes;APP=JMP;DATABASE=sqldatabasename;"
	),
	CustomSQL( "SELECT TOP 10 * FROM [sqldatabasename].[schema].[table]" ) // database/schema names are not necessary
) << Run

 

 

 

 

View solution in original post

3 REPLIES 3
Highlighted
ih
ih
Level VII

Re: Sending OBDC Data Source connection with Add-in or Creating it through JSL

If you only need to access SQL databases from windows, or if the user has a SQL odbc driver installed then this this might work without configuring a DSN on the client machine:

 

 

New SQL Query(
	Connection(
		"ODBC:DRIVER=SQL Server;SERVER=sqlserverhostname\sqlinstancename;Trusted_Connection=Yes;APP=JMP;DATABASE=sqldatabasename;"
	),
	CustomSQL( "SELECT TOP 10 * FROM [sqldatabasename].[schema].[table]" ) // database/schema names are not necessary
) << Run

 

 

 

 

View solution in original post

Highlighted
A_J
A_J
Level I

Re: Sending OBDC Data Source connection with Add-in or Creating it through JSL

It seems to work like a charm :) 

 

Still I might need to find out a way to get the SQL OBDC driver installed if they are missing this, but it is defenetly saving me from the DSN. 

 

I was trying to do it using Open Database() as below, but your solution gets rid of the DSN.

 

Thanks!

 

 
Open Database(
 "DSN=sqldatasource;Description=sqlescription;Trusted_Connection=Yes;APP=JMP;WSID=sqlserverhostname;DATABASE=databasename;",
 "SELECT * FROM [sqldatabasename].[schema].[table]");

 

Highlighted
pmroz
Super User

Re: Sending OBDC Data Source connection with Add-in or Creating it through JSL

I have faced a similar problem with ODBC connection to an Oracle database.

Each user will need an SQL server ODBC driver installed.  As @ih mentioned you can probably figure out a way to connect without a named data source (DSN).

Our users access a server version of JMP running on the Citrix platform.  So I only needed to install the addin + database drivers once.

Article Labels

    There are no labels assigned to this post.