Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

ASP SQL Native Connection to SQL Express Server

Posted on 2012-03-31
3
Medium Priority
?
349 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 750 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 750 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
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

926 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