Welcome! Log In Create A New Profile

Advanced

WM24 Connection to DB question

Posted by cabinetman 
WM24 Connection to DB question
October 04, 2019 05:23PM
Hello All,

I have a question on connections to the DB for Windev Mobile on Android.

Can I have 2 connection to 2 different DBs open at the same time?
1 to the local and 1 to the server?

Is it possible to open a second connection to a server like this or is the a problem I will have that I can not see now.
Note: The connection will only happen to load and unload the data once a day.


//Describe the connection
HDescribeConnection(::m_serConName,::m_serUser,::m_serLogin,:m_serIP,::m_serDBName,hAccessHFClientServer)

//Open the connection
HOpenConnection(::m_serConName)

//Declare the exteranal files
HDeclareExternal(".\DeviceUsers.fic",:dsUs,::m_serConName)
HDeclareExternal(".\Scan.fic",:dsSc,::m_serConName)
HDeclareExternal(".\ScanReports.fic",:dsScRpt,::m_serConName)

Process the data!!

//close the connection
HCloseConnection(::m_serConName)

HCancelDeclaration(dsUs)
HCancelDeclaration(dsScRpt)
HCancelDeclaration(dsSc)

DW
Re: WM24 Connection to DB question
October 06, 2019 01:09PM
Hi, yes, there are several connections possible.

Kind regards,
Guenter Predl
office@windev.at
Re: WM24 Connection to DB question
October 06, 2019 05:36PM
1. Yes it is possible. Only you need to have more described connections.
myConn1, myConn2, myConn3 is connection

2. Define servers and databases for connections
3. hChangeConnection() for tables to particular connection

Regards !
Re: WM24 Connection to DB question
October 06, 2019 06:50PM
Thanks for the reply,

Why do we need to HChangeConnection? Is this to switch back in forth from database with same structure so you do not have to use HdeclareExternal?

So if the 2 DBs are different structures hChangeConnection not needed?

DW
Re: WM24 Connection to DB question
October 07, 2019 07:22AM
Hi, HChangeConnection is needed anyway in order to connect the "connection" to a certain database. HDeclareExternal is a different thing and is used to be able to build foreign database structures, to use foreign variables. Foreign to the analysis or foreign to the application. It enables declaration and avoids compilation errors.

Kind regards,
Guenter Predl
office@windev.at
Re: WM24 Connection to DB question
October 07, 2019 10:21AM
Hi cabinetman.

I use HdeclareExternal() only if I need to open some table which is not in my database (from other) or come from remote location in
some folder on my PC so I can import data or make some query on that "external data" and so on.
I never use HdeclareExternal for database declared into analysis.

0. hOpenCOnnection()
1. hChangeConnection()
2. hChangeFolder()

I use this way even if is into help file defined in reverse way, from 2-0

Regards !
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: