data_source syntax

data_source syntax

am 24.04.2007 22:33:19 von Robert

Question:

While connecting to a MSsql database, do you need to pass the uid and
pwd in the $data_source string as well as in the parameter list for
the connect call? For example, are either of these correct:

#~~~ this:

my $data_source = 'driver={SQL Server};Server=<192.168.0.149>;
database=;uid=; pwd=;';
my $username = 'testUser';
my $password = 'testPass';

$dbh = DBI->connect( $data_source, $username, $password );

#~~~ or this:

my $data_source = 'driver={SQL Server};Server=<192.168.0.149>;
database=;';
my $username = 'testUser';
my $password = 'testPass';

$dbh = DBI->connect( $data_source, $username, $password );


Thanks!
Robert

Re: data_source syntax

am 25.04.2007 01:17:07 von ron

Hi Robert

> While connecting to a MSsql database, do you need to pass the uid and
> pwd in the $data_source string as well as in the parameter list for
> the connect call? For example, are either of these correct:

Errr, what happens when you try both?

--
Ron Savage
ron@savage.net.au
http://savage.net.au/index.html

Re: data_source syntax

am 25.04.2007 18:09:19 von Robert

Well, as it turns out, I am jumping the gun. Going by some tutorials
here:

http://www.easysoft.com/developer/languages/perl/
dbd_odbc_tutorial_part_1.html

Having unixODBC installed is not enough, I also need an ODBC driver
to go with it. Running 'odbcinst -q -d' reveals I only have
[PostgreSQL] but apparently I also need something that can talk to an
MSSQL db.

I thought unixODBC came with all the necessary drivers? Can anyone
confirm this? Perhaps I need to install a different version? Thanks!

Robert


On Apr 24, 2007, at 7:17 PM, Ron Savage wrote:

> Hi Robert
>
>> While connecting to a MSsql database, do you need to pass the uid and
>> pwd in the $data_source string as well as in the parameter list for
>> the connect call? For example, are either of these correct:
>
> Errr, what happens when you try both?
>
> --
> Ron Savage
> ron@savage.net.au
> http://savage.net.au/index.html

Re: data_source syntax

am 25.04.2007 18:20:23 von Martin.Evans

Robert Denton wrote:
> Well, as it turns out, I am jumping the gun. Going by some tutorials here:
>
> http://www.easysoft.com/developer/languages/perl/dbd_odbc_tu torial_part_1.html
>
>
> Having unixODBC installed is not enough, I also need an ODBC driver to
> go with it. Running 'odbcinst -q -d' reveals I only have [PostgreSQL]
> but apparently I also need something that can talk to an MSSQL db.

true, you do need a driver.


> I thought unixODBC came with all the necessary drivers? Can anyone
> confirm this? Perhaps I need to install a different version? Thanks!

I can confirm that. unixODBC includes a postgres, an old mysql, a text
driver and a nntp driver but not a SQL Server driver which you need.
Your choices are various commercial drivers (like ours which you'll find
on the same site as the tutorial you are reading) or FreeTDS.

Martin
--
Martin J. Evans
Easysoft Limited
http://www.easysoft.com

> Robert
>
>
> On Apr 24, 2007, at 7:17 PM, Ron Savage wrote:
>
>> Hi Robert
>>
>>> While connecting to a MSsql database, do you need to pass the uid and
>>> pwd in the $data_source string as well as in the parameter list for
>>> the connect call? For example, are either of these correct:
>>
>> Errr, what happens when you try both?
>>
>> --
>> Ron Savage
>> ron@savage.net.au
>> http://savage.net.au/index.html
>
>
>

Re: data_source syntax

am 25.04.2007 18:40:16 von Robert

Okay. I looked breifly at OOB, which looks like quite good software,
but unfortunately out of our budget since I am working on a project
which has yet to prove it's usefulness. I am happy to pay for good
software but at this point I cannot justify it to my boss.

I'll take a look at FreeTDS and report back...

Robert


On Apr 25, 2007, at 12:20 PM, Martin Evans wrote:

> Robert Denton wrote:
>> Well, as it turns out, I am jumping the gun. Going by some
>> tutorials here:
>> http://www.easysoft.com/developer/languages/perl/
>> dbd_odbc_tutorial_part_1.html Having unixODBC installed is not
>> enough, I also need an ODBC driver to go with it. Running
>> 'odbcinst -q -d' reveals I only have [PostgreSQL] but apparently I
>> also need something that can talk to an MSSQL db.
>
> true, you do need a driver.
>
>
>> I thought unixODBC came with all the necessary drivers? Can
>> anyone confirm this? Perhaps I need to install a different
>> version? Thanks!
>
> I can confirm that. unixODBC includes a postgres, an old mysql, a
> text driver and a nntp driver but not a SQL Server driver which you
> need. Your choices are various commercial drivers (like ours which
> you'll find on the same site as the tutorial you are reading) or
> FreeTDS.
>
> Martin
> --
> Martin J. Evans
> Easysoft Limited
> http://www.easysoft.com
>
>> Robert
>> On Apr 24, 2007, at 7:17 PM, Ron Savage wrote:
>>> Hi Robert
>>>
>>>> While connecting to a MSsql database, do you need to pass the
>>>> uid and
>>>> pwd in the $data_source string as well as in the parameter list for
>>>> the connect call? For example, are either of these correct:
>>>
>>> Errr, what happens when you try both?
>>>
>>> --
>>> Ron Savage
>>> ron@savage.net.au
>>> http://savage.net.au/index.html

Re: data_source syntax

am 25.04.2007 21:52:59 von Robert

I have installed FreeTDS, and I have registered a tds.driver.teplate
and a tds.datasource.template with unixODBC using odbcinst -i -d -f
and odbcinst -i -s -f respectively. I was following this tutorial:

http://www.unixodbc.org/doc/FreeTDS.html

Unfortunately I am still having difficulty getting the perl script I
am working on to work correctly. I can provide a full copy of the
script if necessary, but this is the eorror I am getting:

Can't connect to data source driver={SQL
Server};Server=<192.168.0.149>;
database=;uid=; pwd=;, no database
driver specified and DBI_DSN env var not set at ./feedback.pl line 11

What am I missing?

Robert


On Apr 25, 2007, at 12:40 PM, Robert Denton wrote:

> Okay. I looked breifly at OOB, which looks like quite good
> software, but unfortunately out of our budget since I am working on
> a project which has yet to prove it's usefulness. I am happy to
> pay for good software but at this point I cannot justify it to my
> boss.
>
> I'll take a look at FreeTDS and report back...
>
> Robert
>
>
> On Apr 25, 2007, at 12:20 PM, Martin Evans wrote:
>
>> Robert Denton wrote:
>>> Well, as it turns out, I am jumping the gun. Going by some
>>> tutorials here:
>>> http://www.easysoft.com/developer/languages/perl/
>>> dbd_odbc_tutorial_part_1.html Having unixODBC installed is not
>>> enough, I also need an ODBC driver to go with it. Running
>>> 'odbcinst -q -d' reveals I only have [PostgreSQL] but apparently
>>> I also need something that can talk to an MSSQL db.
>>
>> true, you do need a driver.
>>
>>
>>> I thought unixODBC came with all the necessary drivers? Can
>>> anyone confirm this? Perhaps I need to install a different
>>> version? Thanks!
>>
>> I can confirm that. unixODBC includes a postgres, an old mysql, a
>> text driver and a nntp driver but not a SQL Server driver which
>> you need. Your choices are various commercial drivers (like ours
>> which you'll find on the same site as the tutorial you are
>> reading) or FreeTDS.
>>
>> Martin
>> --
>> Martin J. Evans
>> Easysoft Limited
>> http://www.easysoft.com
>>
>>> Robert
>>> On Apr 24, 2007, at 7:17 PM, Ron Savage wrote:
>>>> Hi Robert
>>>>
>>>>> While connecting to a MSsql database, do you need to pass the
>>>>> uid and
>>>>> pwd in the $data_source string as well as in the parameter list
>>>>> for
>>>>> the connect call? For example, are either of these correct:
>>>>
>>>> Errr, what happens when you try both?
>>>>
>>>> --
>>>> Ron Savage
>>>> ron@savage.net.au
>>>> http://savage.net.au/index.html
>
>

Re: data_source syntax

am 26.04.2007 01:23:19 von ron

Robert Denton wrote:

Hi Robert

A long time ago I captured a couple of URIs at easysoft, which might help:

http://www.easysoft.com/support/kb/kb00097.html

http://www.easysoft.com/support/kb/kb00686.html

HTH
--
Ron Savage
ron@savage.net.au
http://savage.net.au/