NetTalk Central

Author Topic: Using Host app to run mssql and mysql  (Read 15308 times)

olu

  • Sr. Member
  • ****
  • Posts: 352
    • View Profile
    • Email
Using Host app to run mssql and mysql
« on: May 22, 2013, 01:43:57 AM »
Hello I have on a host app that I would like it to run two different application running on MySQL and mssql and using the fm3 connection procedure. Please anyone done this and how?

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Using Host app to run mssql and mysql
« Reply #1 on: May 22, 2013, 03:18:35 AM »
Hi Olu,

so to be clear;

you are running the Host.Exe example program?
and you've compiled 2 apps - both as DLL's and attached them to the program?
the DLL's are using different MsSql databases?

assuming all of the above - what problem are you having?

cheers
Bruce

olu

  • Sr. Member
  • ****
  • Posts: 352
    • View Profile
    • Email
Re: Using Host app to run mssql and mysql
« Reply #2 on: May 22, 2013, 04:50:31 AM »
Hi Bruce,
   Yes you are correct, but I keep getting connection error until I remove one of them and because both apps use fm3 do I need to add fm3 sql connection to the host program as well?

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Using Host app to run mssql and mysql
« Reply #3 on: May 22, 2013, 09:27:38 PM »
I presume both DLL's are using a variable like say
glo:owner
and this is _threaded_ ?

And you are setting the correct value of this in the WebHandler procedure, ProcessLink method, before parent call?

Is it just FM3 conversions that's not working - or are you completely unable to connect to the database?

cheers
Bruce

olu

  • Sr. Member
  • ****
  • Posts: 352
    • View Profile
    • Email
Re: Using Host app to run mssql and mysql
« Reply #4 on: May 22, 2013, 11:46:25 PM »
Hi Bruce,
    Thanks for reply. Ok how do I do this as at the moment I think properly that is where am going wrong as I am not doing any of the things you mentioned below:(but yes both are DLL's and using glo:owner)

I presume both DLL's are using a variable like say
glo:owner
and this is _threaded_ ?

And you are setting the correct value of this in the WebHandler procedure, ProcessLink method, before parent call?

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Using Host app to run mssql and mysql
« Reply #5 on: May 23, 2013, 01:39:00 AM »
Hi Olu,

There are a couple ways to do it, but the way I recommend is
a) glo:owner is threaded. this is a lot more flexible for you in the long run.
b) in the WebHandler, ProcessLink method, before parent call, set the glo:owner to the correct connection string.

Now in your case the string is likely to be the same value for all threads. However as you scale up you may want to make different users connect to different databases. By using this technique now you give yourself options later on.

If you don't know what should go into a connection string, then that's a slightly different topic. But get this part right first, then we can discuss that.

cheers
Bruce


olu

  • Sr. Member
  • ****
  • Posts: 352
    • View Profile
    • Email
Re: Using Host app to run mssql and mysql
« Reply #6 on: May 23, 2013, 04:50:05 AM »
Hi Bruce,
      So am I making this changes in the host program or my individual DLL's application and please what is the connection string that I need to use?

Thanks

lkeyser

  • Jr. Member
  • **
  • Posts: 69
    • View Profile
    • Email
Re: Using Host app to run mssql and mysql
« Reply #7 on: May 23, 2013, 05:30:47 AM »
Hi Bruce an Olu

I have the same question (How should the connection string typical look like using, FM3 with MS-SQL on your dll side ?
The multi-site documentation explains how to connect to tps file and i have done this on a few sites - works great:) Thanks Bruce

Lack of SQL connection string  "know how "stops me to converting to SQL.
Will be great if you can five us a sample.

Regards
Louis

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Using Host app to run mssql and mysql
« Reply #8 on: May 23, 2013, 03:57:16 PM »
I set the following in the webhandler process link method

Glo:dbOwner = clip(self.GetSessionValue('SHO:Server')) & ',' & Clip(self.GetSessionValue('SHO:Database')) & ',' & Clip(self.GetSessionValue('SHO:SQLUserName')) & ',' & Clip(self.GetSessionValue('SHO:SQLUserPassword'))


The session values are loaded when the user logs in so I am serving up data from multiple sql db's from the one program.

I'm not using multi-host but I think the above still applies.

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Using Host app to run mssql and mysql
« Reply #9 on: May 24, 2013, 02:15:11 AM »
Kevin's approach is correct.
Also - this goes in the WebHandler for each of your DLL's - not the host.

cheers
Bruce

olu

  • Sr. Member
  • ****
  • Posts: 352
    • View Profile
    • Email
Re: Using Host app to run mssql and mysql
« Reply #10 on: May 28, 2013, 12:52:51 PM »
Hi Bruce please can show with an example as i have tried the suggestions and not getting too far with this. Here is what i have done so far
i have add as suggested to webhandler of each dll app before parent code in the proceeslink  as fllows:

the MYSQL app
Glo:Owner = 'DRIVER=MySQL ODBC 5.1 Driver;SERVER=101.1.150.3;USER=olu;PASSWORD=olu;DATABASE=test;'

the MSSQL app
Glo:Owner = 'OLU-LAPTOP\OLUSQL' & ',' & 'test2' & ',' & 'mide' & ',' & 'olu'

Do i take out fm3 in this apps and only have fm3 in host?

i did add a message to sql_connect procedure to show Glo:Owner and it is alway blank. Not sure how fm3 works and to be honest i am really confused  so please help.

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Using Host app to run mssql and mysql
« Reply #11 on: May 29, 2013, 02:41:07 AM »
Try running one of the programs outside of Host app to narrow down the prob - it could be specific to running inside the host. Make sure glo:owner is threaded. SQL_Connect is irrelevant and apart from if you use it on startup, it should never be used again. Examine the code in the SQL_connect procedure to see what it does - it's more relevant for desktop apps where glo:dbowner is not threaded.

olu

  • Sr. Member
  • ****
  • Posts: 352
    • View Profile
    • Email
Re: Using Host app to run mssql and mysql
« Reply #12 on: May 29, 2013, 07:14:13 AM »
Thanks kevin,
      That did push me in the right direction, now got it working , by taking out fm3 off my dlls but still want to let fm3 handle file upgrades, any ideas how I can still make this happen?

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: Using Host app to run mssql and mysql
« Reply #13 on: May 29, 2013, 03:13:56 PM »
Just create a separate app to do the upgrades on startup. I've created one that loops through all my DB's.