Recent

Author Topic: A short and concrete question about dblib.dll  (Read 16279 times)

Gosh

  • Jr. Member
  • **
  • Posts: 72
Re: A short and concrete question about dblib.dll
« Reply #15 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.

LacaK

  • Hero Member
  • *****
  • Posts: 691
Re: A short and concrete question about dblib.dll
« Reply #16 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 ?

Gosh

  • Jr. Member
  • **
  • Posts: 72
Re: A short and concrete question about dblib.dll
« Reply #17 on: April 29, 2015, 10:19:10 pm »
In Object inspector

rvk

  • Hero Member
  • *****
  • Posts: 6109
Re: A short and concrete question about dblib.dll
« Reply #18 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)

Gosh

  • Jr. Member
  • **
  • Posts: 72
Re: A short and concrete question about dblib.dll
« Reply #19 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.

rvk

  • Hero Member
  • *****
  • Posts: 6109
Re: A short and concrete question about dblib.dll
« Reply #20 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.

Gosh

  • Jr. Member
  • **
  • Posts: 72
Re: A short and concrete question about dblib.dll
« Reply #21 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).

rvk

  • Hero Member
  • *****
  • Posts: 6109
Re: A short and concrete question about dblib.dll
« Reply #22 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"?

paweld

  • Hero Member
  • *****
  • Posts: 970
Re: A short and concrete question about dblib.dll
« Reply #23 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
Best regards / Pozdrawiam
paweld

Gosh

  • Jr. Member
  • **
  • Posts: 72
Re: A short and concrete question about dblib.dll
« Reply #24 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.

rvk

  • Hero Member
  • *****
  • Posts: 6109
Re: A short and concrete question about dblib.dll
« Reply #25 on: May 01, 2015, 09:56:18 am »
Because you're using TCP/IP and your hostname... did you try disabling your firewall?

Gosh

  • Jr. Member
  • **
  • Posts: 72
Re: A short and concrete question about dblib.dll
« Reply #26 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.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11382
  • FPC developer.
Re: A short and concrete question about dblib.dll
« Reply #27 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.

LacaK

  • Hero Member
  • *****
  • Posts: 691
Re: A short and concrete question about dblib.dll
« Reply #28 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

Gosh

  • Jr. Member
  • **
  • Posts: 72
Re: A short and concrete question about dblib.dll
« Reply #29 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.

 

TinyPortal © 2005-2018