Recent

Author Topic: Connect to MSSQL-Server (solved)  (Read 7899 times)

eikko

  • Newbie
  • Posts: 4
Connect to MSSQL-Server (solved)
« on: November 15, 2017, 01:51:33 pm »
Hi all,

on Debian8 with Lazarus 1.6.2 i get a connection with "MSSQLConnection" to a MSSQL-Server,
on Debian9 with the same Project in Lazarus 1.6.2 i get only an Error:
"MSSQLConnection1 : Error 20013 : Server name not found in configuration files Unknown host machine name"

Anyone a Idea why?

Thanks eikko
« Last Edit: November 16, 2017, 08:48:38 am by eikko »

tudi_x

  • Hero Member
  • *****
  • Posts: 532
Re: Connect to MSSQL-Server
« Reply #1 on: November 15, 2017, 03:34:07 pm »
hi,
did you place a connection object on the form or wrote the connection object from scratch in code?
(i prefer the later)
« Last Edit: November 15, 2017, 03:47:28 pm by tudi_x »
Lazarus 2.0.2 64b on Debian LXDE 10

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: Connect to MSSQL-Server
« Reply #2 on: November 15, 2017, 03:44:56 pm »
"MSSQLConnection1 : Error 20013 : Server name not found in configuration files Unknown host machine name"
Could you use server IP adress instead of server name and try again?
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

eikko

  • Newbie
  • Posts: 4
Re: Connect to MSSQL-Server
« Reply #3 on: November 15, 2017, 03:55:54 pm »
@ tudi_x
i edit the Parameters in the Propertys of the Component,
in Debian8 it works fine!

@ avra
if i use the IP-Adress as Hostename i get an Error:
"MSSQLConnection1 : Error 20009 :
Unable to connect: Adaptive Server is unavailable or does not exist"


Thanks eikko


tudi_x

  • Hero Member
  • *****
  • Posts: 532
Re: Connect to MSSQL-Server
« Reply #4 on: November 15, 2017, 04:05:42 pm »
did you compare in the project lfm files the connection object?
are the values the same?
Lazarus 2.0.2 64b on Debian LXDE 10

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Connect to MSSQL-Server
« Reply #5 on: November 15, 2017, 04:26:41 pm »
a bit more info is required. Please describe your setup for us, for example is the mssql server in a dedicated machine/VM? are there two separate sql servers? Are both clients (debian 8, debian 9) on the same network or there is any nat/router in between. Is there any firewall in between? does the firewall allow connections in ports bellow 1024 with out being a root/admin? do you have white list setup on your firewall?
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

Graeme

  • Hero Member
  • *****
  • Posts: 1428
    • Graeme on the web
Re: Connect to MSSQL-Server
« Reply #6 on: November 15, 2017, 09:15:15 pm »
Anyone a Idea why?

If you SQL Server uses instance names, make sure you specify that in the connection string as well.

For example, here is the connection string syntax I use in tiOPF with SqlDB (FPC) database components connecting to a SQL Server database.

Code: Pascal  [Select][+][-]
  1.     GTIOPFManager.ConnectDatabase('192.168.0.20:QTS3D', 'sa', 'password', '');

    ...or with a server instance...

Code: Pascal  [Select][+][-]
  1.     GTIOPFManager.ConnectDatabase('servername\instancename:QTS3D', 'sa', 'password', '');

    ...or with extra connection parameters...

Code: Pascal  [Select][+][-]
  1.     GTIOPFManager.ConnectDatabase('servername:databasename',
  2.         'sa', 'password', 'TextSize=16777216,ApplicationName=YourAppName');
--
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

eikko

  • Newbie
  • Posts: 4
Re: Connect to MSSQL-Server
« Reply #7 on: November 16, 2017, 07:53:47 am »
Quote
a bit more info is required. Please describe your setup for us, for example is the mssql server in a dedicated machine/VM? are there two separate sql servers? Are both clients (debian 8, debian 9) on the same network or there is any nat/router in between. Is there any firewall in between? does the firewall allow connections in ports bellow 1024 with out being a root/admin? do you have white list setup on your firewall?

Hi taazz,

in the network are exists 2 SQL-Servers in VmWare ESXi,
there is no Firewall between Server and Client,
Server and Clients are in the same Network,
both Clients are running in a VmWare Workstation 10


Quote
If you SQL Server uses instance names, make sure you specify that in the connection string as well.

Hi Graeme,
the SQL-Server is standard, no instances.

Only the Name of the Server contains a "\" (HostName  = "xxx\yyyyyyyyy"),
but we never had Problems with this!

thanks eikko


eikko

  • Newbie
  • Posts: 4
Re: Connect to MSSQL-Server
« Reply #8 on: November 16, 2017, 08:47:41 am »
Quote
Only the Name of the Server contains a "\" (HostName  = "xxx\yyyyyyyyy"),
Sorry, this was a Mistake!

Graeme was on the right way!

With IP-Adress\Hostename ("xxx.xxx.xxx.xxx\yyyyyyyy") i get a Connection!

Problem is solved!

Thanks to all who helped!

eikko

 

TinyPortal © 2005-2018