我正在嘗試創建一個數據庫連接,然後在我的腳本完成後關閉它。我已經從“New SQL Query()”函數中的“Connection()”命令複製了連接字符串,並將其粘貼到“Create Database Connection()”函數中。但是,當我運行該腳本時,我在與 dbc1 定義相關的日誌中收到一條錯誤消息:“[Microsoft][ODBC 驅動程序管理器] 未找到數據源名稱且未指定默認驅動程序”。
下面是我嘗試運行的 JSL 腳本和運行沒有問題的舊方法。
筆記:
- Query 中的 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();