Subject: off topic - was database connection
Posted By: anneward Post Date: 1/22/2004 10:53:17 AM
Hi again Imar

I have a question regarding the connection file that we use in the footie project.  Everything works great on my local server, but I am having trouble working out how to edit it for Brinkster.

On their site for the 'general' [ie free] accounts, they say you should connect thus:

Set oConn = Server.CreateObject("ADODB.Connection")
sConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
              "Data Source=" & Server.MapPath("\UserName\db\dbname.mdb") & ";" & _
              "Persist Security Info=False"
oConn.Open(sConnection)
'...
oConn.Close
 


If you are not using Server.MapPath, then you can change :
Data Source=" & Server.MapPath("\UserName\db\dbname.mdb") & ";" & _

To the following:
"Data Source=\\genfs#\www##\UserName\db\dbname.mdb" & ";" & _

# = the number of your file server

## = the number of your server



I'm a bit confused as to how to incorporate your information with theirs, so that we retain everything we need to drive the events page etc, but still connect to the database in the right way for them.

the information I posted here can be found at http://www.brinkster.com/Kb/Kb.asp?kb=53890

Thanks in advance
Anne


Reply By: Imar Reply Date: 1/22/2004 11:37:51 AM
Well, IMO, Server.MapPath is the way to go. This means that even if they change the physical location of your Web site, your code will still work. I think you should do as they tell you and out the database in the DB folder and then use MapPath.

The only problem you run into is the difference between your local connection file and the remote one. They now no longer match, so you shouldn't overwrite the remote one with the local one anymore. Either skip the Connection file when putting your site, or, alternatively, put your local database in a folder called UserName\db in the root of your Web site.

If you continue with the footie project, I am sure that one day you will wonder "Now how in the world do I let my users sign up for my cool Soccer Events Site??" Well, easy, just follow this link: http://imar.spaanjaars.com/ViewContentItem.aspx?CONTENT=209&CONTENTTYPE=4&CATEGORY=10
There are a few other book related articles on my site as well.

Does this help?

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply By: anneward Reply Date: 1/23/2004 7:07:11 AM
Thanks, Imar - I am OK with using Server.MapPath here.  What I would like to know from you is how do I incorporate their code along with the code from your existing Connection file.

ie, how do I combine your code

Dim MM_connFootballSite_STRING
MM_connFootballSite_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Inetpub\wwwroot\football_site\database\TheSoccerSite.mdb;User Id=admin;Password="


with theirs

Set oConn = Server.CreateObject("ADODB.Connection")
sConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
              "Data Source=" & Server.MapPath("\UserName\db\dbname.mdb") & ";" & _
              "Persist Security Info=False"
oConn.Open(sConnection)
'...
oConn.Close


I can see that the path to the database would change to
Data Source=" & Server.MapPath("\anne2ward\db\TheSoccerSite.mdb & "

and presumably I would append your User Id=admin;Password=" to this string?

but how do I combine the rest of your code and their code to make it understandable to them?  does that make sense to you?

Also, I take your point about the changes that will work for Brinkster obviously not working for the local server.  And many thanks for the link to the tutorial on your site for allowing new users to sign up.

Thanks again
Anne

Reply By: Imar Reply Date: 1/23/2004 4:33:36 PM
Well, I think you're almost there:

Change the connection string to this:

Dim MM_connFootballSite_STRING
MM_connFootballSite_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("\UserName\db\TheSoccerSite.mdb") & ";User Id=admin;Password=;Persist Security Info=False;"

I think you'll find that all the stuff about Persist Security Info and the user account / password can easily be left out (i.e. just define the DataSource and the Provider), although I don't know how Brinkster deals with this.

At run-time, Server.MapPath will take the actual, physical, location of the file. This means the file at Brinkster will successfully point to the database at one of the Brinkster servers. During development, you'll need your own connectionstring, pointing to your own database. Like I said, you could move your database to a folder called \UserName\db\ as well, or you can define a second connection string in your connections page, and then comment out the Brinkster one at design time, and yours at run-time.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply By: anneward Reply Date: 1/26/2004 4:43:26 AM
Thanks, Imar!  You're an absolute star... it is working now, so if you want to check out the current version [complete with as usual very unbiased commentary ] it is living at http://www25.brinkster.com/anne2ward/home.asp

I really owe you and your co-authors a big thank you for the book - I'm very much looking forward to finishing off some of the 'extras' on the footie site - such as the acceptance of new registrations etc, and also to the last section of the book focusing on MediaEdge.  I really have found your football site project invaluable for guiding me through an area I desperately wanted and needed, in fact, for my future, to conquer.  

Many thanks once again
Anne


Reply By: Imar Reply Date: 1/26/2004 10:20:08 AM
Cool. It looks really great.

It was close, but I could resist the urge to add an "Imar was Here" event in your Admin section......

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply By: anneward Reply Date: 1/26/2004 10:28:49 AM
aww.. that would've been nice!


go on... you know you want to!

Reply By: Imar Reply Date: 1/26/2004 10:43:32 AM
Do you know a cat named Twuff??


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply By: anneward Reply Date: 1/26/2004 12:25:00 PM
er, yes... fairly well in fact


she appeared in an earlier version of the site as a 'typical Wednesday supporter', wearing her most dejected expression and a blue hat!


Reply By: Imar Reply Date: 1/26/2004 12:29:29 PM
Hmmm, just heard a rumour that she defaced your footie site..... ;-)

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply By: anneward Reply Date: 1/27/2004 6:33:16 AM
Imar!!  you're not in her network of michief, are you?  Have you been training her on the quiet, or is she in fact a silent co-author of the Dreamweaver book?  I always wonder what she is up to when I leave the house during the day, and now I know...  well, well, at least she has good taste in football players

But now I know about her considerable computer skills, maybe I can persuade her to put them to good use and contribute to the catfood fund?

very funny - thank you!


Reply By: Imar Reply Date: 1/27/2004 6:56:29 AM
She applied for the job as a co-author, but she was beaten by a whisker by Pipok:

http://Imar.Spaanjaars.Com/Images/Pipok.jpg

She does contribute to the catfood fund from her royalties.....


Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply By: anneward Reply Date: 1/27/2004 7:07:06 AM
oh I see... Pipok looks like a real character - but worrying, apparently another Sheffield Wednesday supporter?  Or do these cats just feel sorry for them, since they are slipping down the league like a mouse might slip down their throats?  Oh dear, I'm spending too much time with the cat - I'm starting to think like her...



Reply By: Imar Reply Date: 1/27/2004 7:09:54 AM


Couldn't find an Ajax cap....

Can't we change the subject of this thread to: "Off topic"....?

---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply By: anneward Reply Date: 1/27/2004 8:01:56 AM
Pipok has been online shopping for headgear... seems to be optimistic about Euro 2004 as well

Reply By: Imar Reply Date: 1/27/2004 8:48:35 AM
Yeah, she's really anxious about it. Running around here like crazy with her hat on, a q-tip in her mouth like a dog's bone. I don't think she can wait any longer.....

I think my next project is not a soccer site, but a Cat site.....


Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply By: anneward Reply Date: 1/27/2004 8:50:49 AM
did you check out her contribution to the site, though...?
http://www25.brinkster.com/anne2ward/events.asp



Reply By: Imar Reply Date: 1/27/2004 8:57:51 AM
Cool, I really like it....

While I was there, I noticed a little glitch in your site. The site displays the title of the first event on the page as the title (as an h2 tag) for the entire page....

"Back-On-Topic" Imar

---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply By: anneward Reply Date: 1/27/2004 9:00:12 AM
that's interesting... I have forgotten now what it is supposed to show, so will go back in the book to try to find out!

thank you!


Go to topic 9029

Return to index page 961
Return to index page 960
Return to index page 959
Return to index page 958
Return to index page 957
Return to index page 956
Return to index page 955
Return to index page 954
Return to index page 953
Return to index page 952