Re: MDB2: connect to db host with out knowing the db

From: Date: Mon, 17 Dec 2007 15:48:34 +0000
Subject: Re: MDB2: connect to db host with out knowing the db
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-28336@lists.php.net to get a copy of this message
On Dec 17, 2007 12:29 AM, Nial Muecke <nmuecke@justsys.com.au> wrote: > Hi, > > I am hoping that someone can help me? > > What i want to do is connect to a database host where I can no be sure that > there is a database and then create a new database. > > What would be good, would be if i could create a new MBD2 connection and > pass an option to it that says "if db not exist then create db" which would > then go and create the db and return the connection. > > Any help would be most appreciated, even if it to say that it cant be done. > There are a few problems with this. First of all, if the user you're conencting as doesn't exist or doesn't have rights to create the DB then you're going to have a problem. I would suggest connecting, searching for the DB, and if you can't find it create it. -- Justin Patrin

« previous php.pear.general (#28336) next »