<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: connect to SQL databse programmatically in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/213136#M42651</link>
    <description>&lt;P&gt;Here's a simple example using Big Class that should get you started.&amp;nbsp; It inserts all the rows into a database table called big_class.&amp;nbsp; Note the use of &lt;STRONG&gt;evalinsert&lt;/STRONG&gt; - makes for cleaner looking strings.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = open("$sample_data\big class.jmp");
dbc = create database connection("&amp;lt;proper connection parameters&amp;gt;");
for (i = 1, i &amp;lt;= nrows(dt), i++,
	one_name = dt:name[i];
	one_age  = dt:age[i];
	one_sex  = dt:sex[i];
	one_ht   = dt:height[i];
	one_wt   = dt:weight[i];
	sql = evalinsert(
"INSERT INTO big_class(name, age, sex, height, weight)
 VALUES('^one_name^', ^one_age^, '^one_sex^', ^one_ht^, ^one_wt^)");
	print(sql);
	execute sql(dbc, sql);	// Does an implicit commit
);
close database connection(dbc);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you have a lot of rows to insert consider doing multiple inserts at a time.&amp;nbsp; In Oracle you can use &lt;A href="https://www.techonthenet.com/oracle/questions/insert_rows.php" target="_self"&gt;INSERT ALL&lt;/A&gt; to insert multiple rows at a time.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 14 Jun 2019 18:46:27 GMT</pubDate>
    <dc:creator>pmroz</dc:creator>
    <dc:date>2019-06-14T18:46:27Z</dc:date>
    <item>
      <title>connect to SQL databse programmatically</title>
      <link>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/3964#M3964</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am trying to connect to an SQL database in a script using the&lt;/P&gt;&lt;P&gt;Open Database command.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, when I work interactively, I create a "Machine Data Source" from&lt;/P&gt;&lt;P&gt;the database conect widget. When I connect, a window opens up asking&lt;/P&gt;&lt;P&gt;for username and password. When I insert them, I can succesfully connect&lt;/P&gt;&lt;P&gt;to the database and import tables into JMP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So I would like to try the same from a script. Unfortunately, I don't see&lt;/P&gt;&lt;P&gt;where I would insert the username and password. When I try to connect&lt;/P&gt;&lt;P&gt;I get the following error message in the log window.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user ''. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I guess this is not surprising since I didn't specify how to authenicate...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code is&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;DataBase = Open Database(&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "DSN=myDatabase", // data source&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "myTablename", //table&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; "JMPtable" // new table name&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: courier new,courier;"&gt;);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So how can I specify my authentication details?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ciao,&lt;/P&gt;&lt;P&gt;Paolo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Nov 2011 09:46:29 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/3964#M3964</guid>
      <dc:creator>paologrigis</dc:creator>
      <dc:date>2011-11-04T09:46:29Z</dc:date>
    </item>
    <item>
      <title>connect to SQL databse programmatically</title>
      <link>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/3965#M3965</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Paolo,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You need the proper DSN connect string.&amp;nbsp; To get this, run the command &lt;STRONG&gt;File &amp;gt; Database &amp;gt; Open Table&lt;/STRONG&gt;.&amp;nbsp; Click &lt;STRONG&gt;Connect &lt;/STRONG&gt;and select your ODBC source.&amp;nbsp; You will be prompted for a username and password.&amp;nbsp; After entering that information, a list of schemas and tables will appear.&amp;nbsp; Select any (small) table and click &lt;STRONG&gt;Open Table&lt;/STRONG&gt;.&amp;nbsp; After that is read in click &lt;STRONG&gt;Disconnect&lt;/STRONG&gt;.&amp;nbsp; The JMP dataset that ges created will have two table variables: &lt;STRONG&gt;JSL&lt;/STRONG&gt; and &lt;STRONG&gt;SQL&lt;/STRONG&gt;.&amp;nbsp; If you click on them you will see the connect string and the SQL statement that was used.&amp;nbsp; You can double-click on the JSL variable to see it's value - it will look something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: #0000dd; font-size: 10pt;"&gt;Open Database&lt;/SPAN&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;(&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"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;"&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: navy; font-size: 10pt;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"SELECT * FROM myschema.mytable"&lt;/SPAN&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;)&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My example shows a typical Oracle database dsn string.&amp;nbsp; Yours will look slightly different for SQL Server.&amp;nbsp; Save this string - to use it programmatically you would do something like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;dsn_string &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: navy; font-size: 10pt;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"DSN=ODBC Databasexxx;UID=xxxx;PWD=xxxxxxx;DBQ=mydatabasexxxx;DBA=W;"&lt;/SPAN&gt; ||&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"APA=T;EXC=F;FEN=T;QTO=T;FRC=10;FDL=10;LOB=T;RST=T;BTD=F;BNF=F;"&lt;/SPAN&gt; ||&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"BAM=IfAllSuccessful;NUM=NLS;DPM=F;MTS=T;MDI=F;CSR=F;FWC=F;FBS=64000;TLO=O;"&lt;/SPAN&gt;;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;sql_string &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: navy; font-size: 10pt;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"select * from myschema.othertable"&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: #0000dd; font-size: 10pt;"&gt;open database&lt;/SPAN&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;(&lt;/STRONG&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;dsn_string&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: navy; font-size: 10pt;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt; sql_string&lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: navy; font-size: 10pt;"&gt;,&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"other table"&lt;/SPAN&gt;&lt;STRONG style="color: black; font-size: 10pt; font-family: 'Courier New';"&gt;)&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Nov 2011 13:33:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/3965#M3965</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2011-11-04T13:33:35Z</dc:date>
    </item>
    <item>
      <title>connect to SQL databse programmatically</title>
      <link>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/3966#M3966</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;that worked perfectly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ciao,&lt;/P&gt;&lt;P&gt;Paolo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Nov 2011 14:10:03 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/3966#M3966</guid>
      <dc:creator>paologrigis</dc:creator>
      <dc:date>2011-11-04T14:10:03Z</dc:date>
    </item>
    <item>
      <title>connect to SQL databse programmatically</title>
      <link>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/3967#M3967</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Mr. Mroz,&lt;/P&gt;&lt;P&gt;This is Kun. I have joined this group.&lt;/P&gt;&lt;P&gt;Thanks for your reply into this database connection question. Here i also used JMP to connect some MS Access database files by&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-size: 13px;"&gt;File &amp;gt; Database &amp;gt; Open Table&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp; . I wonder the password and ID you are discussing is for an access file or it is for a sever where the database files were saved? If the PW and ID is for a Access file, where i can set these parameters?&lt;/P&gt;&lt;P&gt;Kun&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Nov 2011 14:15:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/3967#M3967</guid>
      <dc:creator>GoodMan</dc:creator>
      <dc:date>2011-11-04T14:15:37Z</dc:date>
    </item>
    <item>
      <title>connect to SQL databse programmatically</title>
      <link>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/3968#M3968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Kun,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You would use whatever is listed for the &lt;STRONG&gt;JSL &lt;/STRONG&gt;variable in your dataset that resulted from reading an Access table.&amp;nbsp; You don't really "set parameters" for userid and password - you just build a connection string and use it.&amp;nbsp; I don't know if Access has the capabillity of using usernames and passwords.&amp;nbsp; Here's a connection string that I used for an Access database.&amp;nbsp; Note that there is no username/password.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: green; font-size: 10pt;"&gt;// Data Source&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: black; font-size: 10pt;"&gt;dsn_string &lt;/SPAN&gt;&lt;SPAN style="font-family: 'Courier New'; color: navy; font-size: 10pt;"&gt;=&lt;/SPAN&gt; &lt;SPAN style="font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"DSN=MS Access Database;"&lt;/SPAN&gt; ||&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"DBQ=C:\Discovery2011\JMP Surveillance1.accdb;"&lt;/SPAN&gt; ||&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"DefaultDir=C:\Discovery2011;DriverId=25;"&lt;/SPAN&gt; ||&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Courier New'; color: purple; font-size: 10pt;"&gt;"FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;UID=admin;"&lt;/SPAN&gt;;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Nov 2011 19:27:05 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/3968#M3968</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2011-11-04T19:27:05Z</dc:date>
    </item>
    <item>
      <title>connect to SQL databse programmatically</title>
      <link>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/3969#M3969</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Mr. Mroz,&lt;/P&gt;&lt;P&gt;i did some research into user/password set from the side of MS Access.Basing the current information, we did have a way to set password for a&amp;nbsp; MS Access file. You can visit the following link to get some ways.It seems i can not find way to set username for access file.&lt;/P&gt;&lt;P&gt;&lt;A class="active_link" href="http://office.microsoft.com/en-us/access-help/CH001010607.aspx?CTT=97"&gt;http://office.microsoft.com/en-us/access-help/CH001010607.aspx?CTT=97&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have tested add 123 as password for the Northwind.mdb. And try to connect it with mdb. If i operate with menu, a prompt window will ask me ID/PW. after i insert"123". i can get the database file and open table.Then i disconnect and get the following JSL. You can find there are PWD and UID information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P style="text-align: left; padding: 0pt; margin: 0pt;"&gt;Open Database(&lt;/P&gt;&lt;P style="text-align: left; padding: 0pt; margin: 0pt;"&gt;&amp;nbsp; "DSN=MS Access Database;DBQ=D:\My Business\Supplier\IT\Access\Northwind.mdb;DefaultDir=D:\My Business\Supplier\IT\Access;DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;PWD=123;UID=admin;",&lt;/P&gt;&lt;P style="text-align: left; padding: 0pt; margin: 0pt;"&gt;&amp;nbsp; "SELECT * FROM Customers"&lt;/P&gt;&lt;P style="text-align: left; padding: 0pt; margin: 0pt;"&gt;)&lt;/P&gt;&lt;DIV style="text-align: left;"&gt; &lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After i close all table, i run it, i find i can open the password protected access table.But if i can not obtain that window to specify the&amp;nbsp; authentication process.&lt;/P&gt;&lt;P&gt;I have tested to change PWD=123 to ***. It does not work.&lt;/P&gt;&lt;P&gt;Can you give me some input? &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 05 Nov 2011 02:40:50 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/3969#M3969</guid>
      <dc:creator>GoodMan</dc:creator>
      <dc:date>2011-11-05T02:40:50Z</dc:date>
    </item>
    <item>
      <title>connect to SQL databse programmatically</title>
      <link>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/3970#M3970</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I haven't used passwords with Access databases.&amp;nbsp; If you don't hear from someone on this forum I'd suggest contacting JMP tech support.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 07 Nov 2011 14:32:48 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/3970#M3970</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2011-11-07T14:32:48Z</dc:date>
    </item>
    <item>
      <title>Re: connect to SQL databse programmatically</title>
      <link>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/3971#M3971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"&lt;SPAN style="font-size: 10pt; line-height: 1.5em; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;The JMP dataset that gets created will have two table variables: &lt;/SPAN&gt;&lt;STRONG style="font-size: 10pt; line-height: 1.5em; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;JSL&lt;/STRONG&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt; and &lt;/SPAN&gt;&lt;STRONG style="font-size: 10pt; line-height: 1.5em; font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;SQL"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;Solved my own problem, but thought i would share here as well:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;If you do not see the two table variables "JSL" and "SQL"&amp;nbsp; or "Source", they are being hidden due to preferences. &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;run this JSL script to solve the problem:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;pref(ODBC Hide Connection String(0)); &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 25 Mar 2014 18:16:35 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/3971#M3971</guid>
      <dc:creator>jmpbeginner</dc:creator>
      <dc:date>2014-03-25T18:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: connect to SQL databse programmatically</title>
      <link>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/212862#M42602</link>
      <description>Hi,Mr. Mroz,&lt;BR /&gt;Appreciate your sharing.&lt;BR /&gt;I am learning JMP connection to database; based on your script, I am able to open database.&lt;BR /&gt;My next question is, how to insert a line (lines) into the existing tables in the database.&lt;BR /&gt;I could get the following:&lt;BR /&gt;(1). existing_col_names=Current data table() &amp;lt;&amp;lt; get column name( string);&lt;BR /&gt;(2). get new values (in matrix ) by new_values= dt &amp;lt;&amp;lt; Get As Matrix();&lt;BR /&gt;How to append the new_values into the existing table in database?&lt;BR /&gt;&lt;BR /&gt;Best Regards,&lt;BR /&gt;WGan&lt;BR /&gt;</description>
      <pubDate>Thu, 13 Jun 2019 01:45:57 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/212862#M42602</guid>
      <dc:creator>wu</dc:creator>
      <dc:date>2019-06-13T01:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: connect to SQL databse programmatically</title>
      <link>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/213136#M42651</link>
      <description>&lt;P&gt;Here's a simple example using Big Class that should get you started.&amp;nbsp; It inserts all the rows into a database table called big_class.&amp;nbsp; Note the use of &lt;STRONG&gt;evalinsert&lt;/STRONG&gt; - makes for cleaner looking strings.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;dt = open("$sample_data\big class.jmp");
dbc = create database connection("&amp;lt;proper connection parameters&amp;gt;");
for (i = 1, i &amp;lt;= nrows(dt), i++,
	one_name = dt:name[i];
	one_age  = dt:age[i];
	one_sex  = dt:sex[i];
	one_ht   = dt:height[i];
	one_wt   = dt:weight[i];
	sql = evalinsert(
"INSERT INTO big_class(name, age, sex, height, weight)
 VALUES('^one_name^', ^one_age^, '^one_sex^', ^one_ht^, ^one_wt^)");
	print(sql);
	execute sql(dbc, sql);	// Does an implicit commit
);
close database connection(dbc);
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you have a lot of rows to insert consider doing multiple inserts at a time.&amp;nbsp; In Oracle you can use &lt;A href="https://www.techonthenet.com/oracle/questions/insert_rows.php" target="_self"&gt;INSERT ALL&lt;/A&gt; to insert multiple rows at a time.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2019 18:46:27 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/213136#M42651</guid>
      <dc:creator>pmroz</dc:creator>
      <dc:date>2019-06-14T18:46:27Z</dc:date>
    </item>
    <item>
      <title>Re: connect to SQL databse programmatically</title>
      <link>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/214035#M42794</link>
      <description>&lt;P&gt;Thank for your sharing, it is very helpful !&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2019 03:43:04 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/214035#M42794</guid>
      <dc:creator>wu</dc:creator>
      <dc:date>2019-06-21T03:43:04Z</dc:date>
    </item>
    <item>
      <title>Re: connect to SQL databse programmatically</title>
      <link>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/568519#M77921</link>
      <description>&lt;P&gt;&lt;a href="https://community.jmp.com/t5/user/viewprofilepage/user-id/2615"&gt;@jmpbeginner&lt;/a&gt; ,&lt;/P&gt;
&lt;P&gt;your response is actually very valuable.&lt;/P&gt;
&lt;P&gt;Thank you very much!&lt;/P&gt;
&lt;P&gt;Ron&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 Nov 2022 22:32:49 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/connect-to-SQL-databse-programmatically/m-p/568519#M77921</guid>
      <dc:creator>ron_horne</dc:creator>
      <dc:date>2022-11-12T22:32:49Z</dc:date>
    </item>
  </channel>
</rss>

