Re: How to use perl dbi to create a database

[email protected] (Owen)
Newsgroups perl.dbi.users
Organization Ubuntu-9.04
Message-ID <20100629154326.57f584e3@owen-desktop>
On Mon, 28 Jun 2010 04:51:45 -0400
"Sharma, Sumit" <[email protected]> wrote:

> Hello,
> 
>  
> 
> I am trying to use Perl to identify if a given database exists or not
> and if it doesn't create the database and then connect to it.
> 
>  
> 
> Is there any way using Perl DBI to first identify whether a given
> database exists or not if it doesn't create the database?


Well I am not sure what you are trying to do, but lets say your
database has the name "my_data.db"


Check that my_data.db exists

   if (-e my_data.db){connect} else {connect and create}

See how you go from there



Owen
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.