Sitephoria Knowledge Base

Frequently Asked Questions about Sitephoria Hosting
It is currently Fri Mar 22, 2019 7:12 pm

All times are UTC - 6 hours [ DST ]




Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
PostPosted: Tue Mar 05, 2002 7:51 pm 
Offline
Site Admin

Joined: Tue Mar 05, 2002 4:22 am
Posts: 107
Connecting to a database without a DSN

We RECOMMEND that users use DSN-less connections. They are normally faster and require less system resources.

To connect to a database without using a DSN, please see the following code samples.

DSN-less Connection for MS Access:

function getRootPath()
getRootPath = left(server.mappath("\"), len(server.mappath("\")) - len("public"))
end function

mdbfile = "databases/sample.mdb" 'put .mdb files in databases folder in the root of your web site
connstr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & getRootPath() & mdbfile & ";"

DSN-less connection for Microsoft SQL Server:

connstr = "PROVIDER=SQLOLEDB;DATA SOURCE=mssql2.megasqlservers.com; DATABASE=db_domain_com; UID=dbm.domain.com; PWD=password;"


DSN-less connection for MySQL:

Driver={MySQL};Server=megasqlservers.com;DATABASE=databasename_domain_com;UID=dbm.domainname.com;PWD={putpasswordhere};


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group