Recent

Author Topic: using sql server over internet  (Read 7602 times)

amigoface

  • New Member
  • *
  • Posts: 10
using sql server over internet
« on: November 16, 2011, 06:32:53 am »
Hi,
i am trying to use ms sql server 2008 located in my web host (arvixe.com) using zeos Lib

since every connection paramater are right , i cannot connect
i can connect with sql server management studio without any problem but not from the application i am writing


any help is welcome

thanks and good day

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: using sql server over internet
« Reply #1 on: November 16, 2011, 10:06:20 am »
The connection is specified in TZConnection.HostName in the format host\instance. F.e 192.168.2.91\SQLEXPRESS.
To specify the port use the format host\instance,port. F.e. 192.168.2.91\SQLEXPRESS,1433

amigoface

  • New Member
  • *
  • Posts: 10
Re: using sql server over internet
« Reply #2 on: November 16, 2011, 10:19:40 am »
the web host has sql server 2008 (not express)
and i can login with this account information with sql management studio :

Server : mydomainname
Username+password

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: using sql server over internet
« Reply #3 on: November 16, 2011, 11:04:29 am »
Sql management studio uses the SQL Server Browser functionality to find running instances on the server using port 1434 (default). That is the reason why you don't have to specify an instance when connecting with Sql management studio. To get the instance, right click on the server object and select properties. The first line in the General tab called Name will give you the full name (host\instance). That is the name that needs to be used in Zeos.
Quote
the web host has sql server 2008 (not express)
That was only an example. The principle is the same for non express databases.

amigoface

  • New Member
  • *
  • Posts: 10
Re: using sql server over internet
« Reply #4 on: November 16, 2011, 11:35:30 am »
after connecting in management studio it gave me some thing like :
Quote
C15472-154761\SQLEXPRESS
wich i doubt i can  access with that using zeos ...

Quote
otherwise i have tested with delphi and ado and it gave me more explicit error message :

ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: using sql server over internet
« Reply #5 on: November 16, 2011, 11:53:10 am »
after connecting in management studio it gave me some thing like :
Quote
C15472-154761\SQLEXPRESS
wich i doubt i can  access with that using zeos ...
C15472-154761 is the host name on the internal network at the web host. So try mydomainname\SQLEXPRESS.
BTW looks like your web host is cheating: it is SQLEXPRESS ;)

Quote
otherwise i have tested with delphi and ado and it gave me more explicit error message :
Something went wrong there.

amigoface

  • New Member
  • *
  • Posts: 10
Re: using sql server over internet
« Reply #6 on: November 16, 2011, 12:07:24 pm »
lol

yes in delphi i have this error message

Quote
The login is from an untrusted domain and cannot be used with Windows authentication'


ludob

  • Hero Member
  • *****
  • Posts: 1173
Re: using sql server over internet
« Reply #7 on: November 16, 2011, 12:44:47 pm »
Quote
The login is from an untrusted domain and cannot be used with Windows authentication'
That is because ado tries to use Windows authentication. Do you have a "Trusted_Connection=yes;" or "Integrated Security=SSPI" in the connection string?
I assume you connect in Sql management studio with SQL Server Authentication, ie. providing a username and password.

Did you try mydomainname\SQLEXPRESS in TZConnection.HostName?

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: using sql server over internet
« Reply #8 on: November 16, 2011, 12:45:25 pm »
You're trying to use integrated authentication/SSPI/trusted connection, which uses your current Windows credentials.  Your PC obviously is not a member of a domain of the hosting provider's server, so that server doesn't accept your credentials.

You might need to specify username (hint: often sa) and password. Don't know Zeos, you might need to set trusted connection off explicitly, or it might not be necessary.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

 

TinyPortal © 2005-2018