Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 19th, 2005, 10:45 AM
Registered User
 
Join Date: Feb 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Johnny6000
Default Can't make Connection

I have tried to make a DSN and a DSN-less connection to SQL databases both on my local machine and on my network. I *can* make a connection through Microsoft Query Analyzer to both databases through Windows authentication.

The ASP code is as follows:

1) For the DSN-less connection
<%
    Dim objConn
    Dim objRec
    Dim strConnect

    Set objConn = Server.CreateObject("ADODB.Connection")
    Set objRec = Server.CreateObject("ADODB.Recordset")
    strConnect= "Driver=(SQLServer);Server=Remote; DataBase=Warehouse;UID=myname;PWD=mypassword;"
    objConn.Open strConnect

    objRec.Open "Select top 10* from myTable", objConn, 0,1,2

For the local machine substitute:
       strConnect = "Driver=(SQL Server);Server=(local);DataBase=localDB;UID=myname ;PWD=mypassword;"
%>

2) For the DSN connection I connect the ODBC to the remote database, naming the DSN "Remote" and to the local database naming it "Local". Both Test connections succeed.

I use the following code:

<%
    Dim objConn
    Dim objRec
    Dim strConnect

    Set objConn = Server.CreateObject("ADODB.Connection")
    Set objRec = Server.CreateObject("ADODB.Recordset")

  'For remote connection
        objConn.Open "DSN=Remote"
   'For local connection
        objConn.Open "DSN=(local)"

%>

In all cases I get back the error message:

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

I know the data source is there, and I *did* mention the default driver.

What's going on? Why can't I make this connection?

John


Johnny6000
 
Old April 20th, 2005, 03:39 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

does this help? http://www.aspfaq.com/show.asp?id=2126
 
Old April 20th, 2005, 04:32 AM
Authorized User
 
Join Date: Dec 2004
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

try with using provider instead of driver.
 provider=sqloledb.1;server=remote;...........






Similar Threads
Thread Thread Starter Forum Replies Last Post
WebShop : I cannot make remote connection JoinTTT BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 5 April 7th, 2007 04:33 PM
How to make a connection with access database arshad mahmood Classic ASP Professional 1 April 18th, 2006 03:53 AM
How make an automatic dsn less connection abhisheksud Classic ASP Databases 3 October 7th, 2005 04:51 AM
cannot make JSP-MySQL connection pandjie JSP Basics 1 November 12th, 2004 01:21 PM
Cannot make connection after opening Access doonman Classic ASP Databases 2 September 29th, 2003 08:42 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.