Lazarus

Programming => Databases => Topic started by: Gosh on April 24, 2015, 02:51:10 pm

Title: A short and concrete question about dblib.dll
Post by: Gosh on April 24, 2015, 02:51:10 pm
From where I can download this file?

I tried with google without results
Title: Re: A short and concrete question about dblib.dll
Post by: Basile B. on April 24, 2015, 03:55:23 pm
try the second link. Not tested.

http://wiki.freepascal.org/mssqlconn#DBLib

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

(or maybe http://sourceforge.net/projects/freetdswindows/)

previous discussion here: http://forum.lazarus.freepascal.org/index.php/topic,20492.0.html
Title: Re: A short and concrete question about dblib.dll
Post by: Gosh on April 24, 2015, 06:56:02 pm
First link sends to second but ftp site has an issue which doesn't allow downloading.

Third links works fine but I was shocked with size of file- 171MB!!!
Title: Re: A short and concrete question about dblib.dll
Post by: Gosh on April 24, 2015, 07:30:45 pm
After I installed that 171MB large file, I couldn't find  dblib.dll inside....
Title: Re: A short and concrete question about dblib.dll
Post by: Basile B. on April 24, 2015, 08:53:31 pm
You should be able to dl from the ftp links. No problem here on latest Opera.

ftp://ftp.freepascal.org/fpc/contrib/windows/dblib_current.zip
ftp://ftp.freepascal.org/fpc/contrib/windows/dblib_0.91.zip
Title: Re: A short and concrete question about dblib.dll
Post by: LacaK on April 25, 2015, 09:23:21 am
ftp://ftp.freepascal.org/fpc/contrib/windows/dblib_current.zip

No problem to download also for me.
And please use above mentioned file, there is latest precompiled version tested with current TMSSQLConnection.
Title: Re: A short and concrete question about dblib.dll
Post by: Gosh on April 25, 2015, 05:20:19 pm
Hmmm... I'm not sure how you did that!

I tried from Firefox, Chrome, Opera...

Quote
This webpage is not available

The webpage at ftp://ftp.freepascal.org/fpc/contrib/windows/dblib_current.zip might be temporarily down or it may have moved permanently to a new web address.

I also tried from FileZilla to establish direct FTP connection to site but when I try to go inside of /pub/fpc/contrib/windows folder, the following error occurs:

Quote
Command:   LIST
Response:   425 Security: Bad IP connecting.
Error:   Failed to retrieve directory listing

Can someone put this file on a cloud service to download from there?
Title: Re: A short and concrete question about dblib.dll
Post by: Gosh on April 25, 2015, 05:30:34 pm
http://ftp.icm.edu.pl/packages/fpc/contrib/windows/

this link worked fine
Title: Re: A short and concrete question about dblib.dll
Post by: LacaK on April 25, 2015, 05:46:03 pm

Quote
Command:   LIST
Response:   425 Security: Bad IP connecting.
Error:   Failed to retrieve directory listing

Can it be, that some IP addresses (areas, countries) are blocked ?
Title: Re: A short and concrete question about dblib.dll
Post by: Gosh on April 25, 2015, 07:48:42 pm
in that case I'd not be able to connect on that FTP server at all, right? ;) I have connection on about 1/3 of folders from ftp server.

Unfortunately, my troubles continues. I put that 3 dll files into WOW64 folder but I'm still getting the message about missing dblib.dll. What else I have to do?
Title: Re: A short and concrete question about dblib.dll
Post by: LacaK on April 25, 2015, 08:22:01 pm
Unfortunately, my troubles continues. I put that 3 dll files into WOW64 folder but I'm still getting the message about missing dblib.dll. What

Which 3 files ?
you need only 2 files:
  dblib.dll and libiconv2.dll (Win32) or libiconv.dll (Win64)

Anp put these files in folder where you have your compiled exe application (or in folder where you have lazarus.exe if you want use connection during developing in IDE)
Title: Re: A short and concrete question about dblib.dll
Post by: Gosh on April 25, 2015, 11:03:17 pm
All 3 files from Win64 folder I put into WOW64 folder, didn't help.

After that I tried with putting files from Win32 folder into Lazarus' main folder. Didn't help.
After that I tried with files from Win64 folder. Didn't help too.

At last I tried inserting these file into project's directory. Didn't work.

  Maybe I'm doing something wrong? I put MSSQL component onto form and set HostName property to "CPC\SQLEXP" and DatabaseName to "Northwind". By idea, this should work fine.
Title: Re: A short and concrete question about dblib.dll
Post by: LacaK on April 27, 2015, 07:21:59 am
Which error do you receive ?
About missing dblib.dll or other ?

Btw. dblib_2008.dll is alternative to dblib.dll
So both are not required.
If you are connecting to MS SQL 2008 or higher you can rename dblib_2008.dll to dblib.dll and use it.
Title: Re: A short and concrete question about dblib.dll
Post by: Gosh on April 27, 2015, 12:22:54 pm
I'm using Win7 x64 and 32-bit version of Lazarus/FPC. Server is SQLServer Express 2008 SP2.

In that case, which version of dblib.dll I have to use? 32 or 64 bit?

Honestly, my start with Lazarus if very confusing and frustrating. There are so many obstacles on every step.                                                                                                                                                                                                                                                             EDIT: I renamed dblib2008 file as you suggested but results are the same.
Title: Re: A short and concrete question about dblib.dll
Post by: LacaK on April 28, 2015, 10:01:02 pm
In that case, which version of dblib.dll I have to use? 32 or 64 bit?
It depends if you compile for Win32 or Win64 target OS (See in Project/Options)?
I guess, that it is Win32 if you have Lazarus for Win32.

Error message indicates, that your application can not locate dblib.dll or libiconv2.dll

Does this error appears if you are working with Lazarus or when you run already compiled application?
Title: Re: A short and concrete question about dblib.dll
Post by: Gosh on April 29, 2015, 03:42:44 pm
It appears when I want to activate DB connection control with parameters needed to work with MSSQL Server. When I put that property to true I'm getting that message box with info that program can't find dll file.
Title: Re: A short and concrete question about dblib.dll
Post by: LacaK on April 29, 2015, 07:57:11 pm
When I put that property to true
In IDE in Object Inspector or when you run program in code ?
Title: Re: A short and concrete question about dblib.dll
Post by: Gosh on April 29, 2015, 10:19:10 pm
In Object inspector
Title: Re: A short and concrete question about dblib.dll
Post by: rvk on April 29, 2015, 10:31:36 pm
All 3 files from Win64 folder I put into WOW64 folder, didn't help.

After that I tried with putting files from Win32 folder into Lazarus' main folder. Didn't help.
After that I tried with files from Win64 folder. Didn't help too.

At last I tried inserting these file into project's directory. Didn't work.
First of all... you have Lazarus 32 bit and are compiling for 32 bit so you should take the files from the win32-folder (not the win64 folder).

Second... 32bit dll should go in C:\Windows\SysWOW64 directory. 64 bit dll's go in C:\Windows\System32. (Yeah...)
But you shouldn't even need them there. It's only necessary to have them in your project directory (where your .exe is) AND if you want to activate the connection from the IDE in the Lazarus directory.

So copy those two files from the win32 to the Lazarus directory and you should be able to set connected to true.

(but it needs to be the two files from the win32-folder)
Title: Re: A short and concrete question about dblib.dll
Post by: Gosh on April 30, 2015, 10:43:48 am
rvk, it seems that Lazarus sees dll files now, thank you for help.

Unfortunately, I still have some issues with this control. What properties should be filled?

DatabaseName: Northwind
HostName: (I tried with 'localhost', network name and CPC\SQLEXP)

Similar approach worked fine with Firebird but refuses to work with SQL Express.

It seems that component can't find server although it works fine.
Title: Re: A short and concrete question about dblib.dll
Post by: rvk on April 30, 2015, 11:38:40 am
You can see what hostname you should use when you look in services (services.msc). Look for a servicename like Sql Server (xxxx). The Hostname you should use is the one between the parentheses.

As default it should be SQLEXPRESS.
So use SQLEXPRESS or localhost\SQLEXPRESS or .\SQLEXPRESS as your Hostname.
Title: Re: A short and concrete question about dblib.dll
Post by: Gosh on April 30, 2015, 02:49:53 pm
I tried all possible variants but without success. MSSQL Management Studio connects to db without any problems. MSSQLConnection component won't.

It returns Error 20013: Server File not found in configuration files. Unknown host SQLEXP (or anything else instead of that).

In the case that I type: localhost\SQLEXP  it returns: Error 20009 Unable to connect: Adaptive Server is unavailable or does not exist (localhost\SQLEXP).
Title: Re: A short and concrete question about dblib.dll
Post by: rvk on April 30, 2015, 03:01:17 pm
Why are you using localhost/SQLEXP? Did you check services.msc to see if the service-name is "SQL SERVER (SQLEXP)"? In that case the name should be correct.

What connection settings are you using in "MSSQL Management Studio"?
Title: Re: A short and concrete question about dblib.dll
Post by: paweld on April 30, 2015, 05:21:32 pm
Try enabled TCP/IP protocol for MSSQL server.
Start \ All programs \ Microsoft SQL Server 2008 \ Configuration tools \ SQL Server configuration manager

Try connection after tcp enabled
Title: Re: A short and concrete question about dblib.dll
Post by: Gosh on April 30, 2015, 06:57:49 pm
it is the exact name of server, no doubt
in mngmt studio I'm using CPC\SQLEXP

I also tried with enabling of TCP/IP, the same situation as before, unfortunately.
Title: Re: A short and concrete question about dblib.dll
Post by: rvk on May 01, 2015, 09:56:18 am
Because you're using TCP/IP and your hostname... did you try disabling your firewall?
Title: Re: A short and concrete question about dblib.dll
Post by: Gosh on May 01, 2015, 05:13:52 pm
if it works with mngmnt studio it sould work with any other app.

No. I tried with disabled firewall just now. The same thing as before.
Title: Re: A short and concrete question about dblib.dll
Post by: marcov on May 01, 2015, 05:45:42 pm
if it works with mngmnt studio it sould work with any other app.

That's not true. There are several ways to approach sqlserver (odbc,ado,oledb), and firewal setttings might be OS specific.
Title: Re: A short and concrete question about dblib.dll
Post by: LacaK on May 01, 2015, 09:54:02 pm
Only tip: if you want connect using instance name (i.e. other than default, which is listening on TCP port 1433), then SQL Server Browser Service must run.
If you know on which port is listening your instance SQLEXP, then you can try conect using HostName='CPC:1433'
Read also: https://msdn.microsoft.com/en-us/ms175043.aspx
Title: Re: A short and concrete question about dblib.dll
Post by: Gosh on May 02, 2015, 12:46:40 am
That's not true. There are several ways to approach sqlserver (odbc,ado,oledb), and firewal setttings might be OS specific.

True or not, app developed from Visual Studio works with that db like a charm. It is working via oledb.
Title: Re: A short and concrete question about dblib.dll
Post by: Gosh on May 02, 2015, 12:57:18 am
Only tip: if you want connect using instance name (i.e. other than default, which is listening on TCP port 1433), then SQL Server Browser Service must run.
If you know on which port is listening your instance SQLEXP, then you can try conect using HostName='CPC:1433'
Read also: https://msdn.microsoft.com/en-us/ms175043.aspx

Port 1433 is already opened, I've checked again. Whatever I do Lazarus returns error codes 20009 and 20013
Title: Re: A short and concrete question about dblib.dll
Post by: LacaK on May 03, 2015, 07:20:40 pm
In link, which I posted is stated:
Instances of SQL Server Express, SQL Server Compact, and named instances of the Database Engine use dynamic ports.

So SQL Server Express probably does not listens on port 1433.
If you connect using instance name (as is your case) there must be running SQL Server Browser Service, which listens on UDP port 1434 (so also this port must be opened on Firewall).
Read also here: https://technet.microsoft.com/en-us/library/ms181087(v=sql.120).aspx
Title: Re: A short and concrete question about dblib.dll
Post by: miab3 on May 03, 2015, 09:28:37 pm
@Gosh

I had a similar problem with the current ZEOS 7.2beta and 7.3beta and Windows 10-64.
It turned out the missing installation:
Microsoft Visual C++ 2010 Redistributable Package... .

Michal
TinyPortal © 2005-2018