Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
is dbExpress ... Better than BDE...? Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
08-Sep-03
Category
dbExpress
Language
Delphi 6.x
Views
326
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: S S B Magesh Puvananthiran

One of the ways to set runtime database parameters to the TSQLConnection component 
in dbExpress

Answer:

Since Borland is now giving more importance to dbExpress and trying to get rid of 
BDE in future releases, we used dbExpress in that project. I have seen a whole lot 
of threads discussing/comparing the features of dbExpress with BDE in our Borland 
newsgroups; it's really interesting. 

Even though there are a lot of benefits using dbExpress, I liked the following 
features of dbExpress: 

1. Changing between databases: 

If you want your application to point to a new database, then all you need to do is 
to change the entries in the dbxconnections.ini file and in the code, you need to 
call the LoadParamsFromIniFile method. But you may need to set the following 
properties of the TSQLConnection component: 

ConnectionName 
GetDriverFunc 
LibraryName and 
VendorLib 

I used a procedure like this: 

1   procedure Connect;
2   begin
3     SQLConnection1.ConnectionName := 'Oracle';
4     SQLConnection1.DriverName := 'Oracle';
5     SQLConnection1.GetDriverFunc := 'getSQLDriverORACLE';
6     SQLConnection1.VendorLib := 'OCI.DLL';
7     SQLConnection1.LoadParamsFromIniFile('dbxConnections.ini');
8     SQLConnection1.Open;
9   end;


You can get all those values as parameters to the application. Or the other option 
I would see is to add these properties as part of the dbxconnections.ini file and 
read it from there. Even though I have not tried this option, I hope this would 
work fine. 

Another important thing to note is that if you are setting these properties at 
runtime, you need to make sure that the LoadParamsOnConnect property of 
TSQLConnection be false. 

After setting all those parameters and setting the Connected property to True will 
establish a connection to the database. But for some reason, if you provide some 
wrong parameters and try to set the Connected property to True at runtime somehow 
passes. I heard that this is a bug in dbExpress and been fixed in Delphi 6. But I 
doubt it's been fixed in Delphi 6 since I tried with Delphi 6 only. Instead I used 
the ConnectionState property of the TSQLConnection component. It seems to work 
fine. Let me know if I'm wrong. 

2. Easy Deployment - lightweight: 

Deploying an dbExpress application requires the relevant database driver files and 
the dbxconnections.ini file. But for BDE applications, we need to install the BDE 
and create a relevant Aliases for the databases. 

3. What I would like to know? 

I have used BDE before and there is a session component available that you can attach to the database component but in dbExpress, I dont see such a component. Is there any way we can achieve the same with dbExpress component? Feel free to share your thoughts on this. 

			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC