If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Database Connection Error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-03-06, 02:08
omirzadeh omirzadeh is offline
Registered User
 
Join Date: Jan 2006
Posts: 6
Database Connection Error

Dear Sirs,
I am working on my first sql server web application. I have read many documents and I have gone to many forums, but i have'nt found any answer. Can you help me please.
Here is my problem:
I can't connect to my database. I use windows authentication and i log in as administrator. I have installed personal edition of sql server and IIS is installed in my computer. I use this scripts:

<%
dim objCon
set objCon = server.CreateObject("ADODB.Connection")
objCon.ConnectionString="DSN=dbna.dsn;uid=sa;pwd=; database=na2"
objCon.open
%>

Where dbna.dsn have been defined in "Data Sources (ODBC)" part of control panel.
When I open the webpage i receive this error:

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E4D)
[Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'ALADDIN\IUSR_ALADDIN'.
/dbconnect.asp, line 5

My computer name is ALADDIN and my username is Omid.
Best regards,
Omid.
Reply With Quote
  #2 (permalink)  
Old 02-04-06, 19:56
kropes2001 kropes2001 is offline
Registered User
 
Join Date: Nov 2005
Location: Honolulu HI
Posts: 118
so you are first setting this up on your home computer and will replicate all of the info onto your web server ?

' This is a DSN-LESS Connection. it requires the Driver Info and server.
TheDatabase.Open "Driver={SQL Server}; Server=servername ; UID=USER_ID ; Password=passowrd; Database=databaseName"

' This is a DSN Connection. it does not require Driver or server. only provider and the DSN
TheDatabase.Open "PROVIDER=MSDASQL;DSN=DSN_Name; UID=USER_ID ; Password=passowrd; Database=databaseName"

i think that MSDASQL is the most recent provider name, that should not change.

then use somethnig like this to retrieve your data into a recordset.
SQL="SELECT Visitor, visitDate, visitTime FROM Visitors
Set rsData = TheDatabase.Execute(SQL)
__________________
.
.
http://www.GetMySiteOnline.com - Can you help me Get My Site Online ? (Yes. That is EXACTLY what we do.)

http://www.GetMySiteOnline.com/FightingSpam/
__________________________
caeli enarrant gloriam Dei !
Reply With Quote
  #3 (permalink)  
Old 02-05-06, 03:15
rudra rudra is offline
L O S T in Reality
 
Join Date: Nov 2005
Location: San Francisco, CA
Posts: 506
Well,
the best way to deal with this problem is ......
Firstly make your server mixed authentication ..to do it right click the server name and click properties>security>click option buttonwindows and sql server authentication> then
Open Sql server enterprise manager>
Click your database>
Under your database click user>
Rightclick user to create new database user>
give a name "XYZ" and password "XYZ" then choose your database,then role checked the db_owner role for this user if you want to give it a full previledges.(public will be checked by default)
then click ok.
Then open query analyser> put yuor username and password to check it.If its working ok then
use it using DSN LESS Connection or DSN connection.
I hope everything will work ok this time.
Joydeep
Reply With Quote
  #4 (permalink)  
Old 02-05-06, 03:32
kropes2001 kropes2001 is offline
Registered User
 
Join Date: Nov 2005
Location: Honolulu HI
Posts: 118
he said he is using personal edition of sql server
i dont think that has Sql server enterprise manager, isnt it just the dos type interface ?

he needs to make it work on his machine without doing anything special as it needs to work on the web server as well. if he make special changes on his machines and the web server is not swet up like that, then its still not going to work when he uploads it.
__________________
.
.
http://www.GetMySiteOnline.com - Can you help me Get My Site Online ? (Yes. That is EXACTLY what we do.)

http://www.GetMySiteOnline.com/FightingSpam/
__________________________
caeli enarrant gloriam Dei !
Reply With Quote
  #5 (permalink)  
Old 02-05-06, 07:41
rudra rudra is offline
L O S T in Reality
 
Join Date: Nov 2005
Location: San Francisco, CA
Posts: 506
Oh yes Kropes2001, I missed out that info.
Well,I just made my comment regarding the error he got.Its a common error and it happens due to login problem.I just suggested that thing which helped me a lot in my cases.
By the way,its not good to use personal edition of sql server for a real time project.Isn't it?
Joydeep
Reply With Quote
  #6 (permalink)  
Old 02-05-06, 10:56
kropes2001 kropes2001 is offline
Registered User
 
Join Date: Nov 2005
Location: Honolulu HI
Posts: 118
using personal edition on your own machine for testing purposes is cool, but not for a live app on the internet. i think person edition has a connection limitation of like 5 or 10 simultaneous connections... but i cant remember off hand.
__________________
.
.
http://www.GetMySiteOnline.com - Can you help me Get My Site Online ? (Yes. That is EXACTLY what we do.)

http://www.GetMySiteOnline.com/FightingSpam/
__________________________
caeli enarrant gloriam Dei !
Reply With Quote
  #7 (permalink)  
Old 02-05-06, 13:39
omirzadeh omirzadeh is offline
Registered User
 
Join Date: Jan 2006
Posts: 6
Thanks alot

Thanks alot. I changed my authentication mode to mixed. Now i can connect to my database but I can't understand why i can't use windows authentication.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On