comp.lang.ada
 help / color / mirror / Atom feed
From: Brian May <bam@snoopy.apana.org.au>
Subject: Re: Ada DB bindings and APQ
Date: Wed, 15 Dec 2004 09:40:29 +1100
Date: 2004-12-15T09:40:29+11:00	[thread overview]
Message-ID: <sa48y80ec6a.fsf@snoopy.apana.org.au> (raw)
In-Reply-To: Fzwvd.2134$zV5.976@read1.cgocable.net

>>>>> "Warren" == Warren W Gay VE3WWG <ve3wwg@NoSpam.cogeco.ca> writes:

    Warren> I'm not against the "factory" idea, but i don't think it
    Warren> will prove to be very practical. The problem is that every
    Warren> database vendor has its own unique way of identifying
    Warren> users to the database. PostgreSQL is perhaps the strangest
    Warren> of them all, and they all overlap, but none of them agree
    Warren> on the required set of parameters. You can possibly make
    Warren> them agree in some situations, but this doesn't address
    Warren> existing databases well.

The solution here is to use a notation for identifying the database
that will work for all database.

I have to say I really like the PHP pear URL like syntax, copied from:

<URL:http://pear.php.net/manual/en/package.database.db.intro-dsn.php>

Example 26-1. Connect to database through a socket

mysql://user@unix(/path/to/socket)/pear

Example 26-2. Connect to database on a non standard port

pgsql://user:pass@tcp(localhost:5555)/pear

Example 26-3. Connect to SQLite on a Unix machine using options

sqlite:////full/unix/path/to/file.db?mode=0666

Example 26-4. Connect to SQLite on a Windows machine using options

sqlite:///c:/full/windows/path/to/file.db?mode=0666

Example 26-5. Connect to MySQLi using SSL

mysqli://user:pass@localhost/pear?key=client-key.pem&cert=client-cert.pem

Example 26-6. Connecting to MS Access sometimes requires admin as the user name

odbc(access)://admin@/datasourcename

Example 26-7. Connecting to ODBC with a specific cursor

odbc(access)://admin@/datasourcename?cursor=SQL_CUR_USE_ODBC

pgsql://someuser:apasswd@localhost/thedb

I think this is rather important as it would mean you don't need to
recompile the application in order to use a different database. It
also means the code doesn't have to explicitly support connecting to
every possible database that APQ supports.

Instead you just need *one* config option "database_url" that contains
the URL as per one of the above format.

If you want sample code to pass the URL, it is already written, it
just needs to be ported from PHP to Ada... Not sure how easy this will
be.
-- 
Brian May <bam@snoopy.apana.org.au>



  parent reply	other threads:[~2004-12-14 22:40 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-12 17:42 Ada DB bindings and APQ Dmitry A. Kazakov
2004-12-14  7:25 ` Warren W. Gay VE3WWG
2004-12-14 17:37   ` Dmitry A. Kazakov
2004-12-14 18:29     ` Georg Bauhaus
2004-12-14 19:45       ` Dmitry A. Kazakov
2004-12-14 21:06         ` Georg Bauhaus
2004-12-15  8:19           ` Ole-Hjalmar Kristensen
2004-12-15 17:20           ` Dmitry A. Kazakov
2004-12-16 13:28             ` Georg Bauhaus
2004-12-17 13:23               ` Dmitry A. Kazakov
2004-12-14 23:26         ` Brian May
2004-12-15 17:43           ` Dmitry A. Kazakov
2004-12-15 21:54             ` Brian May
2004-12-15  4:05     ` Warren W. Gay VE3WWG
2004-12-15 18:26       ` Dmitry A. Kazakov
2004-12-16  2:53         ` Warren W. Gay VE3WWG
2004-12-18 16:43           ` Dmitry A. Kazakov
2004-12-18 20:36             ` Warren W. Gay VE3WWG
2004-12-18 22:21               ` Dmitry A. Kazakov
2004-12-19  0:53                 ` Warren W. Gay VE3WWG
2004-12-19 12:21                   ` Dmitry A. Kazakov
2004-12-20  5:33                     ` Warren W. Gay VE3WWG
2004-12-20 20:01                       ` Dmitry A. Kazakov
2004-12-20 20:54                         ` Warren W. Gay VE3WWG
2004-12-14 22:40   ` Brian May [this message]
2004-12-15  3:23     ` Warren W. Gay VE3WWG
2004-12-15 15:01       ` Georg Bauhaus
2004-12-17  4:31         ` Brian May
2004-12-15 10:48   ` Brian May
2004-12-16  1:40     ` Brian May
2004-12-16  3:10       ` Warren W. Gay VE3WWG
2004-12-17  4:55         ` Brian May
2004-12-17 11:13           ` Warren W. Gay VE3WWG
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox