NetTalk Central

Author Topic: NT server and multi database access  (Read 6914 times)

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
NT server and multi database access
« on: February 26, 2018, 08:55:15 AM »
Hi, Using MsSql I have a global variable to hold the Connection string and this variable is in all tables
Owner Name = !GLO:SqlConnect
I need to connect to databases depending on the User.
User1 and User2 and Usernn will access the same web server but depending on the user I need to connect and use a different database.
The Conn String of each User could be in a TPS files, read it depending on the user and then connect to the user database.

Setting GLO:SqlConnect in p_web.ProcessLink before Parent call is OK?
Any use or check with the p_action param?

Thanks
« Last Edit: February 26, 2018, 09:15:09 AM by michelis »
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NT server and multi database access
« Reply #1 on: February 27, 2018, 06:17:54 AM »
GLO:SqlConnect must be ,THREAD

>> Setting GLO:SqlConnect in p_web.ProcessLink before Parent call is OK?

yes, this is what you do.

cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: NT server and multi database access
« Reply #2 on: February 27, 2018, 09:18:24 AM »
ok, but... making Glo:SqlConnect threaded, will it still function ok in the win32 app?
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NT server and multi database access
« Reply #3 on: March 01, 2018, 02:05:34 AM »
It can be threaded in the desktop app as well, but you must make sure it's set at the beginning of each thread. (there's an embed in the data dll that does that - let me know if you don't know it and I'll dig it out for you.)

cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: NT server and multi database access
« Reply #4 on: March 01, 2018, 03:32:00 AM »
Cant find it, please help.

When a threaded global variable has value, lets say I set it at thread 0, when I open a new thread it began balnked or maintaining the value?

-----------
Regards
Alberto

Thys

  • Sr. Member
  • ****
  • Posts: 311
    • View Profile
    • Incasu
    • Email
Re: NT server and multi database access
« Reply #5 on: March 05, 2018, 12:05:22 AM »
Hi,

If I'm not mistaken, this is the same problem we've had on desktop apps with MSSQL. It seems like Clarion's SQL drivers can only handle one connection at a time, event if the owner name variable is threaded. If that's the case, then to switch between connections you will need all open tables to the previous connection to be closed, and then the connection to the new db to be opened. It could be a solution, not sure.

Thys

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NT server and multi database access
« Reply #6 on: March 05, 2018, 07:30:45 AM »
Hi Thys,

I'm sure you've had problems, but this conclusion is inaccurate. There are web servers all over the place using multiple connections to multiple databases without it being a problem. It's more likely your BusyHandling, or MARS settings were not correct.

Cheers
Bruce


Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NT server and multi database access
« Reply #7 on: March 05, 2018, 07:36:36 AM »
Hi Alberto,

>> Can't find it, please help.

In data DLL, Global Embed
"After dictionary initialization"
That happens on all threads except thread 1.
(in some cases you want to set it in a different place for thread 1, depending on where you are getting the value from etc. - so usually the Program Setup embed, also in the data dll.)


>> When a threaded global variable has value, lets say I set it at thread [1],
when I open a new thread it began blanked or maintaining the value?

It starts each thread as blank.

cheers
Bruce


Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: NT server and multi database access
« Reply #8 on: March 14, 2018, 02:06:02 PM »
Bruce, is this related to the Chuck ODBC memory liking problem?
Im using MSSQL driven but I think I will have the same problem.
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NT server and multi database access
« Reply #9 on: March 16, 2018, 12:01:37 AM »
no, this has nothing to do with Chucks memory leak.

cheers
Bruce

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: NT server and multi database access
« Reply #10 on: March 19, 2018, 11:07:22 AM »
Why you say that? Chuck problem begins making the owner variable threaded no?
And this is what I need to use multiple databases...
-----------
Regards
Alberto

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: NT server and multi database access
« Reply #11 on: March 19, 2018, 11:13:53 PM »
The memory leak is in the ODBC driver, and you are using the MsSql driver.

cheers
Bruce