Irishboy24 has asked for the wisdom of the Perl Monks concerning the following question:
Hi monks, I am trying to connect to a SQL Server 2008 local db on my computer. i've written a small perl script using the DBI module. I am running Activate State Perl v5.8.8. Here is the code. Note that my server name is "MADDY" and no pw to connect. Note that i also installed the DBI module recently using ppm.
use DBI; $dsn = "MADDY"; $user = "Maddy17"; $pw = ""; $dbh = DBI->connect('$dsn,$user,$pw'); $sth = $dbh->prepare ("select * from sysobjects where name = ' +pub_titles' and type = 'P' and uid = USER_ID()"); $sth->execute(); while ( @row = $sth->fetchrow_aray ) { print "@row\n"; } $dbh->disconnect();
The error it throws at command line is as follows: "Can't connect to data source '$dsn,$user,$pw' because I can't work out what driver to use (it doesnt seem to contain a 'dbi:driver:' prefix and the DBI_DRIVER env var is not set) at data.pl line9"
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: DBI Module Question
by toolic (Bishop) on Sep 29, 2009 at 14:25 UTC | |
|
Re: DBI Module Question
by marto (Cardinal) on Sep 29, 2009 at 14:35 UTC | |
|
Re: DBI Module Question
by Fletch (Bishop) on Sep 29, 2009 at 14:26 UTC | |
|
Re: DBI Module Question
by Tux (Canon) on Sep 29, 2009 at 14:36 UTC | |
by saberworks (Curate) on Sep 29, 2009 at 15:54 UTC | |
by Tux (Canon) on Sep 30, 2009 at 08:06 UTC | |
|
Re: DBI Module Question
by runrig (Abbot) on Sep 29, 2009 at 15:00 UTC | |
|
Re: DBI Module Question
by Irishboy24 (Sexton) on Sep 29, 2009 at 15:43 UTC | |
by runrig (Abbot) on Sep 30, 2009 at 16:10 UTC |