Alexander Foken wrote:
On 13.05.2010 16:58, mani kandan wrote:
Hi Tim,

I wrote a small script that connect to SQL Server engine.I don't want to
give the name of the databse in the connection string.
Why not?

I want to select a db
on the fly only if it present.
When WHAT is present?

I tried $dbh->selectdb($databasename) but this
failed throwing error can't able to locate object method "selectdb" in
package dbi::db.

I think the selectdb is part of the Mysql  demo mod

haven't  used it in years but here is a quick use of it

#!/usr/bin/perl
# PERL MODULE
use Mysql;
# MYSQL CONFIG VARIABLES
$host = "localhost";
$database = "store";
$tablename = "inventory";
$user = "username";
$pw = "password";
# PERL CONNECT()
$connect = Mysql->connect($host, $database, $user, $pw);
# SELECT DB
$connect->selectdb($database);


Mysql I think is a nice wrapper for DBD::mysql but don't quote me on that;)

cheers
John Scoles

There is no such method in DBI, and as far as I know, there was never one.

The only way to specify a database is to use the connect() method of the DBI class.

Please help me on this.I work with microsoft sql server
2005.
What DBD do you use? DBD::ODBC?

Alexander



Reply via email to