|
<< Click to Display Table of Contents >> Navigation: Telegram > 2020 > 11 > 23 > Telegram_2020-11-23T12 |
2020-11-23T12:01:26
Do you have any example where something similar is handled?
2020-11-23T12:01:53
There is a thread demo in our demos
2020-11-23T12:02:40
Many dbs require an extra step when used in threads as well
2020-11-23T12:04:21
I want to open a data table made in MYSQL from a Thread when my server starts. That same table will be opened by users who open a session on my server.
Can you help me with that task? Thank you.
2020-11-23T12:09:15
You need to see if the mysql client library you are using needs any special steps to be used in a thread. That is where I would start. Many DB client libs require a special step when used in threads. Most likely your issue is around this.
2020-11-23T12:10:49
Okay. I'm going to check the MYSQL documentation
2020-11-23T12:11:17
Are you accessing anything other than the DB in your threads?
2020-11-23T12:13:54
I create a text file to keep track of my routine. I took it off and he behaves the same. I open the file and loop through it sequentially to get all the records in an array, then I evaluate that array and with the results I go to the data file and make updates with UPDATE. Everything works as long as a session is not opened on my server.
2020-11-23T12:15:04
do you access the text file from a session as well?
2020-11-23T12:15:14
or any other shared objects?
2020-11-23T12:15:41
No. It is temporal
2020-11-23T12:16:20
Then most likely not taking the steps that the mysql client lib needs for threading is the most likely issue.
2020-11-23T12:18:11
Ok.
2020-11-23T12:18:36
Many DB clients create an auto session, but when threaded you need an explicit session to be created for each thread.
2020-11-23T12:22:11
How do I create a specific session for each thread? There are no examples of that case.
2020-11-23T12:23:27
Im not sure if mysql requires this or not, but if so its a mysql client library issue for any use in threads, not something specific to IntraWeb so I would suggest you seek support from a generic Delphi forum on how to use the mysql client library you are using from within a thread.
2020-11-23T12:25:13
Okay. I'll keep looking.
2020-11-23T12:26:10
I use FIREDAC
2020-11-23T12:26:29
Then I would ask on the firedac support forums about using firedac from within threads.
2020-11-23T12:30:38
type: link http://docwiki.embarcadero.com/RADStudio/Sydney/en/Multithreading_(FireDAC)
2020-11-23T12:32:40
I am reviewing it