cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP will suspend normal business operations for our Winter Holiday beginning on Wednesday, Dec. 24, 2025, at 5:00 p.m. ET (2:00 p.m. ET for JMP Accounts Receivable).
    Regular business hours will resume at 9:00 a.m. EST on Friday, Jan. 2, 2026.
  • We’re retiring the File Exchange at the end of this year. The JMP Marketplace is now your destination for add-ins and extensions.

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