• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 334
  • Last Modified:

DSN Less Database connection problem

I have encountered the following problem when trying to setup a connection to my websites database.

When I write the connection string out as

pDatabaseConnectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" &server.MapPath("database/comersus.mdb")&";"

It works fine, however in the future I will need to connect the database when it is being hosted on a different server.
So i tried changing the &server.MapPath part of the string to full address;

pDatabaseConnectionString = "DBQ=http://www.mywebpage.com/database/comersus.mdb; Driver={Microsoft Access Driver (*.mdb)}"

However this creates the following error message;

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Microsoft Access Driver]General error Unable to open registry key 'Temporary (volatile) Jet DSN for process 0x87c Thread 0xd20 DBC 0xa185054 Jet'.




anyone know why this is? all thats been changed is "&server.MapPath" has been exchanged for "http://www.mywebpage.com"
0
tommyboyd
Asked:
tommyboyd
  • 4
  • 2
  • 2
  • +3
1 Solution
 
str_kaniCommented:
0
 
nurbekCommented:
are you trying to connect remotely ?

if the files and database is on the same server

you can give the path same as your project

pDatabaseConnectionString = "Driver={Microsoft Access Driver (*.mdb)};DBQ=" &server.MapPath("database/comersus.mdb")&";"

0
 
tommyboydAuthor Commented:
Come on Nurbek.. read the question.

I know i can do it that way.. Im already doing it that way.. i clearly say "it works fine!"

The files and the database are currently on the same server, But in the near future they will not be.
So im trying to get it working without using "&server.mappath" for when this happens.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
peh803Commented:
Will both the web and database servers be accessible across the same network?  If so, try using this sort of syntax:

pDatabaseConnectionString = "DBQ=\\dbSVRName\e$\database\comersus.mdb; Driver={Microsoft Access Driver (*.mdb)}"

Best regards,
Phil / peh803
0
 
tommyboydAuthor Commented:
Peh803.. im not sure what you mean by accessible accross the same network

they will be on different servers..

the webpage will be on www.mypage.com
and the database will be on www.secure.com/mypage

what does the "\\dbsSVRname\e$" do?
0
 
tommyboydAuthor Commented:
Ive found out that;

pDatabaseConnectionString = "DBQ=http://www.mywebpage.com/database/comersus.mdb; Driver={Microsoft Access Driver (*.mdb)}"

will not work because the Http protocall cant handel that sort of connection.

So I need any ideas on how i can go about accessing the database remotely a different way.
0
 
peh803Commented:
My recommendation will only work if these two computers are on the same network.  If they are not, you will not be able to use my method.  

When two computers are on the same network, you can access files on one computer from the other by using the following syntax:

\\network_computer_name\drive_letter$\path_name\file_name.ext

In order for a user to be able to access files in this manner, some permissions must be configured on the remote machine.  But if they're not on the same network, all of this is a moot point.

Just curious -- any particular reason why you want the db and app server to be on remote machines?  This is very common for SQL Server databases oracle db's, and other larger enterprise scale rdbms's.  But I've never heard of this for access ...

Not suggesting that you don't do it your way -- I guess I'm just curious.

Regards,
Phil / peh803
0
 
tommyboydAuthor Commented:
the Database is to be hosted a shared secure server.

and the webpage is on the normal one.

wheather they are on the same network or not im not sure, ill have to ask my webhost.
and if they will be willing to setup that sort of permission.

0
 
davidlars99Commented:
these are minimum requirements

[Access Database]
Set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/inetpub/wwwroot/database/mydatabase.mdb"

[or SQL Server]
Set conn=Server.CreateObject("ADODB.Connection")
conn.open "Provider=sqloledb;Data Source=ip address or name;Initial Catalog=dbname;User Id=username;Password=xxxxxx"


see this page for the list of other memeber in ADODB.Connection class

http://www.w3schools.com/ado/ado_ref_connection.asp
0
 
davidlars99Commented:
> will not work because the Http protocall cant handel that sort of connection...

Set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "ftp://username:password@127.0.0.1:21/database/mydb.mdb"


protocol   login name         login pass.          server IP         default ftp port       directory           file
   ftp://     username    :     password    @    127.0.0.1    :             21             /database/      mydb.mdb
0
 
cjinsocal581Commented:
If it is not possible for the remote hosting ISP to create you a DSN, then create a webpage that response.write's the server.mappath. Then you will be able to see what the "real" path is.

Like this:
<%
response.write(Server.MapPath("mappath.asp") & "<br />")
%>

On my machine, it shows this: c:\inetpub\wwwroot\eepictures\mappath.asp

Now, just convince the server hosts to provide permissions to IUSR to the folder you want your DB in.

Anyway, that is my thoughts.
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 4
  • 2
  • 2
  • +3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now