I am trying to Create a db connection and then close it when my script is complete. I've copied the Connection string from the "Connection()" command in my "New SQL Query()" function and pasted it into the "Create Database Connection()" function. But when I run the script I get an error in the log related to the definition of dbc1 that says "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified".
Below is my JSL script that I am trying to run and the old method that runs without a problem.
Notes:
- the CustomSQL in the Query is defined elsewhere and isn't shown to make this example shorter.
- I was trying to follow the solution shown in this post: https://community.jmp.com/t5/Discussions/How-to-Disconnect-from-a-database-via-script/m-p/597749#M80126
names default to here(1);
// trying to create the db connection and then insert into the Query
dbc1 = Create database Connection("ODBC:DSN=SQLplus 64-bit ODBC Connection;");
New SQL Query(
Connection( dbc1 ),
CustomSQL( combined )
) << Run Foreground();
// vs. my typical method
New SQL Query(
Connection( "ODBC:DSN=SQLplus 64-bit ODBC Connection;" ),
CustomSQL( combined )
) << Run Foreground();