If you have Embarcadero RAD Studio installed (I use Delphi XE2 for example), it turns out that their dbExpress drivers are newer than the ones Embarcadero provided with their ADO.NET 2.0 drivers.
So in order to solve your particular issue, you might best change the app.config file in your Visual Studio solution to something like this:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<system.data>
<DbProviderFactories>
<remove invariant="Borland.Data.AdoDbxClient" />
<add name="AdoDbx Data Provider" invariant="Borland.Data.AdoDbxClient"
description=".Net Framework Data Provider for dbExpress Drivers"
type="Borland.Data.TAdoDbxProviderFactory, Borland.Data.AdoDbxClient,
Version=16.0.0.0, Culture=neutral, PublicKeyToken=91d62ebb5b0d1b1b"/>
<remove invariant="Borland.Data.DbxClientDriver" />
<add name="Datasnap AdoDbx Data Provider" invariant="Borland.Data.DbxClientDriver"
description=".Net Framework Data Provider for Datasnap"
type="Borland.Data.TAdoDbxDatasnapProviderFactory,
Borland.Data.DbxClientDriver, Version=16.0.0.0, Culture=neutral,
PublicKeyToken=91d62ebb5b0d1b1b"/>
</DbProviderFactories>
</system.data>
</configuration>
After doing so, there is one minor detail that needs to be performed. You will have to find the location of the dbExpress configuration files called 'dbxdrivers.ini' and 'dbxconnections.ini'. If you place them in the exact same location of your binary executables, it will work. These drivers point to the correct assemblies from Embarcadero.
There is also a bug with setting up a connection to the database, which you may fix by the following workaround. You could lookup all provided dbProviderFactories (ie. the installed drivers) just to make sure your dbExpress drivers are installed correctly. The following method has it built in (just quick and dirty though):
public InterbaseTest()
{
if (null == this.Connection)
{
try
{
/* First list all installed and registered DbProviderFactories */
System.Data.DataTable dt = System.Data.Common.DbProviderFactories.GetFactoryClasses();
for (int i = 0; i < dt.Rows.Count; i++)
Console.WriteLine("{0}: {1}", i.ToString(), dt.Rows[i][2].ToString());
Console.WriteLine("------------------------------------------------------\n");
this.Connection = new TAdoDbxConnection(
string.Format("DriverName=Interbase;Database={0};", this.DatabasePath) +
"RoleName=RoleName;User_Name=sysdba;"+
"Password=masterkey;SQLDialect=3" +
"MetaDataAssemblyLoader=Borland.Data.TDBXInterbaseMetaDataCommandFactory," +
"Borland.Data.DbxReadOnlyMetaData,Version=11.0.5000.0,Culture=neutral," +
"PublicKeyToken=91d62ebb5b0d1b1b;GetDriverFunc=getSQLDriverINTERBASE;" +
"LibraryName=dbxint30.dll;VendorLib=GDS32.DLL"
);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
It may seem obvious that this.Connection is of type dbConnection, which is a field in this C# class.
Hope it helps!
UPDATE
Without Embarcadero RAD Studio installed, it may be the case that you lack the .ini files. The contents are very straightforward, so you may create these files yourself.
The 'dbxconnections.ini' should contain this:
[IBConnection]
;DelegateConnection=DBXTraceConnection
DriverName=Interbase
Database=database.gdb
RoleName=RoleName
User_Name=sysdba
Password=masterkey
ServerCharSet=
SQLDialect=3
ErrorResourceFile=
LocaleCode=0000
BlobSize=-1
CommitRetain=False
WaitOnLocks=True
IsolationLevel=ReadCommitted
Trim Char=False
The contents of the 'dbxdrivers.ini' file (the most important one) should contain:
[Installed Drivers]
DBXTrace=1
DBXPool=1
Interbase=1
MySQL=1
[DBXPool]
DelegateDriver=True
DriverName=DBXPool
DriverUnit=Data.DBXPool
DriverPackageLoader=TDBXPoolDriverLoader,DBXCommonDriver160.bpl
DriverAssemblyLoader=Borland.Data.TDBXPoolDriverLoader,Borland.Data.DbxCommonDriver,Version=16.0.0.0,Culture=neutral,PublicKeyToken=91d62ebb5b0d1b1b
[DBXTrace]
DelegateDriver=True
DriverName=DBXTrace
DriverUnit=Data.DBXTrace
DriverPackageLoader=TDBXTraceDriverLoader,DBXCommonDriver160.bpl
DriverAssemblyLoader=Borland.Data.TDBXTraceDriverLoader,Borland.Data.DbxCommonDriver,Version=16.0.0.0,Culture=neutral,PublicKeyToken=91d62ebb5b0d1b1b
[AutoCommit]
False=0
True=1
[BlockingMode]
False=0
True=1
[WaitOnLocks]
False=1
True=0
[CommitRetain]
False=0
True=1
[OS Authentication]
False=0
True=1
[Multiple Transaction]
False=0
True=1
[Trim Char]
False=0
True=1
[SQLDialect]
1=0
2=1
3=2
[Interbase]
DriverUnit=Data.DBXInterBase
DriverPackageLoader=TDBXDynalinkDriverLoader,DbxCommonDriver160.bpl
DriverAssemblyLoader=Borland.Data.TDBXDynalinkDriverLoader,Borland.Data.DbxCommonDriver,Version=16.0.0.0,Culture=neutral,PublicKeyToken=91d62ebb5b0d1b1b
MetaDataPackageLoader=TDBXInterbaseMetaDataCommandFactory,DbxInterBaseDriver160.bpl
MetaDataAssemblyLoader=Borland.Data.TDBXInterbaseMetaDataCommandFactory,Borland.Data.DbxInterBaseDriver,Version=16.0.0.0,Culture=neutral,PublicKeyToken=91d62ebb5b0d1b1b
GetDriverFunc=getSQLDriverINTERBASE
LibraryName=dbxint.dll
LibraryNameOsx=libsqlib.dylib
VendorLib=GDS32.DLL
VendorLibWin64=ibclient64.dll
VendorLibOsx=libgds.dylib
BlobSize=-1
CommitRetain=False
Database=database.gdb
ErrorResourceFile=
LocaleCode=0000
Password=masterkey
RoleName=RoleName
ServerCharSet=
SQLDialect=3
IsolationLevel=ReadCommitted
User_Name=sysdba
WaitOnLocks=True
Trim Char=False
[Interbase TransIsolation]
ReadCommited=1
RepeatableRead=2
[MYSQL]
DriverUnit=Data.DBXMySQL
DriverPackageLoader=TDBXDynalinkDriverLoader,DbxCommonDriver160.bpl
DriverAssemblyLoader=Borland.Data.TDBXDynalinkDriverLoader,Borland.Data.DbxCommonDriver,Version=16.0.0.0,Culture=neutral,PublicKeyToken=91d62ebb5b0d1b1b
MetaDataPackageLoader=TDBXMySqlMetaDataCommandFactory,DbxMySQLDriver160.bpl
MetaDataAssemblyLoader=Borland.Data.TDBXMySqlMetaDataCommandFactory,Borland.Data.DbxMySQLDriver,Version=16.0.0.0,Culture=neutral,PublicKeyToken=91d62ebb5b0d1b1b
GetDriverFunc=getSQLDriverMYSQL
LibraryName=dbxmys.dll
LibraryNameOsx=libsqlmys.dylib
VendorLib=LIBMYSQL.dll
VendorLibWin64=libmysql.dll
VendorLibOsx=libmysqlclient.dylib
BlobSize=-1
Database=DBNAME
ErrorResourceFile=
HostName=ServerName
LocaleCode=0000
Password=password
User_Name=user
Compressed=False
Encrypted=False
If you include these .ini files within your application folder where your binary is located, stuff should work.