If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > using mysql, can i have a trigger that calls a VBS file

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-08-10, 08:04
mathew_wise mathew_wise is offline
Registered User
 
Join Date: Sep 2006
Posts: 11
using mysql, can i have a trigger that calls a VBS file

using mysql, can i have a trigger that calls a VBS file?
Reply With Quote
  #2 (permalink)  
Old 12-08-10, 08:19
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,408
No, you cannot
Reply With Quote
  #3 (permalink)  
Old 12-08-10, 08:20
mathew_wise mathew_wise is offline
Registered User
 
Join Date: Sep 2006
Posts: 11
can the trigger run vb within it?
Reply With Quote
  #4 (permalink)  
Old 12-08-10, 08:31
shammat shammat is offline
Registered User
 
Join Date: Nov 2003
Posts: 2,408
No, it cannot.

Why don't you read the manual? Triggers are well documented there...
Reply With Quote
  #5 (permalink)  
Old 12-08-10, 09:00
mathew_wise mathew_wise is offline
Registered User
 
Join Date: Sep 2006
Posts: 11
agerled instance

is there any way around this? can the trigger call a Stored Procedures can can run a batch file, vbs or some vb? on a windows server?
Reply With Quote
  #6 (permalink)  
Old 12-08-10, 09:59
mathew_wise mathew_wise is offline
Registered User
 
Join Date: Sep 2006
Posts: 11
called ourred

what about sending a email from a trigger?
Reply With Quote
  #7 (permalink)  
Old 12-08-10, 14:12
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 623
Hi Mathew,

what exactly are you looking to achieve? It looks like you would like an event to be triggered on some data being added to the database. Is this correct? If you can provide more information about what you are trying to do I am sure we can suggest alternative ways of doing this.
__________________
Ronan Cashell
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
  #8 (permalink)  
Old 12-09-10, 06:15
mathew_wise mathew_wise is offline
Registered User
 
Join Date: Sep 2006
Posts: 11
What I want to do is call a dll. The script is basally I need to call this script

Dim TCAPI, Session, TaskItem
Set TCAPI = CreateObject("Iwcltcp.TCAPI")
Set Session = TCAPI.Logon(logon, "localhost", "username", "password")
Set TaskItem = Session.OpenTaskItem(13)
TaskItem.QueueTask

The dll will be local on a windows server. I don’t mind running the script in the trigger or calling a vbs file.
If this cannot be done then I can pick up an email as long as I can passed column information from the trigger (column id or order id)
Reply With Quote
  #9 (permalink)  
Old 12-09-10, 06:33
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 623
Off the top of my head I can see two potential solutions here:

1. A batch process that runs every minute that identifies the new entries and sends out the emails.
2. The insert statement is being executed by some process into the table. If this is in VB then have this process send out the email.

As I said previously it is not possible to execute VB code inside a trigger so alternatives is all we can go with. I have used both above on other projects and these appear to work fine.
__________________
Ronan Cashell
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
  #10 (permalink)  
Old 12-09-10, 06:47
mathew_wise mathew_wise is offline
Registered User
 
Join Date: Sep 2006
Posts: 11
aston hemerno

how can i write a btach process to check?

how can i do the secord option?
Reply With Quote
  #11 (permalink)  
Old 12-09-10, 06:57
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 623
A batch process is something that is scheduled to run every x minutes. The process itself is quite simple i.e. find all the records that have been added since the last check and then process each of these one by one. The process will be responsible for connecting to the database and to query the database for these records. If you have a timestamp on the records added then you can use this to determine the records that have been inserted. Otherwise you could create a second table which will contain the primary key columns of your main table. An insert trigger can be created that will simply add the record to the secondary table.

The other alternative, you would need to investigate what process is inserting the information into the database and in particular into this table. The next line after the insert you could add your lines of VB code to send out the email.
__________________
Ronan Cashell
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
  #12 (permalink)  
Old 12-09-10, 11:04
mathew_wise mathew_wise is offline
Registered User
 
Join Date: Sep 2006
Posts: 11
thanks for your help. i have resovled my problem. i wanted to stay away from rechecking the database every few mins.

what i have have done is added if statements to my insert php pages. so when the right data matches the php pages then sends an email with the information need in teh subject. i am then pick up that email and do what i need to do.

i think this is a better way because this does not matter there the DB is (will work outside teh domain or on a non windows server.)

thanks for your email.
Reply With Quote
  #13 (permalink)  
Old 12-11-10, 13:20
it-iss.com it-iss.com is offline
Registered User
 
Join Date: Sep 2009
Location: San Sebastian, Spain
Posts: 623
I agree with your choice here. Selecting the contents of a database periodically is a drain on resources. Handling the process where the VB code is adding the record into the database minimizes using the resources on your server.
__________________
Ronan Cashell
Senior Oracle/MySQL DBA
http://www.it-iss.com
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On