in reply to can one create a "session" of Perl & Mysql?
When I last looked DB connections could not be serialised for saving them to a file for later use. So, saving your connection for later, to a file and exiting your program will not work unless some sort of serialisation of the connection becomes possible.
Then you have the "Service" model (Re: can one create a "session" of Perl & Mysql?) or the "daemon" model, I add.
In either of these, you could use connection pooling. The first time a user appears (or re-appears after a long time interval) they give credentials and a connection is created for them waiting in the pool, possibly associated with a cookie the user saves on their side in order to get exact same connection the next time. But it means that you have to mediate all your DB queries through the service/daemon which will slow things down. But it has a benefit: you can restrict DB access to only a few formalised queries. For example: query1: it only accepts an AGE field and gets back 20 results max. query2: ... etc. So, doing it this way you will need to write 2 programs: the service/daemon and the client. Quite insecure if external access is allowed because it relies on user presenting a cookie for access to DB. But then isn't everything cookie-driven nowaday?
It is possible to connect to mysql without providing credentials by creating a profile (see mysql_config_editor, search for passwordless mysql) and pointing mysql every time you need access, to the profile data file. Can this be achieved via Perl DBI? I don't know.
You could save the credentials to a file (VERY INSECURE) to be read next time the same user requests DB access. I will not describe this any further because it's twice as wrong as it's practical.
I am just thinking out loud, bw bliako
|
|---|