On Fri, Oct 14, 2011 at 5:26 PM, ZhangJun <gb2...@gmail.com> wrote: > > in the pod: > > #################### > Class Methods > connect > use DBI; > > $dsn = "DBI:mysql:$database"; > $dsn = "DBI:mysql:database=$database;host=$hostname"; > $dsn = > "DBI:mysql:database=$database;host=$hostname;port=$port"; > > $dbh = DBI->connect($dsn, $user, $password); > > A "database" must always be specified. > > ################### > > why database is needed ? > the mysqlclient can connect to server without this, and then select > database. > > You need to connect to a database before issuing any database commands. The mysql client just makes that easier to do interactively. In Perl you could just create a different object for each database if you need to connect to more than one. Why is this a problem?
-- Check out my LEGO blog at http://www.brickpile.com/ View my photos at http://flickr.com/photos/billward/ Follow me at http://twitter.com/williamward