简体   繁体   English

JSL 连接到 SQL Server Express 安装 DSN

[英]JSL Connection to SQL Server Express Setup DSN

I am trying to automate JSL script and I need to update some records from SQL Server using JMP JSL Script.我正在尝试自动化 JSL 脚本,我需要使用 JMP JSL 脚本从 SQL Server 更新一些记录。 I have found below connection string, but I am not sure how to use this.我在下面找到了连接字符串,但我不确定如何使用它。

Open Database("DSN=ODBC Databasexxx;UID=xxxx;PWD=xxxxxxx;DBQ=mydatabasexxxx;DBA=W;APA=T;EXC=F;FEN=T;QTO=T;FRC=10;FDL=10;LOB=T;RST=T;BTD=F;BNF=F;BAM=IfAllSuccessful;NUM=NLS;DPM=F;MTS=T;MDI=F;CSR=F;FWC=F;FBS=64000;TLO=O;",

Setup your ODBC Connection in ODBC Data Source Administrator.在 ODBC 数据源管理器中设置您的 ODBC 连接。 在此处输入图片说明

Then you can just simply do this in your script.然后你可以简单地在你的脚本中做到这一点。

dbc = Create database connection("DSN=sqljmp;Server=;UID=;PWD=;Database=;");

result = Execute SQL(dbc,"SELECT * FROM yourTable");

I know I am a few years late here, but in case someone finds this down the road, you can also connect directly to a SQL database and skip the ODBC entirely.我知道我在这里迟到了几年,但如果有人发现这一点,您也可以直接连接到 SQL 数据库并完全跳过 ODBC。

dt = Open Database(
    "Driver=SQL Server;
    Server=__(server address here)__;
    DATABASE=__(database name here)__;
    Trusted_Connection=Yes;",
    "SQL Code",
    "Table Name"
);

There are also some additional optional values you can use in the connection string, such as username and password.您还可以在连接字符串中使用一些额外的可选值,例如用户名和密码。 If you do not specify these, it will use the account information of the PC user.如果您不指定这些,它将使用 PC 用户的帐户信息。

dt = Open Database(
    "Driver=SQL Server;
    Server=__(server address here)__;
    DATABASE=__(database name here)__;
    UID=__(UserID to use for connection)__;
    PWD=__(Password to use for connection)__;,
    "SQL Code",
    "Table Name"
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM