- From: AJ C
- Subject: [asp_ecommerce] Re: can't connect to sql server properly.
- Date: Tue, 18 Dec 2001 10:30:09 -0800
There are several ways to connect to a SQL Server
database I have included some of the string
connections samples below to see if they help. One
thing you might think to check is the way that you are
chosing to connect to the database (i.e. global.asa
variables or using a string connection definition in a
include file .inc. As to the error that you have check
to see if the database is set for NT authentication
then change it to SQL authentication. Also, Check your
connection string and see if there is a misspelling on
any of the entries. Line 17 in of the dept.asp page is
having an issue you strat by checking that portion of
your code the string or if something is commented out
you can also check out this link for further
assistance.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbcsql/od_odbc_d_4x4k.asp
ODBC Driver for SQL Server
For Standard Security:
oConn.Open "Driver={SQL Server};" & _
"Server=MyServerName;" & _
"Database=myDatabaseName;" & _
"Uid=myUsername;" & _
"Pwd=myPassword;"
For Trusted Connection security:
oConn.Open "Driver={SQL Server};" & _
"Server=MyServerName;" & _
"Database=myDatabaseName;" & _
"Uid=;" & _
"Pwd=;"
' Or
oConn.Open "Driver={SQL Server};" & _
"Server=MyServerName;" & _
"Database=myDatabaseName;" & _
"Trusted_Connection=yes;"
To Prompt user for username and password
oConn.Properties("Prompt") = adPromptAlways
oConn.Open "Driver={SQL Server};" & _
"Server=MyServerName;" & _
"DataBase=myDatabaseName;"
For a Trusted Connection:
oConn.Open "Provider=sqloledb;" & _
"Data Source=myServerName;" & _
"Initial Catalog=myDatabaseName;" &
_
"Integrated Security=SSPI;"
To connect via an IP address:
oConn.Open "Provider=sqloledb;" & _
"Data Source=xxx.xxx.xxx.xxx,1433;"
& _
"Network Library=DBMSSOCN;" & _
"Initial Catalog=myDatabaseName;" &
_
"User ID=myUsername;" & _
"Password=myPassword;"
Note:
- xxx.xxx.xxx.xxx is an IP address
- "Network Library=DBMSSOCN" tells OLE DB to use
TCP/IP rather than Named Pipes
- 1433 is the default port number for SQL Server
- You can also add "Encrypt=yes"
MORE INFORMATION
SQL Server allows you to use the following network
libraries when establishing a connection. They are:
· dbnmpntw - Win32 Named Pipes
· dbmssocn - Win32 Winsock TCP/IP
· dbmsspxn - Win32 SPX/IPX
· dbmsvinn - Win32 Banyan Vines
· dbmsrpcn - Win32 Multi-Protocol (Windows RPC)
When connecting to SQL Server through ADO the NETWORK
parameter in the connection string can be used to
specify which of these libraries to use when
connecting to the database. The NETWORK parameter is
the name of the Net-Library module to use, without the
.dll suffix (for example, Dbmssocn, not Dbmssocn.dll).
Here are some examples of connection strings that
specify this parameter:
· The connection string:
"Provider=SQLOLEDB.1;Persist Security Info=False;User
ID=sa;Initial Catalog=pubs;Data
Source=YourDataSourceName;Network Library=dbnmpntw"
attempts to connect to SQL Server through the SQLOLEDB
provider using the Named Pipes network library.
· The connection string:
"Provider=MSDASQL.1;Persist Security Info=False;User
ID=sa;Extended
Properties="DSN=yourdatasourcename;UID=sa;DATABASE=pubs;Network=dbmssocn";Initial
Catalog=pubs"
connects to SQL Server through the MSDASQL provider
using the TCP/IP network library.
OLE DB to SQL Server:
oConn.Open "Provider=MSDASQL;" & _
"Driver={SQL Server};" & _
"Server=myServerName;" & _
"Database=myDatabaseName;" & _
"Uid=myUsername;" & _
"Pwd=myPassword;"
Let me know how this turns out.
Regards,
Aaron J Celis II
Carnival Cruise Lines
Data Warehousing
--- jeff scott <jeff@jeffscott.com> wrote:
> I set up everything on page 31-32 for sql server.
> When I
> click on any of links I get this:
>
> [Microsoft][ODBC SQL Server Driver][SQL Server]Login
> failed for
> user 'JoCoffeeWeb'. Reason: Not associated with a
> trusted SQL Server
> connection.
>
> /JoCoffee/dept.asp, line 17
>
>
> someone please help!
>
> thanks,
> jeff scott
>
> ---
> Change your mail options at
> http://p2p.wrox.com/manager.asp or
> to unsubscribe send a blank email to
leave-asp_ecommerce-60124H@p2p.wrox.com.
=====
Mr. Aaron J. Celis II
Application Developer / Datawarehousing
CornerStone Team
Carnival Cruise Lines
acelis@carnival.com
Tel 305-599-2600 Ext. 64771
Pager 305-346-8281