Delphi 2007 Pro - Best way to connect to SQL Server - sql-server

I usually use Delphi-targeted databases for most of my work (NexusDB typically, lately), but still have bad memories of how painfully slow connecting (and posting) to MS Access was via ADO. I have a new project that may need to target MS SQL Server. For D2007 Pro, what is the best way to connect to MS SQL Server? (Third party components = fine, if that's the best route).

The TADOConnection really isn't that bad. Access was never intended to be a production RDBMS. ADO works much faster with SQL Server than with Access. See http://support.microsoft.com/kb/225048 for some of the reasons why.

The AnyDAC offers great feature set and performance, as simplifies development of the database applications. AnyDAC supports MS SQL Server, MS Access and much more.

The UniDac Component from DevArt / Corelab is your best option
It offers fast performance and you can talk to a number of differrent databases

I always recommended DevArt db components fro their performance and reliability.
You can choose between SDAC(for direct access to sql server) or UniDac (direct access to Sql server, Oracle, MySql,PostgreSql and Interbase/firebird)
if you don't require the advanced components that access specific features of sql server like TMSChangeNotification, TMSTransaction or TMSServiceBroker, then you can go with UniDac so your application will be designed to work with multiple databases.

Devart offer components and dbExpress drivers for accessing SQL Server databases. The also have UniDAC which supports other databases as well.
Da-soft AnyDac supports SQL Server and other databases.
Bob Swart has published Delphi for Win32 VCL Database Development on Lulu, if you need any help.

I use ADO to connect to Sql Server since Delphi 7 and it always worked great

Related

Using Microsoft Sync Framework to synchronize two identical SQL Server 2012 databases using Change Tracking

I'm currently evaluating options for synchronizing two identical databases that will be deployed on two different SQL Server (1) instances. I've started with the Microsoft Sync Framework and if it does not fit my requirements I'll check SQL Replication.
Anyway, long story short, I'm trying to get a basic scenario to work using the Sync Framework but unfortunately all of the examples and tutorials I've seen online use the SQL Provisioning Provider which adds certain tables, stored procedures and triggers to the database - I want to avoid this, obviously.
I read somewhere that the Sync Framework can use SQL Server's built-in Change Tracking features, but this only works when the client is SQL CE (example). But all what I have read so far seems to be out-dated. I couldn't find anything that is relatively recent about the topic. So I was wondering whether the above is still valid or the Sync Framework added support for the built-in Change Tracking with SQL Server 2012 (or 2014).
In case this scenario is still not supported until this day, could someone refer me to an example (or at least some hints) of how I could develop a custom provider to use Change Tracking on both the client and the server?
(1) SQL Edition is not a constraint. Even SQL Server Enterprise Edition is an option.
support for SQL Change Tracking only works for the older SqlCeClientSyncProvider/DBSyncProvider/SyncAgent, in short you can only use to sync SQL Ce with a SQL Server configured for SQL CT.
the newer sync providers do not support SQL CT.
there used to be a sample SQLExpressClientSyncProvider from MS that has been pulled out from the download site due as it has some issues.
Writing a custom sync provider is not easy, if you can go for SQL Replication, that will be an easier route.

What to consider when getting started with SQL Server?

I've got experience with MySQL, DB2, and Oracle, but aside from writing a few queries, I've never used SQL Server.
My question is a three parter:
1) For a developer, what are some good "free" client tools to look at, and why (by "free" I mean open source, freeware, or the tools that come with SQL Server itself)?
2) I plan to run Developer or Express Edition on my workstation for development, and either Standard or Enterprise Edition in the testing and production environments. What methods exist if any for transferring data between different servers and the different editions?
3) Are there any common pitfalls that someone like me (who is used to the other database systems that I mentioned) might encountered during development?
TIA
SQL Server Express with tools.
All editions have the same SQL language features and code is 100% portable between them. There are 3rd party tools to synch changes, but moving entire DBs is easy using inbuilt tools.
Nah. The problem with databases is SQL and set theory, not the choice of RDBMS. If you understand databases/SQL you'll be OK.
SQL Server Management Studio which comes with SQL Server (any editions), or you can download it separately. SQL Server Profiler which doesn't come with Express.
Management studio has tools for backup/restore database. You can also consider detach/attach method to synchronize db .
It's hard to say. But if you had Mysql experience you will be pleasantly surprised by SQL Server.
UPDATE
There are so many things that each DB vendor implements differently that it's really hard to focus on some of them. One thing I was not used before is that SQL Server doesn't let unique columns to have more than 1 NULL value(there is a workaround though)

Delphi 3 to SQL 2008

One my clients has a system written in Delphi 3 and the database is Paradox. My job is to convert it to use SQL Server 2008. How can I make it connect to SQL 2008?
This is pretty old stuff, I know. I appreciate the help.
Thanks
At the very least BDE should be able connect using ODBC and choosing the SQL 2008 Driver in ODBC. I haven't tried, but I doubt that the BDE SQL driver will connect to SQL 2008, and I doubt anybody will develop a BDE driver for 2k8.
Do you intend on moving from Delphi 3? If so, then SDAC (SQL Server Direct Access Components) from Devart would be worth looking at. They support SQL Server 2008 but unfortunately require Delphi 5 or above. They use OLE DB and any Windows machine with 2000 or above will have the drivers installed (which is part of Microsoft Data Access Components - MDAC).
You can use ADO without using Ado Components, by importing ActiveX Data Objects Library, but this will require more work.
Why not upgrade the project to Delphi 2007 as a stepping stone towards the future? There have been many improvements and bug fixes to the language since Delphi 3 that you could easily take care of. The pain of migration might be much easier than dealing with issues which have been already addressed and corrected in the latest versions of the compiler.
You can try one of the Free Components from Torry.net to connect to the SQL server using ADO.
Check TaoADODataSet and Free ADO Dataset in the page http://www.torry.net/pages.php?id=569. These components have Delphi 3 support.

OleDb vs DataReader When Reading Data From Oracle

Is it faster to use 1 type of provider over the other? We are using SSIS (SQL Server 2005) to pull some data from Oracle and import it into SQL Server. It was my understanding that OLEDB is faster, because the connection is native, and the data isn't being run through any .NET code?
Is this correct?
OLEBD will work faster for sure.
But you will have to make a choice between Microsoft or Oracle driver for the oracle database. I recommend you to try both and decide which one offers you a better performance.
I've heard that oracle's drivers have improved quite a lot on ssis 2008 (writing performance was horrible).
That depends! From .NET code you would always prefer using the Oracle .NET provider to access a Oracle database. Recon you would want to use the .NET provider from SSIS as wel

Replicating between SQL Server 2005 and SQL Server Compact Edition

Can it be done and if so, how?
You can also check out Sync Services for Sql Server and Compact edition. The benefit of Sync Services is that you don't need a replication server or IIS and you can also sync between compact edition databases. This method involves writing a fair bit more code and is fairly involved, but I'd recommend looking into it as a lightweight service.
You can use Merge Replication. Theres a tutorial here SQL Server Compact 3.5 How-to Tutorials (Number 5).
Certainly replication is possible, as is Sync Services if you're not afraid to get your hands dirty. It depends on the details of what you need:
Sometimes-connected application wanting to have a read-only cache: Sync Services
Sometimes-connected application wanting to have part or full update ability: Sync Services
Remote site with multiple workstations needing read/write access to data: replication if you can get a secure network connection that's stable enough, otherwise look at extending Syn Services to work with SQL Express (or full SQL Server) based on the sample here: Sync using SQL Express
If you just want a SQL CE database and you're working with a SQL 2008 server then the wizard in Visual Studio 2008 SP1 will do all the work for you, you need only add 1 line of code to it if you want bi-directional support. If you can't upgrade then it will take more work with SQL 2005, and it's only reliable if you have at least SP2.
I'm in the middle of a project that requires multiple sites to have a sub-set of data in an environment where each site may lose it's connection to the head office at times, we've managed to get Sync Services to work with SQL 2008 at the head office and SQL Express 2008 at each site with full change tracking (2008 feature) and it's working great. It does require a reasonable amount of code (C# and SQL), so we've used some pretty smart templates to help. Be aware that.
Perhaps you could refine your question with more details?
Because of budget constraints I think it will have to beta-tester's approch,i tried following the guide and cant seem to get it working. Before I spend time getting it to work, I just confrim, Replicating between SqlServer 2005 and Compact Edition is something that can be done?
I just confrim, Replicating between
SqlServer 2005 and Compact Edition is
something that can be done?
Yes it can definately be done using either Merge Replication or Sync Services

Resources