PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → HFSQL with no pre-defined connection
HFSQL with no pre-defined connection
Débuté par Donald Montaine, 12 jan. 2018 00:30 - 6 réponses
Posté le 12 janvier 2018 - 00:30
What is the best way to set up a system that logs into one of several remote HFSQL CS
identical database servers based on the configuration in a local file. Right now I just change data.myhost.com in the client hosts file to point to the server I want. The connection in the analysis just says to connect to data.myhost.com.
Posté le 12 janvier 2018 - 01:09
Hi Donald,

1. don't define any connection in the analysis
2. Define all your files in the analysis as HF CLASSIC
3. In the project init code, point otward the server you want with a hchangeConnection. Generally this is done by reading an ini file, but yo can do that anyway you want

Best regards
Posté le 12 janvier 2018 - 17:16
Thank you Fabrice

I just assumed that the analysis had to match the target. Didn't realize that a Classic analysis could be used with a client server database.
Posté le 12 janvier 2018 - 18:52
Hi Donald

any type of file in the analysis can be matched with any other type of file in execution... AS LONG AS you don't use something that is specific to an environment (by example, arrays of item are hf specific, timestamp don't work on all platform, and so on).

The analysis is just a logical structure definition... It is NOT a database...

Best regards
Posté le 13 janvier 2018 - 01:14
OK - Here is what I came up with to match my needs:

In the analysis I have created three connections

LocalClassic is a local classic database with the files stored in the application directory
LocalServer is a local HFSQL/CS database on my development computer
RemoteServer is an HFSQL/CS database on another computer. Right now it is a computer on my local network, but could be anywhere on the internet.

I have attached the code I use in the initialization section of the project and a screen shot of the selection window if no connection name is found in the .ini file.

Any comments or suggestions are appreciated. This code works as designed, but one interesting anomaly is that the local classic files always get created in test mode, but once the exe is created and run, they do not get created unless the local classic database is chosen.

[attachment 2562 Code.JPG]

[attachment 2561 Window.JPG]
Posté le 13 janvier 2018 - 12:50
as I was saying, your problem is that you are creating connections in the analysis...

REMOVE ALL connections from the analysis, and define them BY CODE ONLY...

This way, you will not have the following problems:
- HF classic files created when they shouldn't
- 30 sec or more of waiting at startup because the program is trying to reach an unreachable server (define in the analysis but not reachable when deployed)
- ...


Best regards
Posté le 13 janvier 2018 - 16:18
Thanks. I am planning to do that in the final deployed version. While testing I just did it this way for convenience and to understand better how connections work.