473,795 Members | 3,175 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unable to connect to DSN

I have a page that is trying to connect to my SQL Database. All the
code I have seen shows me to connect the same way. The error I am
getting says:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Data source name not found and no
default driver specified
/connectDB.asp, line 13
Now I know the DSN is there, because my VB program uses it on the same
machine. I copied the Open string directly from the VB program. This
is the same format I find in all my other examples. None have any
default drivers specified.

Here is the HTML file:
*************** *************** *************** *************** *********
<html>
<head>
<title>ABC Corporation</title>
</head>
<body>

<h2>ABC Corporation Employee Extensions</h2>
<p>

<%
Set connectionToDat abase=Server.Cr eateObject("ADO DB.Connection")
connectionToDat abase.Connectio nTimeout = 60
connectionToDat abase.Open "DSN=Custom er;" & _
"UID=sa;PWD ="

connectionToDat abase.Close
Set connectionToDat abase=Nothing
%>

</body>
</html>
*************** *************** *************** *************** *********

What am I missing?

Thanks,

Tom.

Jul 19 '05 #1
7 2218
Try the following;

<%
Set connectionToDat abase=Server.Cr eateObject("ADO DB.Connection")
connectionToDat abase.Connectio nTimeout = 60
connectionToDat abase.Open "Customer", "sa", ""

connectionToDat abase.Close
Set connectionToDat abase=Nothing
%>

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Thomas Scheiderich <tf*@deltanet.c om> wrote in message
news:40******** ****@deltanet.c om...
I have a page that is trying to connect to my SQL Database. All the
code I have seen shows me to connect the same way. The error I am
getting says:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Data source name not found and no
default driver specified
/connectDB.asp, line 13
Now I know the DSN is there, because my VB program uses it on the same
machine. I copied the Open string directly from the VB program. This
is the same format I find in all my other examples. None have any
default drivers specified.

Here is the HTML file:
*************** *************** *************** *************** *********
<html>
<head>
<title>ABC Corporation</title>
</head>
<body>

<h2>ABC Corporation Employee Extensions</h2>
<p>

<%
Set connectionToDat abase=Server.Cr eateObject("ADO DB.Connection")
connectionToDat abase.Connectio nTimeout = 60
connectionToDat abase.Open "DSN=Custom er;" & _
"UID=sa;PWD ="

connectionToDat abase.Close
Set connectionToDat abase=Nothing
%>

</body>
</html>
*************** *************** *************** *************** *********

What am I missing?

Thanks,

Tom.

Jul 19 '05 #2
Steven Burn wrote:
Try the following;

<%
Set connectionToDat abase=Server.Cr eateObject("ADO DB.Connection")
connectionToDat abase.Connectio nTimeout = 60
connectionToDat abase.Open "Customer", "sa", ""

connectionToDat abase.Close
Set connectionToDat abase=Nothing
%>
No, same error. I am running on W2k. Do I need to do something special
with the Web Server to handle ODBC?

Tom.
--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Thomas Scheiderich <tf*@deltanet.c om> wrote in message
news:40******** ****@deltanet.c om...
I have a page that is trying to connect to my SQL Database. All the
code I have seen shows me to connect the same way. The error I am
getting says:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Data source name not found and no
default driver specified
/connectDB.asp, line 13
Now I know the DSN is there, because my VB program uses it on the same
machine. I copied the Open string directly from the VB program. This
is the same format I find in all my other examples. None have any
default drivers specified.

Here is the HTML file:
************* *************** *************** *************** ***********
<html>
<head>
<title>ABC Corporation</title>
</head>
<body>

<h2>ABC Corporation Employee Extensions</h2>
<p>

<%
Set connectionToDat abase=Server.Cr eateObject("ADO DB.Connection")
connectionToD atabase.Connect ionTimeout = 60
connectionToD atabase.Open "DSN=Custom er;" & _
"UID=sa;PWD ="

connectionToD atabase.Close
Set connectionToDat abase=Nothing
%>

</body>
</html>
************* *************** *************** *************** ***********

What am I missing?

Thanks,

Tom.



Jul 19 '05 #3
How does it work if the connection is literal instead of via a DSN?

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Thomas Scheiderich <tf*@deltanet.c om> wrote in message
news:40******** ******@deltanet .com...
Steven Burn wrote:
Try the following;

<%
Set connectionToDat abase=Server.Cr eateObject("ADO DB.Connection")
connectionToDat abase.Connectio nTimeout = 60
connectionToDat abase.Open "Customer", "sa", ""

connectionToDat abase.Close
Set connectionToDat abase=Nothing
%>

No, same error. I am running on W2k. Do I need to do something special
with the Web Server to handle ODBC?

Tom.
--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Thomas Scheiderich <tf*@deltanet.c om> wrote in message
news:40******** ****@deltanet.c om...
I have a page that is trying to connect to my SQL Database. All the
code I have seen shows me to connect the same way. The error I am
getting says:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Data source name not found and no
default driver specified
/connectDB.asp, line 13
Now I know the DSN is there, because my VB program uses it on the same
machine. I copied the Open string directly from the VB program. This
is the same format I find in all my other examples. None have any
default drivers specified.

Here is the HTML file:
************* *************** *************** *************** ***********
<html>
<head>
<title>ABC Corporation</title>
</head>
<body>

<h2>ABC Corporation Employee Extensions</h2>
<p>

<%
Set connectionToDat abase=Server.Cr eateObject("ADO DB.Connection")
connectionToD atabase.Connect ionTimeout = 60
connectionToD atabase.Open "DSN=Custom er;" & _
"UID=sa;PWD ="

connectionToD atabase.Close
Set connectionToDat abase=Nothing
%>

</body>
</html>
************* *************** *************** *************** ***********

What am I missing?

Thanks,

Tom.


Jul 19 '05 #4
Thomas Scheiderich wrote:

No, same error. I am running on W2k. Do I need to do something
special with the Web Server to handle ODBC?

Can we convince you to stop using ODBC? At the very least, stop using the sa
account for your applications. You're asking for trouble by doing this. That
sa account should be guarded as if your job depends on it, which it probably
does.

Here's a simple OLEDB connection string (I can't bring myself to type
"connectionToDa tabase" when "cn" will do):

cn.open "Provider=sqlol edb;data source=<name of your server>;" & _
"initial catalog=<name of database>" & _
"user id=<some account other than sa>;password=<p assword>"

If I can't convince you that OLEDB is better: Is the DSN a system DSN? It
needs to be.

Bob Barrows

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #5
Steven Burn wrote:
How does it work if the connection is literal instead of via a DSN?

Not sure what you mean.

How would I set it up?

It works using the DSN line from VB and directly from Sql Server 7. All
of the pieces (Web Server, Sql Server 7, and Browser) are on the same
machine.

Tom.

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer:
I know I'm probably wrong, I just like taking part ;o)
Thomas Scheiderich <tf*@deltanet.c om> wrote in message
news:40******** ******@deltanet .com...
Steven Burn wrote:

Try the following;

<%
Set connectionToDat abase=Server.Cr eateObject("ADO DB.Connection")
connectionToDat abase.Connectio nTimeout = 60
connectionToDat abase.Open "Customer", "sa", ""

connectionToDat abase.Close
Set connectionToDat abase=Nothing
%>


No, same error. I am running on W2k. Do I need to do something special
with the Web Server to handle ODBC?

Tom.

--
Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!

Disclaimer :
I know I'm probably wrong, I just like taking part ;o)
Thomas Scheiderich <tf*@deltanet.c om> wrote in message
news:40***** *******@deltane t.com...
I have a page that is trying to connect to my SQL Database. All the
code I have seen shows me to connect the same way. The error I am
getting says:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Data source name not found and no
default driver specified
/connectDB.asp, line 13
Now I know the DSN is there, because my VB program uses it on the same
machine. I copied the Open string directly from the VB program. This
is the same format I find in all my other examples. None have any
default drivers specified.

Here is the HTML file:
*********** *************** *************** *************** *************
<html>
<head>
<title>AB C Corporation</title>
</head>
<body>

<h2>ABC Corporation Employee Extensions</h2>
<p>

<%
Set connectionToDat abase=Server.Cr eateObject("ADO DB.Connection")
connectionT oDatabase.Conne ctionTimeout = 60
connectionT oDatabase.Open "DSN=Custom er;" & _
"UID=sa;PWD ="

connectionT oDatabase.Close
Set connectionToDat abase=Nothing
%>

</body>
</html>
*********** *************** *************** *************** *************

What am I missing?

Thanks,

Tom.



Jul 19 '05 #6
Bob Barrows [MVP] wrote:
Thomas Scheiderich wrote:
No, same error. I am running on W2k. Do I need to do something
special with the Web Server to handle ODBC?

Can we convince you to stop using ODBC? At the very least, stop using the sa
account for your applications. You're asking for trouble by doing this. That
sa account should be guarded as if your job depends on it, which it probably
does.

I was only using ODBC, because there is a problem I have not been able
to solve on setting up UDL file. My W2K is missing something, but it
won't handle the file correctly. My other W2K machine does it fine. I
finally got tired of dealing with it, so I just used ODBC.

Just out of curiosity, why do you like OLEDB better? I heard there
wasn't much difference (I'm sure I am wrong here).

Also, I am only using my sa account on my lab rat machine. I would
never use SA on my normal machines. I agree this would be trouble if I did.

Here's a simple OLEDB connection string (I can't bring myself to type
"connectionToDa tabase" when "cn" will do):

cn.open "Provider=sqlol edb;data source=<name of your server>;" & _
"initial catalog=<name of database>" & _
"user id=<some account other than sa>;password=<p assword>"

If I can't convince you that OLEDB is better: Is the DSN a system DSN? It
needs to be.

This was the problem. As soon as I changed the DSN from user to a
system DSN, it came up correctly.

But I can't get your OLEDB one to work. It says the logon is wrong.
But the ODBC doesn't have a problem and I use the same logon. Here are
the 2 files:

The ODBC file. This one works fine now.
*************** *************** *************** *************** *************

<html>
<head>
<title>ABC Corporation</title>
</head>
<body>

<h2>ABC Corporation Employee Extensions</h2>
<p>

<%
Set connectionToDat abase=Server.Cr eateObject("ADO DB.Connection")
connectionToDat abase.Connectio nTimeout = 60
connectionToDat abase.Open "DSN=Customer;u ser id=SA;password= "

connectionToDat abase.Close
Set connectionToDat abase=Nothing
%>

</body>
</html>
*************** *************** *************** *************** *************

The OLEDB file. I tried using the actual data source name as well as local

and tried it with and without the initial catalog.
*************** *************** *************** *************** *************
<html>
<head>
<title>ABC Corporation</title>
</head>
<body>

<h2>ABC Corporation Employee Extensions</h2>
<p>

<%
Set connectionToDat abase=Server.Cr eateObject("ADO DB.Connection")
connectionToDat abase.Connectio nTimeout = 60
connectionToDat abase.Open "Provider=sqlol edb;data source=(local); " & _
"initial catalog=CIS" & _
"user id=SA;password= "

connectionToDat abase.Close
Set connectionToDat abase=Nothing
%>

</body>
</html>
*************** *************** *************** *************** *************

I get the following error messag on the error page:
Error Type:
Microsoft OLE DB Provider for SQL Server (0x80040E4D)
Login failed for user 'IUSR_ALLOSAURU S'.
/connectDB.asp, line 13
I would like to find out why it won't work.

I assume that since the error is a login error, that it is getting to
the server OK (maybe an incorrect assumption, however).

Thanks,

Tom.

Bob Barrows


Jul 19 '05 #7
Thomas Scheiderich wrote:

I was only using ODBC, because there is a problem I have not been able
to solve on setting up UDL file. My W2K is missing something, but it
won't handle the file correctly. My other W2K machine does it fine.
I finally got tired of dealing with it, so I just used ODBC.

Just out of curiosity, why do you like OLEDB better? I heard there
wasn't much difference (I'm sure I am wrong here).
The main reason is here:
http://msdn.microsoft.com/library/en...components.asp

There is a great deal of difference: There are two libraries involved when
using ODBC: the OLEDB library (which is the only library that ADO can use to
communicate with databases), and the ODBC library. When you use the OLEDB
provider for your database, the only library involved is the OLEDB library,
which means there is one less layer of software between your application and
the database, leading to more robustness and efficiency.
Also, I am only using my sa account on my lab rat machine. I would
never use SA on my normal machines. I agree this would be trouble if
I did.

Here's a simple OLEDB connection string (I can't bring myself to type
"connectionToDa tabase" when "cn" will do):

cn.open "Provider=sqlol edb;data source=<name of your server>;" & _
"initial catalog=<name of database>" & _
"user id=<some account other than sa>;password=<p assword>"

If I can't convince you that OLEDB is better: Is the DSN a system
DSN? It needs to be.
The OLEDB file. I tried using the actual data source name as well as
local

and tried it with and without the initial catalog.
<snip of all the html - why did we need to see that?>
<%
Set connectionToDat abase=Server.Cr eateObject("ADO DB.Connection")
connectionToDat abase.Connectio nTimeout = 60
connectionToDat abase.Open "Provider=sqlol edb;data source=(local); " & _
"initial catalog=CIS" & _
"user id=SA;password= "


The problem here is the lack of a semicolon after "CIS".

I'm hoping you simply censored the password (it's helpful if you use the
string "<censored> ", or even "XXXX" instead of leaving it blank. That way we
don';t have to wonder if you've made a mistake.). If you haven't assigned a
password to the sa account, you are asking for trouble: many viruses, (Code
Red comes to mind) were able to work because sa accounts were not assigned
passwords.
Error Type:
Microsoft OLE DB Provider for SQL Server (0x80040E4D)
Login failed for user 'IUSR_ALLOSAURU S'.
/connectDB.asp, line 13


As for your error message, I am very puzzled. Without the semicolon, I got a
different error: Invalid authorization specification

With the semicolon, it works fine:

dim cn
set cn=createobject ("adodb.connect ion")
cn.open "Provider=sqlol edb;data source=(local); " & _
"initial catalog=pubs;" & _
"user id=sa;password= <censored>"

if cn.state=1 then
Response.Write "Connection opened"
else
Response.Write "Connection not opened"
end if
on error resume next
cn.close:set cn=nothing

Without the password, I get a login failed for user 'sa'. Are you sure
you're showing us the connection string that produced that error? The only
way I can get your error is if I change it to:

cn.open "Provider=sqlol edb;data source=(local); " & _
"initial catalog=pubs;" & _
"Integrated Security=SSPI"

I expect to get this error because no account has been created in SQL Server
for the Internet Guest Account (IUSR_machinena me). It is not recommended
that you use integrated security from asp. If you have the recommended
configuration where IIS and SQL Server are on different machines, a domain
account has to be used to connect to the server. It can be difficult to
manage security this way. Go back to the first method (just include the
semicolon I inadvertantly left out of my example)

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
15539
by: StephenRichter | last post by:
I have installed the trial of db2 enterprise server on my w2k PC. Have also installed fix pack 8 of that product. I am using it to connect from an asp.net web page to an IBM as400. the 400 is at v5r1. >From the db2 command line shell I am able to connect to the as400 database. The error I am getting is:
22
3275
by: Kristof Thys | last post by:
Hello, I'm developing a C# - windows forms application. To get some information for my application, I'm connecting to an URL, wich gives me XML generated using php. With 90% of the users, this code just works fine: WebRequest request = WebRequest.Create(URL);
0
2287
by: vicky | last post by:
Hello Experts, Trying to run sample Postgrel's ECPG(Embedded SQL)programs on RHL 9.0. Im unable to connect to PostgreSQL database (sirishadb) when I run the program .... # su postgres (enter)
4
6451
by: newladder | last post by:
Hi all, Iam struck with one of the problem with postgres. Please help me out.... Iam trying to connect to connect to postgres database on remote machine with the IP address 10.2.1.4. Iam unable to get connected. below is my script. <?php $connection_string = 'DRIVER={PostgreSQL};SERVER=10.2.1.4:5432;DATABASE=Admin';
23
4273
cyberking
by: cyberking | last post by:
Hi. I have just started learning PHP along with MySQL. I am trying to connect to the MySQL DB server but unable to. I have been tryin. Please help. Its urgent cos I shall soon have to work on PHP . My testing program is as follows : <?php $si = function_exists('mysqli_connect');
1
3164
by: ynyus75 | last post by:
Hey! I am unable to connect some of the services that I host from my laptop at home, such as SMTP and MySQL on port numbers 25 and 3306 respectively. But I am able to some services such as Telnet, Remote Desk Connection, SSH. Here are my details ISP: Time Warner Connection Type: Cable Router: Lynksys Port Farwarding: enabled port farwarding to HTTP, Telnet, HTTPS, Remote Desktop Connection, SSH, MySQL etc to my laptop. Connection Type...
21
2344
by: Steve | last post by:
I moved my database from one server to another SQL server. I did a backup and restore of the database. I can connect to the database on server A from my asp.net app but when I try to connect to my database server B, I'm gettting 'login failed for user 'username' I've added the username to the database on server B, I can open up SMS and connect to the database that way, but I can't connect from my asp.net web app. any suggestions on what...
1
2413
by: Markw | last post by:
Hi folks I think I've got a variable problem but not 100% sure. Background: I took the CMS example from chapter 6 in "Build your Own Database Driven Website Using PHP&MySQL" and have attempted to modify it for use in my own database. It almost works for me LOL. contact.php returns my dive buddies first and last name and gives me the option to either Edit or Delete them. Currently the delete option is not active. When I choose to edit...
3
6271
by: Harmony504 | last post by:
HELP! Setup: PHP5.2.5, IIS 5.1, XP, AS/400 (DB/400 or DB2) I am trying to connect to a DB2 database from my computer. I installed DB2 Connect and set up the ODBC Driver in the Data Source Administrator. I uncommented the extension=php_ibm_db2.dll line in my php.ini file. <?php $DBName = "WSC520"; // The name of the database ...
3
6839
by: yawnmoth | last post by:
I'm trying to connect to an Active Directory server and am having some difficulties. Here's the code I'm using: <?php if (!($ldap = ldap_connect('domain.tld')) { exit('unable to connect'); } ldap_bind($ldap, 'username', 'password');
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10436
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10213
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10163
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9040
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6780
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.