Skip to main content

Hello,

I used the "open" and "close" instruction to connect on differents databases, changing the PathName of the connector $MQL.

However, I want to verify if the connection is done on the correct database after open a new one, even if the $Status = 0.

(I have cases where I put something wrong in the pathname, and $Status=0 however)

Is there a Uniface instruction which can give me the pathname actually used?

Thanks



------------------------------
Jérémie CEDOLIN
Proges Plus
Willems FR
------------------------------

Hello,

I used the "open" and "close" instruction to connect on differents databases, changing the PathName of the connector $MQL.

However, I want to verify if the connection is done on the correct database after open a new one, even if the $Status = 0.

(I have cases where I put something wrong in the pathname, and $Status=0 however)

Is there a Uniface instruction which can give me the pathname actually used?

Thanks



------------------------------
Jérémie CEDOLIN
Proges Plus
Willems FR
------------------------------

Would this work using Sql Server 

sql "SELECT DB_NAME()",$path

{test the result}



------------------------------
Osman Shariff
------------------------------


Would this work using Sql Server 

sql "SELECT DB_NAME()",$path

{test the result}



------------------------------
Osman Shariff
------------------------------

On MySql it appears that would be 
SQL "select DATABASE()",$path



------------------------------
Iain Sharp
Head of Technical Services
Pci Systems Ltd
Sheffield GB
------------------------------

On MySql it appears that would be 
SQL "select DATABASE()",$path



------------------------------
Iain Sharp
Head of Technical Services
Pci Systems Ltd
Sheffield GB
------------------------------

Thanks for the answer, it's ok with "select database()" on MySQL



------------------------------
Jérémie CEDOLIN
Proges Plus
Willems FR
------------------------------

Thanks for the answer, it's ok with "select database()" on MySQL



------------------------------
Jérémie CEDOLIN
Proges Plus
Willems FR
------------------------------

However, I do it by another way:
I create a parameter in a file of each database, with the same key but a different value.

After the "open" instruction, I read this parameter and check if the value returned is the one that is expected.



------------------------------
Jérémie CEDOLIN
Proges Plus
Willems FR
------------------------------

However, I do it by another way:
I create a parameter in a file of each database, with the same key but a different value.

After the "open" instruction, I read this parameter and check if the value returned is the one that is expected.



------------------------------
Jérémie CEDOLIN
Proges Plus
Willems FR
------------------------------

That would work, but why bother when a perfectly working way already exists without the maintenance.  I can't see the purpose.



------------------------------
Osman Shariff
------------------------------

That would work, but why bother when a perfectly working way already exists without the maintenance.  I can't see the purpose.



------------------------------
Osman Shariff
------------------------------

And if you have such a file/table, I guarantee you that the next time you make a copy for a test environment, you will forget to change the content and it can happen that the wrong database is supplied with updates!

But how about writing a view that collects and returns all relevant/necessary information.
At https://dev.mysql.com/doc/refman/8.0/en/information-functions.html you can find some more functions.
If the name of the view is kept generic (e.g. 'SysInfos') and the column names are also generic, you can even set up this view on other database systems and get a standardized return of what you are dealing with.  [A first column in the view should then contain "MQL" in your case :-)]
Ingo



------------------------------
Ingo Stiller
Aareon Deutschland GmbH
------------------------------

And if you have such a file/table, I guarantee you that the next time you make a copy for a test environment, you will forget to change the content and it can happen that the wrong database is supplied with updates!

But how about writing a view that collects and returns all relevant/necessary information.
At https://dev.mysql.com/doc/refman/8.0/en/information-functions.html you can find some more functions.
If the name of the view is kept generic (e.g. 'SysInfos') and the column names are also generic, you can even set up this view on other database systems and get a standardized return of what you are dealing with.  [A first column in the view should then contain "MQL" in your case :-)]
Ingo



------------------------------
Ingo Stiller
Aareon Deutschland GmbH
------------------------------

BTW. For MS-SQL possible properties are listed here:
https://learn.microsoft.com/en-us/sql/t-sql/functions/serverproperty-transact-sql

And what about such View (for MS-SQL):
create view SpecialSysInfo
as 
select 
'MSS' as DbmsType
,(select SERVERPROPERTY ( 'MachineName' ))    as ServerName
,(select SERVERPROPERTY ( 'InstanceName' )) as DbmsInstName
,(select DB_ID())        as DbId
,(select DB_NAME())      as DbName
,(select host_name())    as Local_CompName
,(select host_id())      as Local_CompID
,(select user_name())    as Local_UserName
,(select user_id())      as Local_UserId
go

Ingo



------------------------------
Ingo Stiller
Aareon Deutschland GmbH
------------------------------