Solved

ASP SQL Native Connection to SQL Express Server

Posted on 2012-03-31
3
342 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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Everyone has problem when going to load data into Data warehouse (EDW). They all need to confirm that data quality is good but they don't no how to proceed. Microsoft has provided new task within SSIS 2008 called "Data Profiler Task". It solve th…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

756 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