Page 1 of 2

how to connect the ms sql server 2K on ubuntu system?

Posted: 03.06.2007, 09:24
by charles_zou
I get the error message miss ntwdblib.dll when I connect the ms sql server.
who can help me?

Posted: 05.06.2007, 16:52
by Bottleneck
Hello charles_zou,

download following file

http://www.galileocomputing.de/dateien/ ... stenID-243

Save in "windows\system32" directory. Should work now.

Posted: 05.06.2007, 17:23
by charles_zou
I mean the Linux system "Ubuntu", not the windows system.

Posted: 10.06.2007, 14:06
by charles_zou
should I use odbc to connect the ms sql server?

Posted: 10.06.2007, 19:08
by charles_zou
I found a file and modified it. it will connect the ms sql server 2005,now.

Posted: 10.06.2007, 19:10
by charles_zou
it's the file I used.

Posted: 12.06.2007, 00:17
by mdaems
Thanks for the patch. It doesn't compile on my Windows/Delphi7 installation, however.
Fails on

Code: Select all

  OldErrorHandle := dberrhandle(ErrorHandle);
  OldMessageHandle := dbmsghandle(MessageHandle);
with message
[Error] ZPlainDbLibMsSql7.pas(785): Incompatible types: 'Calling conventions differ'
[Error] ZPlainDbLibMsSql7.pas(786): Incompatible types: 'Calling conventions differ'
[Fatal Error] ZPlainDbLibDriver.pas(867): Could not compile used unit '..\..\src\plain\ZPlainDbLibMsSql7.pas'
Do you know what's wrong? When I have a working version on both Linux and Windows, I'll certainly commit it.

Mark

Posted: 19.11.2008, 16:24
by AndyK
I am attempting to connect to SQL Server from Linux, and I am not certain how to proceed. Was the new ZPlainDbLibMsSql7.pas file ever rolled into the ZeosLib release? If not, how do I include the update into my copy of the components (I don't know how to rebuild the package)? And what do I need to set the TZConnection object properties to in order to connect ... I have tried setting the Protocol to "mssql" (which works on Windows) but I still get the error "None of the dynamic libraries can be found: ntwdblib.dll"?

Thanks, Andy

Posted: 20.11.2008, 15:53
by Michael
Hi Guys,

just one question since I'm not an Ubuntu (Linux) user: How is the Windows environment on your Linux installation implemented? Or: How do you run Delphi7 under Ubuntu? If you haven't any possibility to access the SQL-Server protocols/drivers or ADO you will imho get no connection to MSSQL ...

Posted: 20.11.2008, 16:14
by mdaems
Michael,

There's always lazarus. No need for Delphi on Linux. :D

AndyK,

The question remains : what system driver are you using to connect with MSSQL. Is there a ntwdblib.dll equivalent available for Ubuntu or is there an ADO implementation available?
Anyhow, I don't believe Zeoslib can find the necessary libraries on Ubuntu yet. Extra development will be needed to add this.
If it's just about pointing to a linux version of ntwdblib.dll this shouldn't be difficult. Just adding the right name to the plainloader class as long as the entry points are available in the library.
If we must enable ADO support this might require more work as ADO protocol isn't available on Lazarus yet.

Mark

Posted: 20.11.2008, 16:45
by Michael
Hi Mark,

the things you mentioned were also my last State: Since the ADODB-Unit is not implemented in Lazarus, yet we have no chance to get ADO running in ZEOS on Lazarus ... right? So we have to wait for the Lazarus guys ... i suppose! :(

Posted: 21.11.2008, 10:51
by btrewern
All,

I'm pretty sure there is no such thing as ADO on Linux so we can't expect much from the Lazarus team regarding that.

The only way I can find to access MS SQL server fron *nix is via http://www.freetds.org/. This includes a standard library and an ODBC driver so it's a start. As I understand it, a new protocol would need to be created in Zeos to use this library.

Regards,

Ben

Posted: 21.11.2008, 18:11
by AndyK
Mark,

Thank you for your reply ... this is the best glimmer of hope that I have had with this problem! I can see the"DLL_LOCATION = 'ntwdblib.dll'" line in the file ZPlainDbLibMsSql7.pas file, and it seems that the file "libsybdb.so" is the equivalent of that DLL in FreeTDS. So I just need to change that "ntwdblib.dll" to "libsybdb.so" on that line in the ZEOS source? And after changing it how do I incorporate this into Lazarus (that is, what do I choose from the Lazarus menu to rebuild/reload the ZEOS package with that change in place).

Again, thank you for helping me with this!

Andy

Posted: 23.11.2008, 16:23
by mdaems
AndyK,

There's quite a lot of conditions to get this work.
- The dll must have the same names for the entry points of all function.
- The buffers must have the same dimensions.
- The protocol used by FreeTDS must be of the same verion as your server used (is the FreeTDS project still active?)

I think the easiest way to get the modified zeoslib version active in Lazarus is to rebuild Lazarus. I think that automatically rebuilds your Zeoslib components when they have changed. If not just open the components package and 'recompile all what's needed by the package'.

Good luck and report here!!

Mark

Posted: 23.11.2008, 17:43
by Michael
@All:

In order to get the Zeos Components rebuilt you have to rebuild Lazarus ... b u t ... before that you also have to delete the files in [font=Courier New]\packages\lazarus\build[/font] ... then you can be sure that Lazarus also recompiles the ZeosLib with the modified code.

Also from me: Good Luck!
:smartass: