cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • See how to use the JMP Marketplace – Free tools to expand JMP capabilities. Register. July 10, 2 pm US Eastern Time.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
miguello
Level VII

How to check if "Create Database Connection" is successful?

Many of my scripts connect to a DB as soon as they are started. DB is in intranet, so users need to:

1. Be connected to internal network OR have VPN on

2. Have ODBC source set up correctly

 

Sometimes they don't. 

I want to warn users that the DB is not available instead of script erroring on them. What would be a correct way of checking if "Create Database Connection" was successful and returned a valid handle?

 

Thanks, 

M.

2 REPLIES 2
miguello
Level VII

Re: How to check if "Create Database Connection" is successful?

Is Scriptable(dbc);

works just fine, anybody has a code snippet with modal window that would just close the whole AddIn in case it evaluates "0"?

 

Thanks, 

M.

pmroz
Super User

Re: How to check if "Create Database Connection" is successful?

You could try logic like this:

my_dbc = create database connection("foobar");

if (isempty(my_dbc) | is missing(my_dbc),
	_nw = new window("Create DBC: Empty Value", << modal,
		textbox("Error: The database connection is empty."),
		);
		throw("Empty database connection string");
);

Recommended Articles