Recent

Author Topic: How to use TMSSQLConnection for MS SQL?  (Read 21294 times)

Nebula

  • Jr. Member
  • **
  • Posts: 88
How to use TMSSQLConnection for MS SQL?
« on: September 20, 2012, 08:31:01 pm »
I'm wondering what to 'uses' to be able to use SQL Server.
According to http://wiki.lazarus.freepascal.org/SqlDBHowto TMSSQLConnection is available, but in my Lazarus v1.0 I can't find it.
I can compile with the MySQL v5 conn type, but not with the MSSQLconn type which is undefined.

If I use menu option View..Components.. I can see TMySQL40Connection and three others (4.1,5.0,5.1), TIBConnection, TODBCConnection, TOracleConnection etc - but not the MS one.

Is it still in beta, and hasn't made it into my Win32 Lazarus v1.0 / FPC 2.6?
Would I have to meddle about manually installing something, or should I give up for now and stick with ODBC?

Thanks
Newbie testing Lazarus v1.0 - very impressed
Win 7 at work, XP and Linux Mint at home.
It all started with a ZX80 on a b/w telly........
Code: [Select]
Uses Smiles, GoodHumour, WantsToHelp;
{ never liked C - curly brackets are for comments! }

paweld

  • Hero Member
  • *****
  • Posts: 1003
Re: How to use TMSSQLConnection for MS SQL?
« Reply #1 on: September 20, 2012, 11:41:53 pm »
Quote
SQLDB

    Added mssql connectors (supports Microsoft SQL Server), requires fpc 2.6.1+
    Added sybase connectors (supports Sybase ASE), requires fpc 2.6.1+
    Added mysql 5.5 connector, requires fpc 2.6.1+
For fpc 2.6.0: ODBC or ZeosLib
Best regards / Pozdrawiam
paweld

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: How to use TMSSQLConnection for MS SQL?
« Reply #2 on: September 21, 2012, 08:53:09 am »
The Lazarus 1.0 release notes even say it: Laz 1.0 is released with FPC 2.6.0. You need at least a recent FPC fixes/2.6.1 from SVN or FPC trunk (2.7.1)
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Nebula

  • Jr. Member
  • **
  • Posts: 88
Re: How to use TMSSQLConnection for MS SQL?
« Reply #3 on: September 21, 2012, 10:41:10 am »
Ah, thank you.
Can I easily grab something from wherever, copy it into the components folder and have it picked up automatically, or would it be far more involved than that?
Newbie testing Lazarus v1.0 - very impressed
Win 7 at work, XP and Linux Mint at home.
It all started with a ZX80 on a b/w telly........
Code: [Select]
Uses Smiles, GoodHumour, WantsToHelp;
{ never liked C - curly brackets are for comments! }

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: How to use TMSSQLConnection for MS SQL?
« Reply #4 on: September 21, 2012, 10:56:15 am »
No, you'd need support for MSSQL at the FPC level first.
Have a look here if you want to try that:
http://lazarus.freepascal.org/index.php/topic,15135.msg90598.html#msg90598
... recompile FPC (or the sqldb units at least)

You'd then have to convince Lazarus to build the visual connectors for FPC 2.6.0, in components\sqldb\registersqldb.pas:
Code: [Select]
{$IF FPC_FULLVERSION>= 20601}
{$IF DEFINED(BEOS) OR DEFINED(HAIKU) OR DEFINED(LINUX) OR DEFINED(FREEBSD) OR DEFINED (NETBSD) OR DEFINED(OPENBSD) OR DEFINED(WIN32) OR DEFINED(WIN64)}
// MS SQL Server and Sybase ASE connectors were introduced in the FPC 2.7 development branch, and
// backported to 2.6.1
// Operating systems should match FPC packages\fcl-db\fpmake.pp
{$DEFINE HASMSSQLCONNECTION}
{$DEFINE HASSYBASECONNECTION}
{$ENDIF}
{$ENDIF}
... change {$IF FPC_FULLVERSION>= 20601} to {$IF FPC_FULLVERSION>= 20600}
Perhaps rescan fpc source files (don't know if that is necessary)...
... and recompile Lazarus

IIRC, it can be done but it is a bit of fiddling.

Edit: to make it brutally clear: the below is another option (and much easier)
If you would like to have this connector, I would rather suggest using a snapshot of the newest Laz + FPC 2.6.1, as it has additional fixes.
You could set it up separately from your Laz 1.0/FPC 2.6.0 using --primary-config-path:
http://wiki.lazarus.freepascal.org/Multiple_Lazarus#Solution_for_separating_instances_using_multiple_config_dirs
This way, you can develop with a stable FPC, and a fairly stable Laz environment that has a lot of bugs fixed.
If something goes wrong, or you need to test if something works on 1.0, you can switch back to that version.

Edit: added a note here http://wiki.lazarus.freepascal.org/Lazarus_Database_Overview#Lazarus_and_MSSQL.2FSybase, hope that helps others in the same situation.
« Last Edit: September 21, 2012, 03:11:06 pm by BigChimp »
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Nebula

  • Jr. Member
  • **
  • Posts: 88
Re: How to use TMSSQLConnection for MS SQL?
« Reply #5 on: September 21, 2012, 01:32:18 pm »
Thanks BC, hope you don't mind me correcting a typo in the wiki  :D

Sounds complicated, most of us Windows users aren't used to recompiling apps - I think I'll wait until the next release! Still, good to know what's involved, and that's useful information for others, too.

Cheers
Newbie testing Lazarus v1.0 - very impressed
Win 7 at work, XP and Linux Mint at home.
It all started with a ZX80 on a b/w telly........
Code: [Select]
Uses Smiles, GoodHumour, WantsToHelp;
{ never liked C - curly brackets are for comments! }

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: How to use TMSSQLConnection for MS SQL?
« Reply #6 on: September 21, 2012, 01:39:02 pm »
Hi Nebula,

It seems a bit daunting, but doing a dual Lazarus installation as I proposed is not as hard as it looks.
And that is much easier than recompiling stuff... but to each his own.


Thanks for the wiki edits by the way, very welcome!
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

TyneBridges

  • Full Member
  • ***
  • Posts: 150
    • Personal blog
Re: How to use TMSSQLConnection for MS SQL?
« Reply #7 on: February 13, 2013, 03:00:44 pm »
Could you give us a little more info on how to get the snapshot? I have the same problem and have just uninstalled and reinstalled Lazarus, to find that the latest version has the same issue - it uses a version of FPC that doesn't include MsSQLConnection.

When I've tried to download patches for Lazarus, I have been confronted with a login prompt. Casting my memory back years to when I last used anonymous FTP, I seem to remember that the user name is just "anonymous" but I have no idea of the password, and can't find the information on the Lazarus Wiki or in Google searches.

Any help would be gratefully received.
John H, north east England
Lover of the old Delphi, still inexperienced with FPC/Lazarus and not an instinctive programmer

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: How to use TMSSQLConnection for MS SQL?
« Reply #8 on: February 13, 2013, 03:24:17 pm »
Quick notes ;) :
- go to snapshots dir, see link top left, this gives a web page (http://freepascal.dfmk.hu/test/lazarus/)
- download a version of Lazarus *that includes an FPC higher than 2.6.0*, e.g. Lazarus + fpc 2.6.1,  win32. For me, clicking that link just shows a download location dialog, not an FTP site
- install

Edit: hope that's enough, John, if not, please post again...
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

TyneBridges

  • Full Member
  • ***
  • Posts: 150
    • Personal blog
Re: How to use TMSSQLConnection for MS SQL?
« Reply #9 on: February 13, 2013, 08:42:58 pm »
Thanks - I've downloaded a snapshot and will follow the instructions for a parallel installation as soon as I get time.
John H, north east England
Lover of the old Delphi, still inexperienced with FPC/Lazarus and not an instinctive programmer

TyneBridges

  • Full Member
  • ***
  • Posts: 150
    • Personal blog
Re: How to use TMSSQLConnection for MS SQL?
« Reply #10 on: February 14, 2013, 08:06:27 pm »
I'm afraid the Wiki entry "Multiple Lazarus" didn't make complete sense to me. I could follow the bit about the command line and created a shortcut with the properties "C:\lazarus\lazarus.exe --primary-config-path=c:\lazconfig". This worked - after I ran Lazarus from the shortcut, a new folder called lazconfig appeared with some config files in it. However, the Wiki then goes on to talk about "the svn version" - I should probably know the acronym but I have to admit I got completely lost in the linked article about the subversion repository.

The instruction says there is no need to install Lazarus and that the installer should be run only once. Bearing that in mind, the user who wants to run two or more versions needs a simple way to "unpack" the files from the snapshot version but, since it's an EXE file and not an archive, that looks impossible. I haven't managed to do anything much with Lazarus yet, so I may just remove my original installation and install the snapshot version instead. (Is it likely that an official version with FPC 2.6.1 will be released soon?)
John H, north east England
Lover of the old Delphi, still inexperienced with FPC/Lazarus and not an instinctive programmer

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: How to use TMSSQLConnection for MS SQL?
« Reply #11 on: February 14, 2013, 11:14:27 pm »
There is no need to <> you can't or your shouldn't. The page talks about various installations including installing from svn directly which I avoid at this point. install the 32bits and 64bits in different directories then set the shortcuts of both to use a custom config directory and that's it everything else is not of any concern to you at this point learn first how to work with lazarus before diving in to svn and all the raizor edge installation which personally I avoid because I need a reference point which I can use that will be easy for every one to acquire.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Nebula

  • Jr. Member
  • **
  • Posts: 88
Re: How to use TMSSQLConnection for MS SQL?
« Reply #12 on: February 14, 2013, 11:36:58 pm »
ODBC works fine with MS SQL :)
Newbie testing Lazarus v1.0 - very impressed
Win 7 at work, XP and Linux Mint at home.
It all started with a ZX80 on a b/w telly........
Code: [Select]
Uses Smiles, GoodHumour, WantsToHelp;
{ never liked C - curly brackets are for comments! }

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: How to use TMSSQLConnection for MS SQL?
« Reply #13 on: February 15, 2013, 08:41:15 am »
The instruction says there is no need to install Lazarus and that the installer should be run only once. Bearing that in mind, the user who wants to run two or more versions needs a simple way to "unpack" the files from the snapshot version but, since it's an EXE file and not an archive, that looks impossible. I haven't managed to do anything much with Lazarus yet, so I may just remove my original installation and install the snapshot version instead. (Is it likely that an official version with FPC 2.6.1 will be released soon?)
1. The instructions on the wiki probably use this scenario:
a version installed by official stable Lazarus installer
b Lazarus compiled from subversion/current source code/svn
Then, indeed, you needn't run the installer again. However, if you use
a version installed by official stable Lazarus installer
b version installed by Lazarus snapshot installer
yes, of course, you'd need to run that installer in b)

I can see though why you are confused - IMO the installation pages are a bit of a mess mixing various concepts. However, I've given up trying to fix them as people kept putting in their own specific workflows as opposed to clarifying and unifying existing details.

2. I'd say just installing a single version using the current FPC 2.6.1 snapshot installer is a good idea. FPC 2.6.1 is more stable/bug free than 2.6.0 (used by the official installer) and the basis for the soon-to-be-released FPC 2.6.2.
When a new official Laz 1.x+FPC2.6.2 is released, you'd be able to just install that over your existing version.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: How to use TMSSQLConnection for MS SQL?
« Reply #14 on: February 15, 2013, 09:18:42 pm »
If you're compiling for 32-bit Windows, double-check that the two dlls you refer to are 32-bit (and not 64-bit).
Also, try putting them in the same folder as your application executable just for the development/testing phase. Once you have your app running successfully and debugged you can worry about the proper MS-recommended system location for the dlls.

 

TinyPortal © 2005-2018