ado and xml?

J

js

Hi, I have some questions about replace with mdb file with xml file:
Can I use ado and xml to store info instead of Ms access database, what
will be the diff?
can ado and xml support mult-user
Concurrent access? Thansk...
 
B

Bob Barrows [MVP]

js said:
Hi, I have some questions about replace with mdb file with xml file:
Don't

Can I use ado

ado is not needed to use xml
and xml to store info instead of Ms access database,

Yes, but ....
what will be the diff?

No referential integrity. No SQL language. No data constraints. xml is
simply a text file.
can ado and xml support mult-user
Concurrent access? Thansk...

No. You will wind up having to reinvent the wheel with your own code. it's
not worth it.

Bob Barrows
 
J

js

Thanks Bob,
No. You will wind up having to reinvent the wheel with your own code. it's
not worth it.
I only have three fields(Email, Password, IP), I think it will simply to use
text file instead of a database. ado can use discount recordset to bind to a
extenal file, but I'm worry about the concurrent access problem? what happen
when more than 10 user access at the same time? Please help...
 
J

js

is it this method only limit to 10+ users accessing this at the same exact
time? or not limit?
 
D

dlbjr

Limit is not a problem.

For safety reasons just wrap any code reading, writing the data in
Application.Lock and Application.Unlock This will guarantee one operation at
a time.
 
B

Bob Barrows [MVP]

dlbjr said:
Limit is not a problem.

For safety reasons just wrap any code reading, writing the data in
Application.Lock and Application.Unlock This will guarantee one
operation at a time.

You forgot that he had to spcify keeping the xml file in Application,
something that is not recommended for ado objects ....
 
J

js

You forgot that he had to spcify keeping the xml file in Application,
something that is not recommended for ado objects ....
Can you explain why the xml file is not recommended for ado objects? Thanks.
 
J

js

Limit is not a problem.

For safety reasons just wrap any code reading, writing the data in
Application.Lock and Application.Unlock This will guarantee one operation
at a time.
What happen when someone is access the file and lock, and another is trying
to access it? Will line up? Thanks for the help...
 
B

Bob Barrows [MVP]

js said:
Can you explain why the xml file is not recommended for ado objects?
Thanks.

Not the xml object. As long as you use the slow free-threaded version of the
xml document, you'll be all right. it';s the ADO object I'm talking about.
ADO by default is not free-threaded, and therefore should not be kept int
session or application.

http://www.aspfaq.com/show.asp?id=2053
 
B

Bob Barrows [MVP]

js said:
in message
What happen when someone is access the file and lock, and another is
trying to access it? Will line up? Thanks for the help...

You will force all accesses of the object to be serialized, which will limit
scalability, You really should forget this idea, especially if your data is
related to other data. A database is designed for this.
 
D

dlbjr

The solution will work for your need.
For the picky ones, you could use a true dataset offered in asp.net.
Make calls to an aspx file to add,edit or delete data then serialize the dataset.
Everything else stays asp.

'dlbjr
'Pleading sagacious indoctrination!
 
R

Roland Hall

in message
: js wrote:
: > Hi, I have some questions about replace with mdb file with xml file:
:
: Don't
:
: > Can I use ado
:
: ado is not needed to use xml
:
: > and xml to store info instead of Ms access database,
:
: Yes, but ....
:
: > what will be the diff?
:
: No referential integrity. No SQL language. No data constraints. xml is
: simply a text file.
:
: > can ado and xml support mult-user
: > Concurrent access? Thansk...
:
: No. You will wind up having to reinvent the wheel with your own code. it's
: not worth it.

Not sure what you're saying here Bob. Are you saying using an XML file on
the net with multiple users is a bad idea?

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 
B

Bob Barrows [MVP]

Roland said:
in message


Not sure what you're saying here Bob. Are you saying using an XML
file on the net with multiple users is a bad idea?

I'm not sure if this is a facetious question or not, but I'll answer it as
if it is a straight question, given that I may have over-made my point. :)

So, "Are you saying using an XML file on the net with multiple users is a
bad idea?"

A. Not necessarily.

I'm saying that replacing a database, which provides the builtin
functionality to support multiple users and protect the integrity of the
data it contains, with a text file, xml or csv, may not be a good idea. It
forces the developer to reinvent the wheel, writing all the code to provide
the same functionality that was provided by the database. Consider the years
it has taken the developers of Jet to get to the point they are at now, as
well as all the mistakes that were made and corrected along the way.
Providing that functionality is not an easy task. Not impossible, but
definitely daunting.

However:
Using a read-only (or update-rarely) text file (or xml document stored in
application or session) to cache frequently used, relatively static data is
a very good idea. In a perfect world, the data would still come from a
database, but with truly static data, that is not necessary.

Bob Barrows
 
R

Roland Hall

in message
: Roland Hall wrote:
: > "Bob Barrows [MVP]" wrote in message
: > : >> js wrote:
: >>> Hi, I have some questions about replace with mdb file with xml file:
: >>
: >> Don't
: >>
: >>> Can I use ado
: >>
: >> ado is not needed to use xml
: >>
: >>> and xml to store info instead of Ms access database,
: >>
: >> Yes, but ....
: >>
: >>> what will be the diff?
: >>
: >> No referential integrity. No SQL language. No data constraints. xml
: >> is simply a text file.
: >>
: >>> can ado and xml support mult-user
: >>> Concurrent access? Thansk...
: >>
: >> No. You will wind up having to reinvent the wheel with your own
: >> code. it's not worth it.
: >
: > Not sure what you're saying here Bob. Are you saying using an XML
: > file on the net with multiple users is a bad idea?
:
: I'm not sure if this is a facetious question or not, but I'll answer it as
: if it is a straight question, given that I may have over-made my point.
:)

I know I kid around a lot but it was a straight question.

: So, "Are you saying using an XML file on the net with multiple users is a
: bad idea?"
:
: A. Not necessarily.
:
: I'm saying that replacing a database, which provides the builtin
: functionality to support multiple users and protect the integrity of the
: data it contains, with a text file, xml or csv, may not be a good idea. It
: forces the developer to reinvent the wheel, writing all the code to
provide
: the same functionality that was provided by the database. Consider the
years
: it has taken the developers of Jet to get to the point they are at now, as
: well as all the mistakes that were made and corrected along the way.
: Providing that functionality is not an easy task. Not impossible, but
: definitely daunting.
:
: However:
: Using a read-only (or update-rarely) text file (or xml document stored in
: application or session) to cache frequently used, relatively static data
is
: a very good idea. In a perfect world, the data would still come from a
: database, but with truly static data, that is not necessary.

So, if a read-only XML file is shared and RW XML files are separate for each
user, that's not an issue? I'm asking because I'm doing that in lieu of
using an Access database and getting good results. I will however be
offering multiple database versions but for now, just XML.

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 
D

dlbjr

js,

Once the data is loaded into the recordset you can filter, sort, add, edit, delete the data just as
in SQL.
Where are you storing data in a session or application Variable?
If needed the xml can be Serialized into a string for storing in an application variable.

Take a look at the following code. This is used to store XML in a session or application Variable
and load and unload into a recordset when needed. This can be on an include asp file if needed.

I would store the xml file on the harddrive myself.

<SCRIPT language="vbscript" runat="server">
Class RSXML
Private mrecordset
Private mxmldom

Private Sub Class_Initialize()
Set mxmldom = CreateObject("MSXML2.DOMDocument")
Set mrecordset = CreateObject("ADODB.Recordset")
End Sub

Private Sub Class_Terminate()
Set mxmldom = Nothing
Set mrecordset = Nothing
End Sub

Public Function Serialize(recordset)
On Error Resume Next
recordset.Save mxmldom, 1
Serialize = mxmldom.xml
End Function

Public Function Deserialize(strXML)
On Error Resume Next
mxmldom.loadXML strXML
mrecordset.Open mxmldom
Set Deserialize = mrecordset
End Function
End Class
</SCRIPT>


'dlbjr
'Pleading sagacious indoctrination!
 
B

Bob Barrows [MVP]

Roland said:
So, if a read-only XML file is shared and RW XML files are separate
for each user, that's not an issue?

Correct. I see nothing wrong with that. In fact, I use similar strategy in a
few of my apps.

Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top