Web Wiz - Solar Powered Eco Web Hosting

  New Posts New Posts RSS Feed - Connetcing to database
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Connetcing to database

 Post Reply Post Reply
Author
pieterv View Drop Down
Newbie
Newbie


Joined: 28 April 2004
Location: Netherlands
Status: Offline
Points: 30
Post Options Post Options   Thanks (0) Thanks(0)   Quote pieterv Quote  Post ReplyReply Direct Link To This Post Topic: Connetcing to database
    Posted: 10 October 2004 at 8:51am

I'm having trouble to integrate Site News into my website. I cannot connect to my database as I would like. I'm using a virtual path to my database. (d:\www\websitename\database\news.mdb). WebWizNews uses a connection with server.MapPath, but i'm not familiar with that. Can anyone tell me how I can connect to my database using a virtual path.

-----------------------------------

'Create database connection

'Create a connection odject
Set adoCon = Server.CreateObject("ADODB.Connection")
   
'------------- If you are having problems with the script then try using a diffrent driver or DSN by editing the lines below --------------
   
'Database connection info and driver
strCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("news.mdb")

'Database driver info for Brinkster
'strCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("/USERNAME/db/news.mdb") 'This one is for Brinkster users place your Brinster username where you see USERNAME

'Alternative drivers faster than the basic one above
'strCon = "Provider=Microsoft.Jet.OLEDB.3.51; Data Source=" & Server.MapPath("news.mdb") 'This one is if you convert the database to Access 97
'strCon = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath("news.mdb")  'This one is for Access 2000/2002

'If you wish to use DSN then comment out the driver above and uncomment the line below (DSN is slower than the above drivers)
'strCon = "DSN = DSN_NAME" 'Place the DSN where you see DSN_NAME

---------------------------

Or can anyone tell me how I use Server.Mappath to connect to my database who is outside my webroot. (The webserver uses a database folder and a www folder)

thanks a lot.....

Back to Top
dj air View Drop Down
Senior Member
Senior Member
Avatar

Joined: 05 April 2002
Location: United Kingdom
Status: Offline
Points: 3627
Post Options Post Options   Thanks (0) Thanks(0)   Quote dj air Quote  Post ReplyReply Direct Link To This Post Posted: 12 October 2004 at 10:01am
change the red section above for this

'Database connection info and driver
strCon = "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=
d:\www\websitename\database\news.mdb"

that should fix your problem.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.07
Copyright ©2001-2024 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Policy

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2024 Web Wiz Ltd. All rights reserved.