Page 1 of 1

Database name / no name

Posted: Mon 14 Sep 2009 12:35
I am trying to use UniDac to access either Advantage or MySql depending on a parameter setting in my app. I am having a problem accessing table data due to the fact the MySql requires the database name. ie..

MySql: Select * from mydb.Customer
ADS: Select * from Customer

Has anyone come across / resolved this problem? :?:

Posted: Tue 15 Sep 2009 09:20
by Plash
There are two ways to resolve the problem:
1) Set the Database property of TUniConnection to 'mydb'. Then execute MySQL query without the database name.
2) Use {if} operator of Unified SQL:

Code: Select all

SELECT * FROM {if MySQL}mydb.{endif}Customer

Posted: Wed 16 Sep 2009 19:05
Hi Plash. My preffered method is #1 as I will not know the database name at runtime (my program switches databases dynamically). However, the Database property of the UniConnection seems to hold the full path to the database file / location. Am I missing something? Can this field be used as an 'Alias'? :o

Posted: Thu 17 Sep 2009 07:47
by Plash
In MySQL database name is just a name. When you use MySQL provider you can change the Database property without disconnecting from the server.