New Question
 
 
PRTG Network Monitor

Intuitive to Use.
Easy to manage.

200.000 administrators have chosen PRTG to monitor their network. Find out how you can reduce cost, increase QoS and ease planning, as well.

Free PRTG
Download >>

 

What is this?

This knowledgebase contains questions and answers about PRTG Network Monitor and network monitoring in general. You are invited to get involved by asking and answering questions!

Learn more

 

Top Tags


View all Tags


MySQL V2 Fatal Error

Votes:

0

Your Vote:

Up

Down

Hello.

I need to create a sensor retrieving data from a MySQL database, but the table name is dynmaic. So i have to use a Prepared Statement to produce the query string first As in:

SET @c = '131';
SET @tb = CONCAT('hist_',YEAR(CURDATE()), LPAD(MONTH(CURDATE()),2,0));
SET @s = CONCAT('select truncate(sum(stime)/60,0) as min from ', @tb, ' where c_id=',@c,' and `time` > CURDATE()'); 
PREPARE stmt1 FROM @s; 
EXECUTE stmt1; 
DEALLOCATE PREPARE stmt1;

But I only get "Fatal Error encountered during command execution". I tried thru the gui from SQL_V2.exe, same result.

Can someone point me to the right direction i should take to make this work? Thank you very much.

custom-sensor mysql mysql-v2-sensor

Created on May 12, 2016 6:46:46 PM by  edm09 (0) 1

Last change on Aug 1, 2016 11:08:25 AM by  Luciano Lingnau [Paessler Support]



3 Replies

Votes:

0

Your Vote:

Up

Down

Dear edm09

While this could be a valid SQL statement, the code injection protection we use via Dotnet catches the EXECUTE command and prevents the execution. I am sorry, there is no way around this.

Created on May 13, 2016 12:43:16 PM by  Arne Seifert [Paessler Support]



Votes:

0

Your Vote:

Up

Down

Thanks.

I'll try to wrap it on a procedure and just call the proc, this should work right?

Created on May 13, 2016 12:48:35 PM by  edm09 (0) 1



Votes:

0

Your Vote:

Up

Down

Dear edm09

That should work.

Created on May 13, 2016 2:44:54 PM by  Arne Seifert [Paessler Support]



Please log in or register to enter your reply.


Disclaimer: The information in the Paessler Knowledge Base comes without warranty of any kind. Use at your own risk. Before applying any instructions please exercise proper system administrator housekeeping. You must make sure that a proper backup of all your data is available.