cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
Dennisbur
Level IV

to connect to database through SQL

Hello

I would like to connect to the database through an SQL query.

I have written the JSL script

 

dt = Open Database (
                          "DRIVER = {SQL Server};
                          SERVER = HAISQLC162\HAISQLC162,3187
                          UID = hw_tests_viewer
                           PWD = ********
                           DATABASE = HW_Chip_Tests;"
,
"SELECT *

FROM [HW_Chip_Tests].[viewer].[chip_tests_row_data_3m_v]
where VID = 'S232NNC300578' "
);

but received error note:  Data source name not found and no default driver specified

what I did wrong?

Dennisbur_0-1711971995870.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: to connect to database through SQL

To me it looks like the connection string is in wrong format. Usually they look like something like this

Driver={SQL Server};Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

how it exactly looks like depends on your database, your driver, settings on PC and so on.

 

 

You can also try to create the connection using JMPs query builder and extract the connection string from there (it will Use New SQL Query instead of Open Database which I would also suggest you use as that is the method which is supposed to be supported in the future of JMP). The connection string it creates will be a bit different as it might prefix it with ODBC

 

-Jarmo

View solution in original post

2 REPLIES 2
jthi
Super User

Re: to connect to database through SQL

To me it looks like the connection string is in wrong format. Usually they look like something like this

Driver={SQL Server};Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;

how it exactly looks like depends on your database, your driver, settings on PC and so on.

 

 

You can also try to create the connection using JMPs query builder and extract the connection string from there (it will Use New SQL Query instead of Open Database which I would also suggest you use as that is the method which is supposed to be supported in the future of JMP). The connection string it creates will be a bit different as it might prefix it with ODBC

 

-Jarmo
pmroz
Super User

Re: to connect to database through SQL

Not sure if it's easier but you can also try File > Database > Open Table.  You might need to create an ODBC user source.  Once you open a table from SQL Server, you can find the connection string under the red or green triangle (depends on which version of JMP you are using).