PDA

View Full Version : multiple users and database connection



DoubleV
12-12-2002, 04:36 PM
ok, so this probably sounds totally stupid, but can somebody explain to me in plain terms how it all works or point me to a place i can read about it?

so we have 1 database. let's say that a database is being used for a single purpose only, so there's only 1 page containg the script to use with it.
in asp you would say
var conn = Server.CreateObject("ADODB.Connection")
in mivascript you would say
<MvOPEN NAME="db_alias_name" DATABASE="file_name.dbf" INDEXES="index_name.mvx">
those are the only 2 server-side languages i know how to do it with.
anyway, no matter which language you use, you name a database connection.
so here's a question: how is that name used and by what?
why am i asking? 'cause i am sitting here and thinking to myself: when several users ar online, running the same script, all of them will create connections with the database with the same variable name. so how does it all work? how does the server, or the database know what results to returm to each individual user when all of them had created connections with the same name?
i just have no idea how it all works, so can somebody please explain?

firepages
12-12-2002, 04:46 PM
Hi, the name is just a handle , in the same way www . domain.com is just for us humans & gets turned into an IP address for nameservers to crunch

a DB is pretty similar in that a connection is made from your script processor to the database accross a socket connection on a given port, i.e. MySQL commonly runs on port 3306.

so MySQL 'listens' for connections on this port,when the DB receives a request it runs as a separate process or thread or instance and is unaware of any other concurrent connections, in a similar way that a 1000 people can look at your site and your webserver treat each one as an individual entity.

There must be a better way of explaining it but thats the best I can come up with.

I dont know how win32 handles DataSourceNames though I assume its a similar process?

DoubleV
12-12-2002, 04:57 PM
you come to the rescue, as always.
i've been fighting some mivascript for 3 days, sol my brain is dead. their manual is usually pretty good, but as i had found out, it does not explain it all, so i made soma assumption about certain functions that were actually wrong, and could not figure the darn thing out for 3 days! i finally asked the list and bam! but you know how it is, especially when you don't know the language well. you start thinking that your syntax is wrong, then that the 'logic' of your script flow is wrong etc etc anything but not what it actually was.
so i was looking at
<MvOPEN NAME="distr_db" DATABASE="innbk.dbf" INDEXES="distr_db_state_name.mvx">
<MvFIND NAME="distr_db" VALUE="{g.state}">
and was, *confused* :confused:
uhh, my brains need a break, but it is not even lunch time on thursday.
i need a weekend to come asap. :rolleyes:

THANKS!

firepages
12-12-2002, 05:17 PM
:)

"whom Mivascript shall destroy , it must first drive mad"

go down the pub & have a Newcastle Brown ... you will feel better, have a few and you won't care !

DoubleV
12-12-2002, 05:20 PM
Originally posted by firepages
:)
"whom Mivascript shall destroy , it must first drive mad"

LMAO
you are right as always! :thumbsup:

whammy
12-17-2002, 12:36 AM
sounds like mivascript is evil... ;)