Showing posts with label attempting. Show all posts
Showing posts with label attempting. Show all posts

Sunday, March 25, 2012

Connecting to SQL from IIS

Hi All,
I'm attempting to connect my .asp page to an SQL 2005 server and I'm
receiving the following error:
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for
user ''. The
user is not associated with a trusted SQL Server connection.
The SQL server is set for mixed authentication and my connection string
points to an ODBC connection on my web server (and it showed that it was
successfully able to connect after the DSN was created). Are there other
steps on my SQL server that need to be performed to allow for authentication
from IIS? I will also post my connection string below from my ASP page:
<%
Const adOpenStatic = 3
Const adLockReadOnly = 1
'Open Connection to Database
set Conn = Server.CreateObject("ADODB.Connection")
qryDSN = "DSN=BT"
Conn.open qryDSN
set rs = Server.CreateObject("ADODB.RecordSet")
sql = "SELECT CO_COMPANY_NAME FROM COMPANIES"
rs.open sql, conn, adOpenStatic, adLockReadOnly
rs.movefirst
do while not rs.EOF
response.Write(rs.fields(0))
loop
%>
Any help is appreciated!!
Joe Corey
MCSE, MCSA, Security+
jcorey@.andrew.cmu.eduIs the DSN using a SQL Authen. or WIndows Authenticatio. I guess it is
using Windows Authentication and the SQL Server is not on the same box
like the IIS Server. If so, and my guess was right, you will have to
enabled the IIS to delegate authentication. More about this can be
found on the MSDN knowledge base article. Simply search for "Delegation
AND SQL SERVER". After setting up a security principal name SPN you
will be able to authenticate the users.
HTH, Jens Suessmeyer.
http://www.sqlserver2005.de
--

Tuesday, February 14, 2012

Connect via sqldmo

Attempting to connect to MSDE 2000 via sqldmo w/ vb 6 app. For example,
oSqlServer.Connect sSrvName, "sa", sPswd
However, receiving the following error message "Not associated with a
trusted SQL Server connection"
I've looked on microsoft support, which offered a workaround for this error
(kb #889615). However, the workaround applied to Win98. This error is
occuring on a Win xp machine.
any help is appreciated.
hi Jim
jim wrote:
> Attempting to connect to MSDE 2000 via sqldmo w/ vb 6 app. For
> example, oSqlServer.Connect sSrvName, "sa", sPswd
> However, receiving the following error message "Not associated with a
> trusted SQL Server connection"
> I've looked on microsoft support, which offered a workaround for this
> error (kb #889615). However, the workaround applied to Win98. This
> error is occuring on a Win xp machine.
>
usually that exception means MSDE has been installed without allowing
standard SQL Server authenticated connections but trusted connections only
(that is the default)
please have a look at
http://support.microsoft.com/default.aspx?scid=kb;en-us;285097 for futher
info on how to modify the Windows registry to modify the setting..
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz http://italy.mvps.org
DbaMgr2k ver 0.21.0 - DbaMgr ver 0.65.0 and further SQL Tools
-- remove DMO to reply
|||Hi Andrea,
That absolutely worked! Your help is greatly appreciated. However, it
appears that I have run into another problem when attempting to attach db
files the msde installation.
I'm receiving the following error:
Error -2147216399. Device activation error. The physical file name
'C:\Program' may be incorrect.
I initially that this was due to permission error, so I included
ALLOWXDBCHAINING=1 in the setup parameters, but to no avail. Would it the
actual file location? That is, the space between "Program" and "Files"?
"Andrea Montanari" wrote:

> hi Jim
> jim wrote:
> usually that exception means MSDE has been installed without allowing
> standard SQL Server authenticated connections but trusted connections only
> (that is the default)
> please have a look at
> http://support.microsoft.com/default.aspx?scid=kb;en-us;285097 for futher
> info on how to modify the Windows registry to modify the setting..
> --
> Andrea Montanari (Microsoft MVP - SQL Server)
> http://www.asql.biz http://italy.mvps.org
> DbaMgr2k ver 0.21.0 - DbaMgr ver 0.65.0 and further SQL Tools
> -- remove DMO to reply
>
>
|||hi Jim,
jim wrote:
> Hi Andrea,
> That absolutely worked! Your help is greatly appreciated. However, it
> appears that I have run into another problem when attempting to
> attach db files the msde installation.
> I'm receiving the following error:
> Error -2147216399. Device activation error. The physical file name
> 'C:\Program' may be incorrect.
if you are using DMO to perform attabch, backup, restore operations you have
to better enclose paths in square brackets like
fileName = "[c:\program files\folder with spaces\file with spaces.xxx]"
if they include spaces..
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz http://italy.mvps.org
DbaMgr2k ver 0.21.0 - DbaMgr ver 0.65.0 and further SQL Tools
-- remove DMO to reply
|||Hi Andrea,
Sweet. I will definitely do so. I forgot that the AttachDB() or sp_attach_db
is pretty much a wrapper for CREATE DATABASE.
Thanks again for all of your help.
"Andrea Montanari" wrote:

> hi Jim,
> jim wrote:
> if you are using DMO to perform attabch, backup, restore operations you have
> to better enclose paths in square brackets like
> fileName = "[c:\program files\folder with spaces\file with spaces.xxx]"
> if they include spaces..
> --
> Andrea Montanari (Microsoft MVP - SQL Server)
> http://www.asql.biz http://italy.mvps.org
> DbaMgr2k ver 0.21.0 - DbaMgr ver 0.65.0 and further SQL Tools
> -- remove DMO to reply
>
>

Sunday, February 12, 2012

Connect to SQL Server from machine not in domain

I am attempting to connect to a SQL Server that is in a domain that I
have a VPN connection to. I am receiving the Error: "Login failed for
user '(null)'. Reason: Not associated with a trusted SQL Server
connection. (Microsoft SQL Server, Error: 18452)
I errantly had expected that by mapping a drive to one of the shares
on the SQL Server that I am attempting to connect to, that I would be
able to connect ok using Integrated Windows Authentication. I have
even renamed my local UID/pwd to match that on the domain that owns
the SQL Server I am attempting to connect to.
Thoughts?Hi
If you have granted login to that user or a domain group on the domain where
the sql server is (where the user is a member) , then you should be able to
log in even though the user is in a different domain. If you can't grant the
login and if you can't change the way the domains trust each other, then you
will need to ue SQL Authentication.
John
"brandor" wrote:
> I am attempting to connect to a SQL Server that is in a domain that I
> have a VPN connection to. I am receiving the Error: "Login failed for
> user '(null)'. Reason: Not associated with a trusted SQL Server
> connection. (Microsoft SQL Server, Error: 18452)
> I errantly had expected that by mapping a drive to one of the shares
> on the SQL Server that I am attempting to connect to, that I would be
> able to connect ok using Integrated Windows Authentication. I have
> even renamed my local UID/pwd to match that on the domain that owns
> the SQL Server I am attempting to connect to.
> Thoughts?
>