Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 4 Jahren, 4 Monaten
Letzter Beitrag:
vor 4 Jahren, 3 Monaten
Beteiligte Autoren:
Charles U. Schneiter, GuenterP, Piet van Zanten, Bart VDE, David Martin, Paulo Oliveira, B.Rohde, Fabrice Harari

HFSQL classic to HFSQL Client Server -- Name of Server

Startbeitrag von B.Rohde am 18.09.2013 07:01

I have an application which runs in HFSQL Classic Mode that uses an UNC-path on a server.
To change the application to HFSQL C/S, I used a notebook, where I installed the Server (WD18).
The Server got the name of the notebook, i.e. "MyNote".

In the analysis I converted all files to the C/S-Mode and connected to the C/S server "MyNote".
The application now runs in C/S-Mode -- no problem.
I prepared the new application in the code-section "Initializing..." to connect to a C/S either "MyNote" or "CustServer" (see below) by parameters:

// Code-Lines in Project-INITIALIZING-Section like this
gctDBConnection is connection
gctDBConnection..Server ---
gctDBConnection..User ---
some more gctDBConnection..

The application now runs in C/S-Mode -- no problem. The app finds "MyNote" and connects to the C/S-server.

The next step was : install the HFSQL-C/S-server "CustServer"on the customer machine (WD18).

The installation-process of the HFSQL C/S-server was correct. The CC-Center runs, the databases are at the ..\BDD-path (I copied the files manually) and the files can be accessed.

The next step was : install the new application on the customer-Server "CustServer". - No errors -
But now, when I start the application, there is no connection to "CustServer". The new application wants to connect to the "MyNote"-server.

What goes wrong in my method?

I tried to add an additional "CustServer" connection to the Analysis, but in my office certainly: no "CustServer" is available.

How can I force to connect to "CustServer"? or
What did I miss in my code or the Analysis?

I´ll be very happy for hints!

Best Regards


You don't need to change the Analysis, in the init code of your project just use HDescribeConnection, HOpenConnection, HChangeConnection

Check this page in the help:

von Paulo Oliveira - am 18.09.2013 08:27
Hi Bertrand

I personnaly always keep my anamlysis files as HF classic, and change the connection with hchangeconnection in the project init code...

But to solve your immediate problem, what you need to do is go in the analysis and DELETE the existing connection, not add one. It's the connection described in the analysis that is used and creates your problem

Best regards

von Fabrice Harari - am 18.09.2013 12:37
Hi Bertrand,

this is one of the most common pitfalls with WinDev. If you're developing for HyperFileSQL C/S NEVER put a connection into the analysis! Always develop like you would develop for HyperFileSQL Classic! If not, you will find this infamous analysis-connection all over your program and you will experience many problems where there shouldn't be any. Just connect within the Project Code to the database by using HOpenConnection / HChangeConnection / HChangeDir to all of your files.

// Connection to HFCSDatabase
MyConnection..User = NoSpace(MyHFCSAdminName)
MyConnection..Password = NoSpace(MyHFCSAdminPassword)
MyConnection..Database = NoSpace(MyDatabaseName)
MyConnection..Server = MyServerAndPort
MyConnection..Provider = hAccessHFClientServer
MyConnection..Access = hOReadWrite
MyConnection..CursorOptions = hServerCursor+hDynamicCursor+hOptimisticCursor
MyConnection..ExtendedInfo = ""
MyConnection..CryptMethod = hCryptStandard

IF NOT HOpenConnection(MyConnection) THEN
Error("HFSQL: HOpenConnection: ","Die Verbindung zu "+MyServerAndPort + " kann nicht errichtet werden !",HErrorInfo(hErrFullDetails))

MyConnectionName = MyConnection..Name

//Info("Connection "+MyConnectionName+" established successfully !","Database "+MyConnection..Database+" found / generated !")

// Die Verbindung aller Dateien einrichten:
// Fehler aufgetaucht:
EndProgram("HFSQL: Fehler bei HChangeConnection aufgetreten !",HErrorInfo(hErrFullDetails))

Now you'd have succefully made a connection to your server, which doesn't mean that files are created / opened. This could be a rather complex or a simple and lightweight process like HCreationIfNotFound("*")

von GuenterP - am 18.09.2013 13:36
this is one of the most common pitfalls with WinDev. If you're developing for HyperFileSQL C/S NEVER put a connection into the analysis! ...

// Connection to HFCSDatabase
MyConnection..Server = MyServerAndPort

Hi Guenter et al ;),
Thanks for this very helpful tip I found thru searching here!

What I am struggling to do, is to find out the Server's (actually the computer's..) name.
Since I do develop on two different computers, I can not just change the server's name each time I change from machine to machine.

What I would like to do, is find out the current machine's name and depending on this alter my connection as per your script you kindly provided above.


If computer name = machine1
MyConnection..Server = "machine1:4900"
If computer name = machine2
MyConnection..Server = "machine2:4900"

As simple as it seems, I can't seem to get at the machine's name :-(

What do I miss?

Thanks for your input!

von Charles U. Schneiter - am 30.09.2013 15:31
Hi Charles,

imho it is not necessary to know the name of the physical server-computer - you just have to know the IP-address and the port of the server where to access the daemon or the Windows service. So, e.g. one server's address could be and the other's

von GuenterP - am 30.09.2013 16:06
ExtractString(SysEnvironment("COMPUTERNAME"), 2, "=")

von David Martin - am 30.09.2013 16:46
What about localhost?

Regards, Piet

von Piet van Zanten - am 30.09.2013 19:32
Or the function NetMachineName()


von Bart VDE - am 01.10.2013 07:40
Thanks for taking the time, most appreciated!

Both, David's and Bart's solutions work fine for me :spos:

I learn something very day :cheers:

von Charles U. Schneiter - am 01.10.2013 08:44
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.