• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 906
  • Last Modified:

Best way to access MS SQL server from Delphi

Hi,

What is the best (fastest) way to connect to a SQL server database from within Delphi 7 Professional? Any third-party components are welcome too.
And could you please explain how I can do that?

Regards,
Stef
0
Stef Merlijn
Asked:
Stef Merlijn
  • 3
  • 2
  • 2
  • +4
3 Solutions
 
2266180Commented:
well ... there isn't a fastest way to connect to it. most if not all components/libraries will be equally fast at this operation :)

the issue you could encounter in regards to speed is in how much time you get the data. but this again depends mostly on:
- the sql code you have written
- the network connection
and not on the libraries as well.

this is the general look. if you want ms precizion, then you will probably have to test a few libraries on your environment with the same data/sql queries and of course sql server.

I personally worked with modbc (old version, delphi 3 era). I've heard a few nice things about MySQLDAC but the most used around EE seems to be the zeos components. I never needed mysql from delphi since the D3 era, so I didn't used any delphi mysql libraries since.
0
 
Stef MerlijnDeveloperAuthor Commented:
Sorry, but I need to know this for "MS SQL server" not "MySQL".
0
 
2266180Commented:
ups. dunno what I was seeing. sorry.
ms sql is strait out of the box. just use ADO. (the general stuff still applies). of course you could use odbc or bde, but I do prefer ADO. bde needs to also ship teh bde engine along with your applicaiton (and a few other downsides, like lot of bugs and all that; of course most of them are probably fixed but at teh time I first started using it, it just made me dislike it so much that I never tried it again) and odbc ... I prefer ADO over it (the only reason for me is because in ADO I don't have to create a dsn :) )
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Stef MerlijnDeveloperAuthor Commented:
What can you tell me about "Direct Access" Components?
DBxComponents? that are part of the Delphi Enterprise version seem to have this, or has ADO it too?
0
 
mikelittlewoodCommented:
Yes I think that ADO connection objects only come with Delphi Enterprise and higher, not professional.
Do the DBExpress components come with delphi7 professional? or the clientdataset/dataprovider components?
Its been so long since I used any professional version Im a bit out of touch.
Other than that BDE / ODBC using the standard TDataset components I would guess.
0
 
JohnjcesCommented:
I concur that ADO is probably the best all around method to access MS SQL.

If you don't have a version of Delphi with ADO components, you can download the following free and they work well.

http://www.alohaoi.com/Software/Products/aoado/ado.htm

http://www.gm-software.de/components.htm 

If you want to try something else, which is an open source project, not ADO... but will allow you to use almost any database server, MS SQL, MySQL, Oracle, to name a fedw, try ZEOS database objects. There has been good activity and updates recently.

Download from:  http://zeos.firmos.at/portal.php

Hope this helps.

JJ
0
 
Mohammed NasmanSoftware DeveloperCommented:
I prefer to use Direct access component, and we use Sdac from crlab, also they have similar components for oracle called odac
http://www.crlab.com/sdac/

there are also free component called anydac, offer direct access to sql server and more RDBMS
http://www.da-soft.com/AnyDACHome.html

and SqlDirect too but not free
http://www.sqldirect-soft.com/

and you can work with sql server directly with Ole Db without the ADO layer, which will be faster
http://www.oledbdirect.com/index.php
0
 
calinutzCommented:
ADO comes with Professional version too (at least for Delphi 7)
And they are the best way to acces MS SQL Server

Regards
0
 
Mohammed NasmanSoftware DeveloperCommented:
>>And they are the best way to acces MS SQL Server

why you consider it as best way?
0
 
Wim ten BrinkCommented:
Several people have suggested to use ADO and I agree with that. :-)
However, there are several ways that you can work with ADO. There are some Delphi components that wrap around the ADO COM classes in Windows and there are several other third-party ADO components. But you can also just use the raw ADO components, depending on your needs.

Other methods are called "OLE DB" and "DOA" but Microsoft has already made clear that "DAO" won't be supported in 64-bits Windows versions. And OLE DB is just one layer of the whole MDAC design

MDAC = http://en.wikipedia.org/wiki/Microsoft_Data_Access_Components
DAO = Data Access Objects
ADO = ActiveX Data Objects
OLE DB = ?

Problem with SQL Server is that every componentset tends to be a wrapper around some other componentset, adding a bit more functionality, handling a few more situations and whatever more. You would have the fastest access to SQL Server through OLE DB but there are no OLE DB components for Delphi. Even faster would be if you use the TDS protocol directly to communicate with the server. (See http://en.wikipedia.org/wiki/Tabular_Data_Stream for more.) And with SQL Server 2005 you can even use SOAP to communicate with the server.

But in the end, the question won't be which solution is the fastest. I think what's more important is the question which solution is the most reliable. (And still available in the future!) And the answer to that, as provided by everyone else here, is ADO. Just like ciuly said. Good answer, ciuly! ;-)

Btw, whatever you do, don't use the BDE to connect to SQL Server! It's a wrapper around a wrapper and will needlessly increase the size of your project, it will make you dependant on the BDE and worst of all, it's NOT an improvement. The good old days of the BDE are over nowadays. :-(
0
 
Stef MerlijnDeveloperAuthor Commented:
Thank you all for the info.
I've decided to go with ADO.

Regards,
Stef
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 3
  • 2
  • 2
  • +4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now