Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL DSN

Status
Not open for further replies.

nettamer

MIS
Mar 17, 2002
24
0
0
US
Help the ASP newbie please!

I have installed SQL2000 on computer 1 and installed IIS on computer 2. I am trying to create an ODBC DSN for SQL on the IIS server, the computer 2, so the asp pages on it can connect to the SQL database on computer 1.

I used the ODBC control panel on computer 2, selected system DSN, selected SQL Server, and the defaults for the rest. However, I get this error:

When selected TCP/IP as the default network, I get:

Connection Failed
SQLState: 'HY000'
SQL Server Error: 86
[Microsoft][ODBC SQL Server Driver] Cannot generate SSPI context.
----------------------------

When selected Named Pipes as the default network, I get:
Connection Failed
SQl State: '01000'
SQL Server Error: 86
[Microsoft][ODBC SQL Server Driver][Named Pipes]ConnectionOpen(CreateFile())
Connection Failed
SQLState: '08001'
SQL Server Error: 86
[Microsoft][ODBC SQL Server Driver]Client unable to establish connection.
---------------------------

However, I can create the DSN for SQl on the computer 1 where SQL reside just fine, suing thesame above steps.

Can anyone help this ASP newbie as to what may be wrong?
 
hello

i know one way to obvercome this but not sure if it is proper.

you can create a file dsn.
also copy the dsn file which gets created in the same directory structure on computer2 and it should work.

spookie
 
You can bypass ODBC altogether and use a native ADO connection. All the ADO libraries (MDAC) are built into the Windows 2000 operating system.
Example of ADO connection string in an include file.

<!-- METADATA TYPE=&quot;typelib&quot;
FILE=&quot;C:\Program Files\Common Files\System\ado\msado15.dll&quot; -->
<%
Dim strCnn
dim loginName
dim loginPassword

' &quot;Login string to access the database;&quot;
' --------------------------------------------------------
strCnn = &quot;Provider=SQLOLEDB;&quot; & _
&quot;Data Source=BigTuna;Database=BANK;&quot; & _
'---- will need to append login name and password
&quot;User Id=sa;Password=;&quot;
%>

EXAMPLE of using the connection string in another page with the include file.

' Create your Recordset Object
Set objRst = Server.CreateObject(&quot;ADODB.Recordset&quot;)

objRst.CursorLocation = 3 'adUseClient
objRst.CursorType = 3 'adOpenStatic
objRst.ActiveConnection = objConn

' Open the recordset. Sql has the SQL string in it.
objRst.Open Sql, objConn, adOpenStatic, adLockReadOnly

If you need help building the connection string post back and I can outline the steps to easily create and test a connection string.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top