|
 |
asp_database_setup thread: ASP3 Ch. 12. Cannot connect to Movie2000.mdf
Message #1 by "SJMartin" <steve@s...> on Tue, 28 May 2002 14:49:02
|
|
Hello,
Please can someone advise me on connecting to the example SQL
database "Movie2000.mdf" from Chapter 12 of ASP 3 for Beginners.
When I run the example code from the book, it does NOT connect to the .mdf
database.
Here is the code I am using:
<%
Dim adOpenForwardOnly, adLockReadOnly, adCmdTable
adOpenForwardOnly = 0
adLockReadOnly = 1
adCmdTable = 2
Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
Dim strDatabaseType
'Choose one of the following two lines, and comment out the other
'strDatabaseType = "Access"
strDatabaseType = "MSDE"
'Now we use this selection to open the connection in the appropriate way
If strDatabaseType = "Access" Then
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=C:\datastores\Movie2000.mdb;" & _
"Persist Security Info=False"
Else
objConn.Open "Provider=SQLOLEDB;Persist Security Info=False;Initial
Catalog=Movie;User ID=sa;Password=steve;Initial File Name=C:\MSSQL7
\Data\Movie2000.mdf"
End If
objRS.Open "Movies", objConn, adOpenForwardOnly, adLockReadOnly, adCmdTable
etc.etc.....
When I try to connect to the MDSE database by browsing to the
page "connect.asp", the browser responds with:
Error Type:
(0x80004005)
Unspecified error
/begASP/connect.asp, line 29
Line 29 is the one that reads:
objConn.Open "Provider=SQLOLEDB;Persist Security Info=False;Initial
Catalog=Movie;User ID=sa;Password=steve;Initial File Name=C:\MSSQL7
\Data\Movie2000.mdf"
So, what is wrong with that line?!!!!!!
I have installed SQL Server Desktop Engine, as explained in the book, and
placed the database in the correct place (C:\MSSQL7\Data\Movie2000.mdf).
I am using Windows 2000 and IIS5.0. I log on to my machine with username:
sa and password: steve
In my SQL Server properties (via ControlPanel - Services) I have set up
the Log On as "this account" with username "sa" and password "steve".
I can't find this exact issue addressed by anyone in these forums.
Can someone explain what I need to do to make it work?
Many thanks,
Steve
Message #2 by "Ken Schaefer" <ken@a...> on Wed, 29 May 2002 12:55:01 +1000
|
|
Steve,
You need to *connect* to the MSDE database using a username and password
combination that exists in the database. I suggest you use the code as
provided in the book, which I think uses the "sa" username and no password
(ie a blank password)
Cheers
Ken
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "SJMartin" <steve@s...>
Subject: [asp_database_setup] ASP3 Ch. 12. Cannot connect to Movie2000.mdf
: Hello,
:
: Please can someone advise me on connecting to the example SQL
: database "Movie2000.mdf" from Chapter 12 of ASP 3 for Beginners.
:
: When I run the example code from the book, it does NOT connect to the .mdf
: database.
:
: Here is the code I am using:
:
: <%
: Dim adOpenForwardOnly, adLockReadOnly, adCmdTable
: adOpenForwardOnly = 0
: adLockReadOnly = 1
: adCmdTable = 2
:
: Dim objConn, objRS
: Set objConn = Server.CreateObject("ADODB.Connection")
: Set objRS = Server.CreateObject("ADODB.Recordset")
:
: Dim strDatabaseType
: 'Choose one of the following two lines, and comment out the other
: 'strDatabaseType = "Access"
: strDatabaseType = "MSDE"
:
: 'Now we use this selection to open the connection in the appropriate way
: If strDatabaseType = "Access" Then
: objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
: "Data Source=C:\datastores\Movie2000.mdb;" & _
: "Persist Security Info=False"
: Else
: objConn.Open "Provider=SQLOLEDB;Persist Security Info=False;Initial
: Catalog=Movie;User ID=sa;Password=steve;Initial File Name=C:\MSSQL7
: \Data\Movie2000.mdf"
:
: End If
:
: objRS.Open "Movies", objConn, adOpenForwardOnly, adLockReadOnly,
adCmdTable
:
: etc.etc.....
:
:
: When I try to connect to the MDSE database by browsing to the
: page "connect.asp", the browser responds with:
:
: Error Type:
: (0x80004005)
: Unspecified error
: /begASP/connect.asp, line 29
:
:
: Line 29 is the one that reads:
:
: objConn.Open "Provider=SQLOLEDB;Persist Security Info=False;Initial
: Catalog=Movie;User ID=sa;Password=steve;Initial File Name=C:\MSSQL7
: \Data\Movie2000.mdf"
:
:
: So, what is wrong with that line?!!!!!!
:
: I have installed SQL Server Desktop Engine, as explained in the book, and
: placed the database in the correct place (C:\MSSQL7\Data\Movie2000.mdf).
:
: I am using Windows 2000 and IIS5.0. I log on to my machine with username:
: sa and password: steve
:
: In my SQL Server properties (via ControlPanel - Services) I have set up
: the Log On as "this account" with username "sa" and password "steve".
:
: I can't find this exact issue addressed by anyone in these forums.
:
: Can someone explain what I need to do to make it work?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Message #3 by "SJMartin" <steve@s...> on Wed, 29 May 2002 09:03:45
|
|
Ken,
Thanks for your reply.
Even when I use the code *exactly* as in the book, I still get the same
error message in the browser.
Unless I've overlooked it, the book doesn't properly explain what the
username and password are for, and where you would set them up if they
need to be different. I have assumed that they are the same as the
username and password required to log on to the machine (I am working
entirely locally - no network) but I may be wrong about that. You say they
are to connect to the database itself, but where are they associated with
the database in the first place?
Please can you (or someone) explain the issues surrounding the username
and password? The footnote on page 477 says "this will only work if you
haven't already set a password for the sa account". Well, how do I know
what account this refers to and how would I change the password anyway?
Also, as I said, the exact book code doesn't work either, so can you
suggest any other possible reasons?
Has anyone else experienced this?
Thanks,
Steve
Message #4 by "Ken Schaefer" <ken@a...> on Wed, 29 May 2002 18:06:46 +1000
|
|
Hi,
Inline
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "SJMartin" <steve@s...>
Subject: [asp_database_setup] Re: ASP3 Ch. 12. Cannot connect to
Movie2000.mdf
: Even when I use the code *exactly* as in the book, I still get the same
: error message in the browser.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
OK, then you have a problem :-)
Installed the lastest MDAC? www.microsoft.com/data/ (and click on the
download link)
Do you have the latest MSDE file from Wrox? I know they posted an updated
file that contained a missing stored procedure (though I don't think that's
your problem)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: Unless I've overlooked it, the book doesn't properly explain what the
: username and password are for, and where you would set them up if they
: need to be different.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is an Microsoft SQL Server thing. MSDE is the Microsoft SQL Server
runtime engine with a few modifications (namely that there is a connection
limit, and you don't get any client tools). It is essentially something that
an application developer can embed into their application for data storage.
To manipulate an MSDE file you can either connect to it using your own
frontend (eg write something in VB, or WSH and send T-SQL commands to it),
or you need to get the SQL Server client tools. You can download a trial
version of SQL Server from www.microsoft.com/sql which includes the client
tools (which don't expire).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: I have assumed that they are the same as the
: username and password required to log on to the machine (I am working
: entirely locally - no network)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
They can be if you use Integrated Security - but I believe that the file
that they let you download is Mixed security by default.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: but I may be wrong about that. You say they
: are to connect to the database itself, but where are they associated with
: the database in the first place?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
When someone creates the MSDE file, they can create user accounts/passwords
that are stored as part of the database.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: Has anyone else experienced this?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Frankly I haven't used that code, nor do I have the book in front of me, so
I can't really comment. Sorry.
Cheers
Ken
Message #5 by "SJMartin" <steve@s...> on Wed, 29 May 2002 10:33:28
|
|
Thanks, Ken.
So, are you sayng that really this should just work, simply by using the
code supplied and placing the .mdf file in the right location, without
changing any other settings to do with the MSDE installation (i.e just
installing it and leaving all security settings etc to the default values)?
If so, then surely I can't be the only one who has seen this problem?
This is my first use of MDSE and so far a depressingly frustrating one!
|
|
 |