On 2007-04-25 17:24:40 -0400, Robert Denton wrote:
> Can't connect to data source driver={SQL Server};Server=<192.168.0.149>;
> database=<userFeedback>;uid=<testUser>; pwd=<testPass>;, no database driver
> specified and DBI_DSN env var not set at ./feedback.pl line 11
[...]
>
> $dbh = DBI->connect( $data_source, $username, $password );
>
> And my $data_source var is set to this:
>
> my $data_source = 'driver={SQL Server};Server=<192.168.0.149>;
> database=<userFeedback>
> ;uid=<testUser>; pwd=<testPass>;';
[...]
>
> As for the other part of the error, "no database driver specified", I am not
> sure what else I need to do to make perl aware of the FreeTDS driver. I have
> 'use DBI;' in the top of the script which is supposed to be sufficient. In
> otherword, I do not believe that I need to tell it to use DBD::ODBC.
Why do you believe that? How should DBI know that it is supposed to use
DBD::ODBC (and not DBD::Oracle, DBD::mysql, DBD::Sybase or whatever) if
you don't tell it?
From "perldoc DBI":
The $data_source value must begin with ""dbi:"driver_name":"". The
driver_name specifies the driver that will be used to make the con‐
nection. (Letter case is significant.)
So for ODBC, it must start with "dbi:ODBC:". Assuming that the data
source you specified is correct for the ODBC driver, the complete
data source would then be
'dbi:ODBC:driver={SQL
Server};Server=<192.168.0.149>;database=<userFeedback>;uid=<testUser>;pwd=<testPass>;'.
hp
--
_ | Peter J. Holzer | If I wanted to be "academically correct",
|_|_) | Sysadmin WSR | I'd be programming in Java.
| | | [EMAIL PROTECTED] | I don't, and I'm not.
__/ | http://www.hjp.at/ | -- Jesse Erlbaum on dbi-users
pgpvcvdco8IMZ.pgp
Description: PGP signature
