Welcome! Log In Create A New Profile

Advanced

[WD12] Problems defining a MySql Connection

Posted by Gianni Spano 
Gianni Spano
[WD12] Problems defining a MySql Connection
June 26, 2009 09:22AM
Hello to all

My Scenario:
I have a project that use a MySql db stored on development machine as "localhost".

During the "Initialization" of the project, the connection is defined reading some info
stored in a .INI file (this below is an example of my .ini file)

[Connessione]
SERVERNAME=SERVERFARMA
SERVERIP=192.168.6.222
DATABASE=ASL_SpFarma
COMANDO1=COMANDO1.CMD
NETDRIVE=K:
IPSIPES=\\192.168.1.244\SIPES$
FILEFARMA1=\DATI\U1FFARM1
FILEFARMA2=\DATI\U1FFARM2
NETFOLDER=SPFARMA$

When i install the application on a client machine, despite i have described the new connection (that must be read from the .ini file) the program still try to connect to "localhost", generating, of course, an error message.

This is my code in the "Initialization" code of the project:

SERVERNAME= INIRead ("CONNESSIONE","SERVERNAME","X",fExeDir() + "\asl.ini")
SERVERIP = INIRead ("CONNESSIONE","SERVERIP","X",fExeDir() + "\asl.ini")
gnDistretto= INIRead ("CONNESSIONE","DISTRETTO","X",fExeDir() + "\asl.ini")
DATABASE=INIRead ("CONNESSIONE","DATABASE","X",fExeDir() + "\asl.ini")
COMANDO1=INIRead ("CONNESSIONE","COMANDO1","X",fExeDir() + "\asl.ini")
COMANDO2=INIRead ("CONNESSIONE","COMANDO2","X",fExeDir() + "\asl.ini")

HourGlass(True)
USERID="root"
PWD="mypass"

ServerFarma is Connection

// Connection Settings
ServerFarma..Provider = hNativeAccessMySQL
ServerFarma..User = USERID
ServerFarma..Password = PWD
ServerFarma..Server = SERVERIP
ServerFarma..Database = DATABASE
ServerFarma..Access = hOReadWrite


// Opening the connection
connresult=HOpenConnection(ServerFarma)
HChangeConnection("*",ServerFarma)

the "connresult" variable returns "True", also if you try to put a non existent IP Address.

I don't know the reason of this beahviour and i can't imagine where to find further
informations to solve this issue....

Some ideas??
Help is very appreciated.

Gianni
christoph
Re: [WD12] Problems defining a MySql Connection
June 26, 2009 10:15AM
Hello Gianni,

you can try the command : sqlconnect(...). Maybe there is a better error-management and you can see, what is wrong.

Christoph
Hi Chris

Long time i don't hear from you!!!

Yes, i can use this command, but i have resolved the issue using "HdescribeConnection" with all the parameters passed by a read from the .ini file...

The strange thing is: Why when i use the connection wizard (as i had used before) the connection is not accepted, generating reading error when you use "Hreadseek"??

Now it seems to work ok..

Thank you again...

Gianni
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: