Re: Connection error from VBScript



The only firewall we use is Windows Firewall and that is disabled by default
when on the network. So this does not appear to be a firewall issue.

"Richard Mueller" wrote:

Comments below:

"SpecialK" <SpecialK@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0BA6CD1E-79D9-469F-B10E-BEAB30482B1E@xxxxxxxxxxxxxxxx
I'm running a vbscript to return a recordcount from a SQL Server 2000
table.
The script runs successfully on one workstation but not on others. When it
fails I'm receiving the following errors:

-2147467259 from MS OLE DB Provider, Specified SQL Server not found.

This error was probably raised on
objConnection.Open


This is followed by:

3709 from ADODB.Recordset, The connection cannot be used to perform this
operation.

Once the objConnection.Open fails, then objRecordSet.Open will also fail.

In my experience, you only need TCP/IP connectivity and TCP port 1433 to
query an SQL instance over the network. If your query works on one machine
and not another it makes me think a firewall is blocking or a port is
disabled.


Here are a couple variables: I've tested this against our production
server
(across the WAN) and a backup copy on a local SQL server on the LAN. The
production server uses a SQL instance (servername\instance) while the
backup
copy uses only a server name.

One workstation has no trouble running the script against either database.
The other runs successfully against the local db with only a server name,
but
fails on the WAN server with servername\instance.

I've read that the default instance listens on TCP port 1433. Only named
instances use dynamic port allocation. UDP port 1434 is used to query the
server to determine which port to use for a named instance. If UDP port 1434
is disabled, I think you can connect to the default instance, but not a
named instance. This is really beyond my expertize, but seems relevant.
Again, the issue seems to be firewall related. For example see this link:

http://support.microsoft.com/kb/823938


Here's the connection code:

dataSourceString = "Provider=sqloledb; Network Library=DBMSSOCN;Data
Source=" & ServerName & ";Initial Catalog=" & DatabaseName & ";User ID=" &
DBUser & ";Password=" & DBUserPassword &";"

strSQL = "SELECT * FROM CALASGN WHERE ID20GRPID = 'INTERNET' and
ID20STATUS
= 'OPEN'"

Set objConnection = CreateObject("ADODB.Connection")
Set objRecordSet = CreateObject("ADODB.recordset")
objConnection.ConnectionString = datasourcestring
objConnection.Open
objRecordSet.CursorType = 3
objRecordSet.locktype = 2

objRecordSet.Open strSQL, objConnection
intCount = objRecordSet.RecordCount

THANKS!!!

I hope this helps.

--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net



.



Relevant Pages

  • Re: How to Maintain an IIS Server?
    ... > server running on a Windows 2000 server. ... before a firewall and antivirus have been installed]. ... open ports; however, this will not identify which program is using the port. ...
    (microsoft.public.inetserver.iis.security)
  • Re: CEICW fails at firewall config
    ... ISA Server prevents connection to a remote desktop when you connect through ... Remote Web Workplace on a Windows Small Business Server 2003-based computer ... Acceleration Server as a firewall. ... connection uses TCP port 4125. ...
    (microsoft.public.windows.server.sbs)
  • Re: How to Maintain an IIS Server?
    ... >> server running on a Windows 2000 server. ... > before a firewall and antivirus have been installed]. ... > program or executable using that port. ...
    (microsoft.public.inetserver.iis.security)
  • Re: Activesync / Airsync - Alternative Ports
    ... Setup a reverse HTTP proxy. ... Another idea is to use the PPTP capabilities of a Windows Server to allow ... Satellite - Cisco Firewall - Exchange Server ... So on the server side you would configure the port 80 to redirect to ...
    (microsoft.public.pocketpc.activesync)
  • Re: SQL2005: Cannot connect error 11001
    ... The famous Windows Firewall (turned on my Server from which I'm trying to ... Exception Details: System.Data.SqlClient.SqlException: Login failed for user ... Try starting the SQL Server ... if you changed the port ...
    (microsoft.public.sqlserver.connect)