cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
Mauro_Gerber
Level IV

catch Sql Query error

Hello

I want to update a database via the New SQL Query function:

Names Default To Here( 1 );
obj = New SQL Query(
	Connection("DB connection string"),
	Custom SQL "
		UPDATE table
			SET Column_1 = 1
		where Column_2 = '2'
	")
);
Error_Msg = Log capture( obj << Run;);

I get the following error message:

""
Error running SQL Query:
[Server] Invalid object name table

Log Capture only get the empty "" string. So i don't know if the query was successful since it returns an empty string when no error occurs.

 

simmilar topic but with open database: https://community.jmp.com/t5/Discussions/Catching-database-error-message/m-p/6749#M6743

"I thought about our dilemma, and I came up with a solution that I honestly think works out best for one of both of us"
- GLaDOS
11 REPLIES 11
pmroz
Super User

Re: catch Sql Query error

You might want to surround your code with these statements to force all error messages to the log:

 

batch interactive(1);

<your code>

batch interactive(0);

Mauro_Gerber
Level IV

Re: catch Sql Query error

Hello @pmroz 
THX, I was about to write a new entry because I run into the "JMP alert" message pop up and the log captured didn't work. I found the following entry: Post about JMP alert with your solution.

"I thought about our dilemma, and I came up with a solution that I honestly think works out best for one of both of us"
- GLaDOS