Solved

ASP SQL Native Connection to SQL Express Server

Posted on 2012-03-31
3
338 Views
Last Modified: 2012-04-01
I am trying to connect to a SQL database on another file server, but receive an error when I run the ASP:

XDBc Test

Microsoft SQL Native Client error '80004005'

Cannot open database "pbsdata" requested by the login. The login failed.

/odbc/test_xdbc.asp, line 10

The asp page is:

<h1>XDBc Test</h1>
<%
      'On Error Resume Next

      
      Dim conn

      set conn=Server.CreateObject("ADODB.Connection")
      conn.ConnectionString =  "Provider=SQLNCLI.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=pbsdata;Data Source=profish-app01\SQLExpress"
      conn.open




      If conn.State = 1 Then
            response.write("connected1")
         Else
            response.write("FAIL")
      End If

       If db <> 0 Then

      End If
      conn.close
      set conn=nothing
%>


I had created the connection string by creating a udl file, and then cutting and pasting the connection string from notepad. When I test the UDL file, the test connection works.

The ASP page is located on a Windows 2003 Server Service Pack 2

Any help would be greatly appreciated.
0
Comment
Question by:rrudolph
3 Comments
 
LVL 9

Accepted Solution

by:
OCDan earned 250 total points
Comment Utility
You currently have it set to use integrated security, and the user that is passed through is not yours, it is the asp programs.

Just to verify this add a user and password to the end of the connection string one that you know has access rights on SQL server e.g.:
conn.ConnectionString =  "Provider=SQLNCLI.1;Persist Security Info=False;Initial Catalog=pbsdata;Data Source=profish-app01\SQLExpress;user=dan;password=dan"

If that is the case then check what user you have IIS set to run as, I believe the default is IUSR_MachineName

Although not this exact problem this article explains how to set appropriate security permissions:
SQL Permissions
0
 
LVL 75

Assisted Solution

by:Anthony Perkins
Anthony Perkins earned 250 total points
Comment Utility
As indicated, you would best advised to use SQL Server Authentication.
0
 

Author Closing Comment

by:rrudolph
Comment Utility
I never was able to make Microsoft Authentication work. SQL authentication did work.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now