Solved

ASP SQL Native Connection to SQL Express Server

Posted on 2012-03-31
3
344 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 9

Accepted Solution

by:
OCDan earned 250 total points
ID: 37791560
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
ID: 37793505
As indicated, you would best advised to use SQL Server Authentication.
0
 

Author Closing Comment

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

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

636 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