Conversation

dbExpress for dummies

(overview of excerpts from articles in conversation)

Newsgroup: embarcadero.public.delphi.database.general

# Lines
wrote on 04-Dec-2008:

I have worked many years with the BDE, but apparently that +didn't+ come in unicode in Delphi 2009, so I am now trying to use dbExpress instead. Unfortunately, the help file topics about this are just like Chinese to me. The demos just don't work, and I can't find a single example on the whole internet that +really+ works (I mean: really, not just approximately).
I just want to know
1) how to create a physical data file (what format? xml/binary/??? using which tool? Is there something like database desktop for this???)
2) how to connect this finally with data-aware components?
I figured out that it should work with TSQLConnection, TSimpleDataSet and TDataSource, but how to "connect" the connection (and with what?) is a complete mystery to me. It seems that some file like "libmysql.dll" or "gds32.dll" is necessary, but none of these are on my system, although I installed Delphi completely.
39
  
Cesar Romero replied on 04-Dec-2008:

Koen,
  (snip)

TSQLConnection will be used to connect to a dabatase server, what
  database you want to use?
  I had used Firebird and now Im working also with SQL Server and
  PostgreSQL.
48
  
Bill Todd replied on 04-Dec-2008:

The article at http://dn.codegear.com/article/29106 is for
  dbExpress 3 and is a bit dated but you may find it helpful.
  --
  Bill Todd (TeamB)
  
6
  
Tiedo Kruisselbrink replied on 05-Dec-2008:

Koen Van de moortel wrote:
  (snip)

You can use a chain of TSQLConnection, TDatasetProvider, TClientDataSet
  and TDataSource.
  (snip)

You should get a database management system (DBMS) of your own, it is
  not included with Delphi like the BDE was. You can buy one, like
33
    
Koen Van de moortel replied on 05-Dec-2008:

Thanks, this article is interesting, but the example doesn't work with me.
    I tried to make the connection with Delphi 7 (database path: c:\program files\common files\borland shared\data\employee.gdb) and I got: +dbExpres error [0x0015] Connection failed. SQL Server Error: unavailable database+.
    Then I tried with Delphi 2009 (path: c:\codegear\interbase\examples\database\employee.gdb) and I got the same +"unavailable database"+.
    What is missing here?
    And... anyway I have no idea how to make a "gdb" file. An XML file like the "country.xml" or "biolife.xml" seems pretty straightforward to make with a simple text editor, if only I had a way to connect with these files and had a list of all the possible syntaxes for such files. It can't be that difficult, can it?
31
  
Anders Andersen replied on 05-Dec-2008:

Koen Van de moortel skrev:
  (snip)

Hi, wall of text below :)
  Going completely back to basic here, it seems that you are very used to
  using file based databases like paradox and that when you open a TTable
  you simply refer to a file for the table to open.
180
  
Cesar Romero replied on 05-Dec-2008:

Koen Van de moortel wrote:
  (snip)

Did you install Interbase?
  Do you have the database
  c:\codegear\interbase\examples\database\employee.gdb file?
  --
14
    
Koen Van de moortel replied on 05-Dec-2008:

Yes, interbase and the example files are there, and I triple checked the paths, so I don't understand what's wrong.
    In the mean time I found that I could open, view and edit the xml example files ("country.xml" etc.) just using a TSimpleDataSet+TDataSource+TDBGrid, and setting the FileName property and nothing else. Apparently I don't need a separate TSQLConnection.
    Whatever driver I select (BlackfishSQL, Datasnap, InterBase or MySQL), it seems to work, although none of the necessary dlls seems to be present on my system (weird!). Which one is better? And where do I find a list of the xml syntaxes they understand?
    I am also affraid to use xml because it seems to me that it can become slow with large datasets. Is there any alternative that is included in the Delphi 2009 package? Interbase? But then the only way to create/alter tables is using SQL? Is there no alternative for the easy to use Database Desktop?
    Sorry for all my questions, but I can't find the answers in the Delphi help, where they should be I think. Even a vacuum cleaner comes with a manual for dummies...
44
  
Cesar Romero replied on 05-Dec-2008:

Koen Van de moortel wrote:
  (snip)

Them try to add "server:" before path
  like this
  "localhost:C:\Data\MyDatabase.fdb"
  (snip)

You dont even needs TSimpleDataSet, you can use TClientDataSet, that is
77
  
Paul Hughes replied on 05-Dec-2008:

wrote in message news:✉forums.codegear.com...
  (snip)
Koen,
  I think you need to give some idea of the sort of application you are
  writing/updating in order to get some better advice on what steps to take.
  There are several options to replace the BDE and some are more like the BDE
79
    
Koen Van de moortel replied on 05-Dec-2008:

(snip)

Thanks.
    Yes, unicode is definitely needed. Single user acces is enough; and it should be easy to distribute.
    
    
    
12
  
Anders Andersen replied on 05-Dec-2008:

Koen Van de moortel skrev:
  (snip)

Plain TClientDataSet is for you then. Don't bother with dbExpress.
  Anders
  
  
16
    
Paul Hughes replied on 05-Dec-2008:

"Anders Andersen" <✉strato.dk> wrote in message
    news:✉forums.codegear.com...
    (snip)
Yes, I'd go with that.
    Cary Jensen wrote some in-depth articles regarding what you can do with
    them. Have a look on
19
    
Bill Todd replied on 05-Dec-2008:

Anders Andersen wrote:
    (snip)

The OP mentioned that XML files would not be acceptable for
    large amounts of data in an earlier message. If he is
    working with large amounts of data TClientDataSet and a
    flat file will not be acceptable since all of the data must
15
  
Koen Van de moortel replied on 05-Dec-2008:

Thanks guys,
  The example worked fine, and the texts about TClientDataSet look very interesting.
  It's just not clear to me yet if I can make an sql query (combining different tables) with only TClientDataSets, or would I need TSQLQuery then?
  
  
10
    
Cesar Romero replied on 05-Dec-2008:

Koen,
    (snip)

TClientDataSet something like a in memory TDataSet, to get query
    working, you should use
    TSimpleDataSet + TDataSource
    or
26
    
Erik Brandt replied on 05-Dec-2008:

Koen Van de moortel skrev:
    (snip)

You can not do SQL queries on TClientDataSet data. All data resides in
    memory, all the time. You can however use the Filter property and use
    Master-Detail setups.
    Anders
18
  
Erik Brandt replied on 05-Dec-2008:

Bill Todd skrev:
  (snip)

If you use the FileName property the client dataset saves the data in
  its native binary format. I have several datasets that are over 1.5 MB
  in size. They open close to instantaneously.
  The downside really is that you can't do sql on it.
26
  
Anders Andersen replied on 05-Dec-2008:

Bill Todd skrev:
  (snip)

(Woops wrong account.)
  If you use the FileName property the client dataset saves the data in
  its native binary format. I have several datasets that are over 1.5 MB
  in size. They open close to instantaneously.
25
  
quinn wildman replied on 05-Dec-2008:

The unavailable database error implies the InterBase server is not
  running. Run InterBase Manager and make sure it says it is running.
  Koen Van de moortel wrote:
  (snip)

  
38
    
Bill Todd replied on 05-Dec-2008:

Erik Brandt wrote:
    (snip)
1.5 mb is tiny by database standards. When most people talk
    about large amounts of data in relation to database
    applications they are talking about gigabytes.
    --
10
  
Bill Todd replied on 05-Dec-2008:

Bill Todd wrote:
  (snip)

I should have said "...they are usually talking about
  gigabytes."
  --
  Bill Todd (TeamB)
14
    
Koen Van de moortel replied on 06-Dec-2008:

Okay, I have created a table as in the above example. (Cds and xml both work.)
    I place a TClientDataSet or a TSimpleDataSet on my form, set
    filename:='c:\my files\test.cds';
    active:=true;
    I connect the dataset with a TDataSource and a TDBGrid and I can view and edit my data. Pretty simple.
46
  
Cesar Romero replied on 06-Dec-2008:

Koen Van de moortel wrote:
  (snip)

You can't do that with a in memory DataSet, and this is what you are
  doing now.
  What you are doing now, is close to create a TStringList and
  SaveToFile/LoadFromFile, you cant customize LoadFromFile with SQL
77
  
Bill Todd replied on 06-Dec-2008:

Koen Van de moortel wrote:
  (snip)

Those properties are used to connect to an SQL database
  server.
  (snip)

TSimpleDataSet contains three components, TSQLDataSet,
  TDataSetProvider and TClientDataSet, and is intended for
97
    
Koen Van de moortel replied on 06-Dec-2008:

(snip)
Since this Blackfish is the only one that wants to connect, I assume it is somewhere on my pc?
    I just want a replacement for the BDE TQuery, in order to make a simple read-only join of two tables (cds or xml), which I can then view using TClientDataSet. What should I use to do this, without having to buy stuff that is not included in Delphi 2009 professional?
    
    
    
24
  
Bill Todd replied on 06-Dec-2008:

Koen Van de moortel wrote:
  (snip)

You cannot use SQL on data in a TClientDataSet. In order to
  perform an SQL join you must use an SQL database. If you
  need an SQL database that is free consider:
  Firebird with the Zeos components or a free dbExpress
34
  
Gary Shelton replied on 07-Dec-2008:

Ken,
  I have had the same problems you mention, don't fully understand server
  setups, and couldn't figure out how to create databases for Blackfish in the
  IDE. I switched a long time ago to Extended systems advantage database. The
  local server is free, easy to distribute, comes with a Data architech for
38
  
Anders Andersen replied on 07-Dec-2008:

Koen Van de moortel skrev:
  (snip)

There is no simple solution for that. Standalone TClientDataSet can not
  do any SQL queries.
  Although there are somewhat simple solutions like SQLite and
  BlackfishSQL which can potentially be embedded into your application,
66
    
Koen Van de moortel replied on 08-Dec-2008:

(snip)
Thanks Gary, I downloaded it from: http://www.sybase.com/detail?id=1055532 and it works fine, but it doesn't do unicode...
    
    
    
    
6
    
Koen Van de moortel replied on 08-Dec-2008:

I finally managed to make a working query, which wasn't difficult at all, if one knows the steps (that are very well hidden for a novice):
    1) in Delphi 2009, I opened Data Explorer, right clicked on "BlackfishSql" to make a new connection, which I gave a name.
    As "servername" I entered "localhost", and as "database name" I entered the directory in which my exe file resides.
    2) Then under this new connection I right clicked on "tables" to create a new table, and a nice table design form shows up (like Database Explorer). I enter some fields, close the form and my table is ready.
    3) Then, in SimpleDataSet1 on my form I set the ConnectionName accordingly, and in it's dataset property I set either commandtype=ctTable and CommandText=the name of my table, or I set commandType=ctQuery and I enter an SQL statement in CommandText, then "active"=true, and that's it.
52
  
Bill Todd replied on 08-Dec-2008:

Koen Van de moortel wrote:
  (snip)

BlackfishSQL, like many SQL database servers, stores the
  entire database in a single file. All of the tables,
  indexes, domains, etc. that are part of the database are in
  the single file for that database. So, the answer to your
27
    
Anders Andersen replied on 09-Dec-2008:

Bill Todd skrev:
    (snip)

So the logical followup question is, where is the database? This is
    non-obvious to be honest.
    I took a look at the documentation for Blackfish SQL and I must admit he
    has a point, it is not easy to understand. Particularly it doesn't seem
86
  
Bill Todd replied on 09-Dec-2008:

Anders Andersen wrote:
  (snip)

You will have to ask someone who uses BlackfishSQL how to
  find the location of the database file. I have read a bit
  about BlackfishSQL but that is the limit of my knowledge.
  --
13
  
Anders Andersen replied on 10-Dec-2008:

As a result of this discussion, we have filed bug #69731 - BlackfishSQL
  dbExpress Connection Properties are not documented.
  It was opened by Chris Pattinson yesterday so hopefully at one point in
  the unforseable future the documentation for this will be improved upon.
  Anders - EBC products
53
    
Koen Van de moortel replied on 10-Dec-2008:

And more mystery...
    It seems impossible to select a database in run-time!
    Something like this:
    SimpleDataSet1.Connection.driver.database:='c:\test\blackfishtest';
    refuses to compile (it says: undeclared identifier "driver"), although this is exactly what I set in the object inspector!
13
  
Leonel Togniolli replied on 10-Dec-2008:

Koen Van de moortel wrote:
  (snip)

What you see in the driver property is just a convenient way of setting
  values specific to the driver you chose. The actual values are stored
  in a name-value collection called Params.
  You seemed to be setting to a folder (or a filename without an
19
    
Koen Van de moortel replied on 10-Dec-2008:

More mystery:
    Steps to reproduce the problem:
    1) Create a new application in Delphi2009, put a TClientDataSet on the main form, and compile.
    2) Copy the resulting exe file on another "virgin" pc.
    3) Run that exe.
44
  
Cesar Romero replied on 10-Dec-2008:

Koen Van de moortel wrote:
  (snip)
Add MidasLib to you .dpr project file uses clause and you dont have to
  deploy midas.dll anymore.
  --
  Cesar Romero
11
  
Anders Andersen replied on 10-Dec-2008:

Koen Van de moortel skrev:
  (snip)

This is normal. Right click your project in the project manager.
  Select view source.
  Where it says
  uses
47
  
Anders Andersen replied on 10-Dec-2008:

Koen Van de moortel skrev:
  (snip)

Are you sure? My documentation has no mention of TSQLConnection having a
  property named Driver. Thus you get "undeclared identifier", which is to
  be expected.
  It does however have a Params property, which is were you add all your
74
    
Bill Todd replied on 10-Dec-2008:

Anders Andersen wrote:
    (snip)

The property that contains the driver information is the
    TSQLConnection.Params property.
    --
    Bill Todd (TeamB)
9
  
Bill Todd replied on 10-Dec-2008:

Koen Van de moortel wrote:
  (snip)

If you have D2009 Pro or Enterprise installed and MIDAS.DLL
  is not on your system something is wrong with your
  installation.
  --
10
    
Koen Van de moortel replied on 11-Dec-2008:

(snip)
No, nothing happens.
    (snip)

I can set Connection.connected:=true, but I can't set the Simpledataset.active to true; it says "Missing query, table name, or procedure name.".
    As database, I entered the complete path+filename of an existing jds file.
    I wasn't sure whether you meant SimpleDataSet.connection.params or SimpleDataSet.params, so I tried both, with the same result.
    I still don't understand why the object inspector says there is a "driver" property in "Connection", suggesting that there is a "TSimpleDataSet.Connection.driver", just in the same way as the object inspector says there is "charset" in "font" in a TForm, which means there is a property "TForm.font.charset". This is very confusing!
51
  
Anders Andersen replied on 11-Dec-2008:

Koen Van de moortel skrev:
  (snip)

Ah.. Yes. The problem is that the component was changed in the new
  version of dbExpress that came with D2009. (When I wrote it I was
  testing using Turbo Delphi 2006.)
  It now has a Driver property instead of a DriverName property, and it is
122
    
Anders Andersen replied on 11-Dec-2008:

Anders Andersen skrev:
    (snip)

This seemed to have the folks in the dbexpress forum slightly baffled.
    We have reported this issue as QC #69821 - Object inspector shows
    nonexistent Driver property for TSQLConnection component. It is awaiting
    review.
33
  
Anders Andersen replied on 11-Dec-2008:

Anders Andersen skrev:
  (snip)

Ahh. That was axed quickly. This is 'as designed', in other words a
  hidden feature of the object inspector.
  Whether or not there should be such hidden features is a matter of taste
  I guess.
45
    
Koen Van de moortel replied on 16-Dec-2008:

Windows explorer doesn't find it, even if I search in hidden and system directories...
    You know what? I think I'm going to use TSQLMemTable from www.aidaim.com. Reasonably straightforward to use, documentation and support, nothing to install on the user's computer... The only disadvantage is that it saves/loads entire tables, not record by record, but it works very fast in memory.
    Edited by: Koen Van de moortel on Dec 16, 2008 11:00 AM
    
    
17
    
Koen Van de moortel replied on 02-Jan-2009:

Happy newyear to all the friendly people here who replied to my questions!
    In the mean time I did some experimenting with the AidAim components. They are interesting, but for some purposes I will still need dbExpress & BlackfishSQL I think.
    I found some interesting documentation here:
    http://docs.codegear.com/docs/radstudio/delphiAndcpp2009/GARelease/EN/pdf/bfsql.pdf
    and
33
FYI: Phrase searches are enclosed in either single or double quotes
 
 
Originally created by
Tamarack Associates
Fri, 17 May 2024 03:28:31 UTC
Copyright © 2009-2024
HREF Tools Corp.