Home > ASP Development > Keep database in c:\ directory...

Keep database in c:\ directory...



Hi,

Is it possible to keep my database file (access db) in local pc (C drive)?

I have created all the page with asp, the reason is that I cannot set the server path to write on the database if it's save under server.

I am only running all this file in one pc. how can I change below statement if I want the db file save in the local c:...Tks

<%Dim DBPath, connstring, conn

DBPath = "score.mdb"

connstring = "PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=" & server.mappath(DBPath) & ";" & "Jet OLEDBatabase Password=welcome"

Set conn = Server.CreateObject("ADODB.Connection")

conn.Open connstring

%>

    
Guest


Quote:
Originally Posted by cs168
Hi,

Is it possible to keep my database file (access db) in local pc (C drive)?

I have created all the page with asp, the reason is that I cannot set the server path to write on the database if it's save under server.

I am only running all this file in one pc. how can I change below statement if I want the db file save in the local c:...Tks

<%Dim DBPath, connstring, conn

DBPath = "score.mdb"

connstring = "PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=" & server.mappath(DBPath) & ";" & "Jet OLEDBatabase Password=welcome"

Set conn = Server.CreateObject("ADODB.Connection")

conn.Open connstring

%>




It's rather simply, just set the datasource equal to the path the database is on your hard drive. See here for example: http://www.connectionstrings.com/

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by jmurrayhead
It's rather simply, just set the datasource equal to the path the database is on your hard drive. See here for example: http://www.connectionstrings.com/




Tks for the help.

So what I need to do is change it to this:-

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;Jet OLEDBatabase Password=MyDbPassword;"



my c: directory is database & file name is score.mdb is it corrrect as below?



connstring = "PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=\database\score.mdb;Jet OLEDBatabase Password=welcome"

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by cs168
Tks for the help.

So what I need to do is change it to this:-

"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\somepath\mydb.mdb;Jet OLEDBatabase Password=MyDbPassword;"



my c: directory is database & file name is score.mdb is it corrrect as below?



connstring = "PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=\database\score.mdb;Jet OLEDBatabase Password=welcome"




actually, I believe it would be like this:


Code:



DATA SOURCE=c:\database\score.mdb;'






JMH

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by jmurrayhead
actually, I believe it would be like this:


Code:



DATA SOURCE=c:\database\score.mdb;'






JMH


Yes I do change it to what you did and transfer the database to that directory, I have no problem when I call data or verify data with database, once I want to update or write data into database it give me this error:-

Microsoft JET Database Engine (0x80040E09)

Cannot update. Database or object is read-only.

/plating/Usermaintenance.asp, line 52



seem like it is the same if I save the file in server or in c drive, I still have no access to write on it. Pls help tq.

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by cs168
Yes I do change it to what you did and transfer the database to that directory, I have no problem when I call data or verify data with database, once I want to update or write data into database it give me this error:-

Microsoft JET Database Engine (0x80040E09)

Cannot update. Database or object is read-only.

/plating/Usermaintenance.asp, line 52



seem like it is the same if I save the file in server or in c drive, I still have no access to write on it. Pls help tq.




All you have to do is set permissions on the database and its containing folder to read/write. You can do this using IIS Manager. If you have access to, you can do that on your server as well.



EDIT:



Take a look at Shadow Wizard's tutorial on how to do this: Set Access Database Permissions

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by jmurrayhead
All you have to do is set permissions on the database and its containing folder to read/write. You can do this using IIS Manager. If you have access to, you can do that on your server as well.






Hi,

The problem is I have no permission to do any setting on the server, the pc that I plan to save the database do not have IIS manager install. So is there any solution for me on this? Appreciated your help.Tks

Was this answer helpful ? Yes No   
Guest


Quote:
Originally Posted by cs168
Hi,

The problem is I have no permission to do any setting on the server, the pc that I plan to save the database do not have IIS manager install. So is there any solution for me on this? Appreciated your help.Tks




How are you using your asp files then? If the asp files are on the server, then I don't know of a way you can have the database on another machine but the asp on another. When the server reads the connection string, it will "think" c:\database\score.mdb is a directory on the server. Best bet, is to get someone with access to set your permissions for you. Unfortunately, I don't know of any other way to do this.

Was this answer helpful ? Yes No   
Guest


There is a connection string for a remote access database, but AFAIK it is very buggy.

You would also have to set your PC up as a server.

Was this answer helpful ? Yes No   
Guest


you should have said in advance that you mean having the

database on remote computer, would have saved us all

some time.

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved