> -----Original Message-----
> From: Elie De Brauwer [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, July 31, 2001 9:16 AM
> To: [EMAIL PROTECTED]
> Subject: DBI question ...
>
>
> Hello,
> I have a little problem relating a program that I'm writing.
> This program
> involves getting data from mysql databases.
>
> According to some docs the code should be like
>
> use DBI;
> $dbh =
> BDI->connect('DBI:mysql:databasename:database:host','username'
> ,'pass')
> or die $DBI::errst;
>
> Now my problem is the following, in order to connect you have
> to know the
> databasename but I want it to be that the users get a list of
> possible
> databases, picks one of them and then uses that database. So
> simply putting
> a sql show database; to the screen and letting the user pick one out.
>
> BUT before connecting you already have to know the
> databasename ... how do i
> solve this ? Or can i stupidly give no databasename ?
Look at the DBI method data_sources(). Look also at the caveats for this
method in the DBI documentation. I use Oracle, at it works for that, but I
don't know if it works for MySQL. Try the following:
perl -MDBI -e 'print "$_\n" for DBI->data_sources("mysql")'
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]