各位,
我经常使用数据库查询,并结合自定义 sql。 我知道,有3种方法,如下所示。
我最喜欢“新的sql查询”,因为它最强大,而且更安全(见密码...)。
不幸的是,JMP17 中有关隐藏 ODBC 连接字符串的行为已更改,但将会得到纠正:
首选项“隐藏 ODBC 连接字符串”集上的 JMP17 行为:连接字符串... - JMP 用户社区
在锡切斯的欧洲探索峰会上,开发人员告诉我,新的 sql 查询方法是推荐的方法,更稳定,其他两种方法都已经过时了。 但我也听说有速度问题。 我从来没有读过这个建议,也没有在文档中读过。
我想讨论的是:
您使用什么方法,为什么?
你有哪些经历?
谢谢并致以最诚挚的问候,
格奥尔格
Names Default To Here( 1 );
// 3 different ways for database access
// constants
sql_str = "select * from Dual"; // this works on all Oracle DB's
// needs to be adapted to your database<BR />cnx_str ="DSN=MYDSN_NAME;UID=USERNAME;PWD=PASSWORD";
// new sql query needs connection string starting with "ODBC:"
// there is no good documentation in the manual (scripting guide and JMP Help)
qry_obj = New SQL Query( query name("New SQL Query"), connection( "ODBC:"||cnx_str ), custom sql( sql_str ) );
dt_sqlquery = qry_obj << run foreground();
// open database is a oneliner
// with "Hide ODBC connection string" not set, it saves the plain password into the table scripts
dt_open = open database(cnx_str, sql_str, "Open Database");
// expecute sql needs the database opened before sending statements
// with "Hide ODBC connection string" not set, it saves the plain password into the table scripts
dbc=create database connection(cnx_str);
dt_execute = execute sql(dbc, sql_str, "Execute SQL");
close database connection(dbc);
// EOS