Forum
× General Forums discussions that don't fit in any of the other specific forum categories, help etc.

Question Cannot open TMSSQLConnection component.

  • David Scambell
  • David Scambell's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
3 weeks 6 days ago #10955 by David Scambell
David Scambell created the topic: Cannot open TMSSQLConnection component.
Hi,

I am attempting to create an example database application which will connect to 'MS SQL Server'.

I have tried to use both the TSQLConnector and TMSSQLConnection components, but on both counts I receive the error 'Can not load DB-Lib client library "dblib.dll". Check your installation.'.

I have searched the internet for a resolution for this problem and found the latest version of the library could be downloaded from the FPC ftp server, dated 7th Feb 2017.

ftp://ftp.freepascal.org/fpc/contrib/windows/

After extracting the files, I then copied the 32bit files to the Windows\System32 directory and the 64bit files to the \SysWOW64 directory.

I have also copied all of the files to the application build directory.

This however, has had no effect on the error, I would be grateful for any help with this issue, I think I am missing something very simple!

Attachments:

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Away
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
3 weeks 6 days ago - 3 weeks 6 days ago #10956 by Sternas Stefanos
Sternas Stefanos replied the topic: Cannot open TMSSQLConnection component.
Thanks Sir
Please try
to use from C:\codetyphon\fpcsrc\packages\dblib\src\dblib.pp
the InitialiseDBLib function

for sample:
uses ..., ...,
        dblib,
      ... ... ... ;


 InitialiseDBLib(c:\testdir\dblib.dll);

at start up of your app OR
on main form onGreate (FormCreate) event

CodeTyphon Architect and Programmer
Last Edit: 3 weeks 6 days ago by Sternas Stefanos.

Please Log in or Create an account to join the conversation.

  • David Scambell
  • David Scambell's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
3 weeks 6 days ago #10957 by David Scambell
David Scambell replied the topic: Cannot open TMSSQLConnection component.
Would I place this command in the applications main form 'OnCreate' function or in the applications *.ppr file?

In any case, I am receiving this error from within the IDE, I wish to use the connection to display sample data at design time?

Dave.S

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Away
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
3 weeks 6 days ago - 3 weeks 6 days ago #10958 by Sternas Stefanos
Sternas Stefanos replied the topic: Cannot open TMSSQLConnection component.
Sir

First set
MSSQLConnection1
property Connected = false;

In the applications main form 'OnCreate'

use InitialiseDBLib function to load dblib.dll
from the directory you want (for sample InitialiseDBLib(c:\testdir\dblib.dll);

if dblib.dll loaded OK then
set
MSSQLConnection1.Connected = true;

Please study the source of C:\codetyphon\fpcsrc\packages\dblib\src\dblib.pp

CodeTyphon Architect and Programmer
Last Edit: 3 weeks 6 days ago by Sternas Stefanos.

Please Log in or Create an account to join the conversation.

  • David Scambell
  • David Scambell's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
3 weeks 6 days ago - 3 weeks 6 days ago #10959 by David Scambell
David Scambell replied the topic: Cannot open TMSSQLConnection component.
Sternas, Thanks for your reply.

I think that we were both typing at the same time on the set of messages.

Just waiting for CT6.2 to install.

Dave.
Last Edit: 3 weeks 6 days ago by David Scambell.

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Away
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
3 weeks 6 days ago #10960 by Sternas Stefanos
Sternas Stefanos replied the topic: Cannot open TMSSQLConnection component.
Ok Sir

CodeTyphon Architect and Programmer

Please Log in or Create an account to join the conversation.

  • David Scambell
  • David Scambell's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
More
3 weeks 5 days ago - 3 weeks 5 days ago #10962 by David Scambell
David Scambell replied the topic: Cannot open TMSSQLConnection component.
Ok, it has taken a while but I think that I have fixed the problem, at both design and run time by using the alternative library as 'dblib.dll' still refuses to load..

1. Downloaded the 'ntwdblib.dll' library form this web site, http://www.dlldownloader.com/ntwdblib-dll/ .

Note: The command line functions used to de-register and then re-register the library from the registry as shown on this site did not work for me, but were not required.

2. Copied the file to both the Windows\System32 and \SysWOW64 directories.

3. Loaded the file '\CodeTyphon\fpcsrc\packages\dblib\scr\dblib.pp' into the CodeTyphon source editor.

4. Un-edited the definition on line 32.
{$DEFINE ntwdblib}

5. Used CodeTyphon Center to rebuild IDE and FPC, both 32 & 64bit versions.

The library is now loaded by the IDE and the components can use live data at design time.

For run-time execution, I simply copied the library to the applications root directory and then initialized using 'InitialiseDBLib' as posted by Sternas.

Thank you for your help Sternas.

ps: How do you mark a topic as resolved on the forum?
Last Edit: 3 weeks 5 days ago by David Scambell.

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Away
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
3 weeks 5 days ago #10963 by Sternas Stefanos
Sternas Stefanos replied the topic: Cannot open TMSSQLConnection component.
Thanks Sir

PS:Edit topic subject like [resolved]

CodeTyphon Architect and Programmer
The following user(s) said Thank You: David Scambell

Please Log in or Create an account to join the conversation.

More
3 weeks 3 days ago - 3 weeks 3 days ago #10967 by fredvs
fredvs replied the topic: Cannot open TMSSQLConnection component.
Hello Sternas.

InitialiseDBLib(c:\testdir\dblib.dll)


Ha, you did dynamic loading of library for DBlib --> That is *** great ***. :)

And it fixes, in one shot, all the problems of static linking and bug in "external" declaration.

May I ask you if you are in plan to do conversion of all static fpc-packages into dynamic packages ?

If yes, IMHO, this is a **BIG** change and (IMHO again), you should rename fpc into ctc.

My 0,00001 cent.

Fre;D
Last Edit: 3 weeks 3 days ago by fredvs.

Please Log in or Create an account to join the conversation.

  • Sternas Stefanos
  • Sternas Stefanos's Avatar
  • Away
  • Moderator
  • Moderator
  • Ex Pilot, M.Sc, Ph.D
More
3 weeks 3 days ago #10968 by Sternas Stefanos
Sternas Stefanos replied the topic: Cannot open TMSSQLConnection component.
My friend we have a lot of plans

look at
codetyphon\fpcsrc\packages\sqlite\src\sqlite3.pp
codetyphon\fpcsrc\packages\sqlite\src\sqlite3db.pas
codetyphon\fpcsrc\packages\sqlite\src\sqlite3static.pp

it's dynamic link too

CodeTyphon Architect and Programmer

Please Log in or Create an account to join the conversation.