データベース接続を作成し、スクリプトが完了したら閉じようとしています。「New SQL Query()」関数の「Connection()」コマンドから接続文字列をコピーし、「Create Database Connection()」関数に貼り付けました。しかし、スクリプトを実行すると、「[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified」という dbc1 の定義に関連するエラーがログに記録されます。
以下は、実行しようとしているJSLスクリプトと、問題なく実行される古いメソッドです。
ノート:
- クエリ内の CustomSQL は別の場所で定義されており、この例を短くするために示していません。
- この投稿に示されている解決策に従おうとしていました: https://community.jmp.com/t5/Discussions/How-to-Disconnect-from-a-database-via-script/mp/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();