Page 1 of 1

Add driver unit to your uses DbxMsSql

Posted: Tue 26 Jul 2011 16:28
by jkarjun
Hi,

I'm using C++ Builder XE, connecting to MS SQLServer 2005 using the Devart SQLServer (v 4.80.0.29) dbexpress. I'm able to successfully add SQLConnection, SQLTable.
I added a TSimpleDataSet, set the connection property to SQLconnection, set the command type to "ctTable", when I click on the command Text to select the table it throws an error
"Cannot load metadata for Microsoft SQL Server. Add driver unit to your uses (DbxInterBase or DbxDb2 or DbxMsSql or DBXMySQL or DbxOracle or DbxSybaseASA or DbxSybaseASE)."

I understand that I need to include "DbxMsSql", but not sure how to include this.

Thanks
Kasturi

Posted: Wed 27 Jul 2011 11:42
by AndreyZ
Hello,

It seems that you are using the standard driver instead of our driver. Our driver doesn't require the DbxMsSql unit to be included to your project, it's the standard driver requirement. To use our driver, you should use the following settings:

Code: Select all

SQLConnection.ConnectionName := 'Devart SQL Server';
SQLConnection.DriverName := 'DevartSQLServer';
SQLConnection.GetDriverFunc := 'getSQLDriverSQLServer';
SQLConnection.LibraryName := 'dbexpsda40.dll';
SQLConnection.VendorLib := 'sqloledb.dll';

Posted: Wed 27 Jul 2011 21:41
by jkarjun
Hi,

Already my SQLConnection parameters are set correctly as you have mentioned. The TSQLTable component works fine.
For the "TSimpleDataSet", I get the Add driver error when I try to select the table name from "Command Text" property.
My understanding is for TSimpleDataSet, I set the connection property to working SQLconnection, set the command type to "ctTable" and I should be able to get the list of tables in the Command Text.

Kasturi

Posted: Thu 28 Jul 2011 12:33
by AndreyZ
Please try the following:
- create a new application;
- drop the TButton component onto the form;
- include the SqlExpr, SimpleDS, and DBXDevartSQLServer units to this project in the following way:

Code: Select all

#include "SqlExpr.hpp"
#include "SimpleDS.hpp"
#pragma link "DBXDevartSQLServer"
- use the following code:

Code: Select all

void __fastcall TForm1::Button1Click(TObject *Sender)
{
	TSQLConnection* con = new TSQLConnection(this);
	con->ConnectionName = "Devart SQL Server";
	con->DriverName = "DevartSQLServer";
	con->GetDriverFunc = "getSQLDriverSQLServer";
	con->LibraryName = "dbexpsda40.dll";
	con->VendorLib = "sqloledb.dll";
	con->LoginPrompt = false;
	con->Params->Values["HostName"] = "host";
	con->Params->Values["Database"] = "database";
	con->Params->Values["User_Name"] = "username";
	con->Params->Values["Password"] = "password";
	con->Open();
	TSimpleDataSet* sds = new TSimpleDataSet(this);
	sds->Connection = con;
	sds->DataSet->CommandType = ctTable;
	sds->DataSet->CommandText = "tablename";
	sds->Open();
	con->Close();
}
Please check if you encounter any problems using this project.

Posted: Thu 28 Jul 2011 23:24
by jkarjun
Hi,

I tried the code snippet you had mentioned. It worked but when I add the TSimpleDataSet to a form and try to select a table it shows an error, "dcldbxsda150.lib" is needed.
"dcldbxsda150.lib" is the design package and this file is not present in my machine. We're migrating from BDE to DBExpress and all our components are design time, so let me know how can I get the library files.

Thanks

Posted: Mon 01 Aug 2011 12:06
by AndreyZ
To solve the problem, please perform the following steps:
- close C++Builder XE;
- change the ProductName option in the [DevartSQLServer] and [DevartSQLServerCompact] sections of the dbxdrivers.ini file to Microsoft SQL Server (instead of MSSQL).

Posted: Wed 03 Aug 2011 17:50
by jkarjun
Hi,

I had changed the ini file, I still get the popup to add the driver unit. The library file "dcldbxsda150.lib" is part of C++ Builder correct, and is not part of DEVART. If that's the case looks like I have the .bpl file but not the related .lib file in my machine. I have copied the modified ini to make sure the parameters are set correctly.
[DevartSQLServer]
GetDriverFunc=getSQLDriverSQLServer
LibraryName=dbexpsda40.dll
VendorLib=sqloledb.dll
BlobSize=-1
HostName=
DataBase=
User_Name=
Password=
ProductName=Microsoft SQL Server
DriverAssemblyLoader=Devart.DbxSda.DriverLoader.TCRDynalinkDriverLoader,Devart.DbxSda.DriverLoader,Version=1.0.0.5001,Culture=neutral,PublicKeyToken=09af7300eec23701
DriverUnit=DBXDevartSQLServer

Thanks

Posted: Thu 04 Aug 2011 11:23
by AndreyZ
Please check that you changed the ProductName option in both dbxdrivers.ini files:
..\Documents and Settings\All Users\Documents\RAD Studio\dbExpress\dbxdrivers.ini
and
..\Documents and Settings\All Users\Documents\RAD Studio\dbExpress\8.0\dbxdrivers.ini

Posted: Thu 04 Aug 2011 14:05
by jkarjun
Hi,

I have dbxdrivers.ini only at "C:\Documents and Settings\All Users\Documents\RAD Studio\dbExpress\8.0".

I have another dbxdrivers.ini at "C:\Documents and Settings\All Users\Documents\RAD Studio\8.0\Samples\DelphiPrism\DelphiPrismWebApp" which just have [Interbase] alone.

Thanks

Posted: Fri 05 Aug 2011 07:16
by AndreyZ
Please specify the edition of dbExpress driver for SQL Server you are using: Trial, Standard, or Standard with source code.

Posted: Fri 05 Aug 2011 13:09
by jkarjun
Hi,

I'm using Devart SQLServer (v 4.80.0.29) dbexpress TRIAL version.

Thanks

Posted: Fri 05 Aug 2011 14:38
by AndreyZ
Please, try the following:
- remove dbExpress driver for SQL Server;
- remove all dbexpsda*.dll files from your computer;
- remove all dcu files from your project;
- reinstall dbExpress driver for SQL Server;
- change the ProductName option in the dbxdrivers.ini file to Microsoft SQL Server.
Does the error occur after performing these steps?

Posted: Fri 05 Aug 2011 15:20
by jkarjun
- I uninstalled the dbexpress drivers.
- Then I searched for dbexpsda*.dll. Did not find anything.
- Then reinstalled the dbexpress trial version.
- Then changed the product name option under the dbxdrivers.ini file to Microsoft SQL Server.
- Created a new project droped a SQLConnection and a SimpleDataSet component to the DataModule form. SQLConnection worked fine and was able to connect to the database. For SimpleDataSet, I was not able to select the table name under the Command Text property. The same error is coming.

I think the "dcldbxsda150.lib" is not available with the C++ Builder professional version and therfore I cant use it with the design time components.

Posted: Tue 09 Aug 2011 07:43
by AndreyZ
I cannot reproduce this problem. Please specify the full version of your IDE, for example, RAD Studio XE Architect 15.0.3953.35171.

Posted: Tue 09 Aug 2011 13:09
by jkarjun
Hi,

I have Embarcadero® C++Builder® XE Professional Version 15.0.3953.35171.

Based on looking at other forums, they say with Professional version you cannot use dbexpress for SQLServer, atleast the design time components.

Kasturi