RE: Newbie problem connecting to MS SQL Server
- From: mvaughan@xxxxxxxxxxxx (Mark Vaughan)
- Date: Fri, 29 Apr 2005 16:27:24 -0600
Amonotod,
Yes, that helped tremendously.
Now I've moved on to the next problem.
I installed unixODBC and the tsql command worked (no errors), although
it replied with a 1> prompt and didn't seem to do anything unless I
typed 'quit', in which case it did just that.
I was able to run isql and get data from a table.
I installed freetds and it seems to work okay because I can use the isql
command with the dsn (isql gunnison user pass).
Now the problem: I'm using perl to connect to the DB (see below) and
here is the snippet of code that fails:
my $dbh = DBI->connect( "DBI:ODBC:gunnison", "user", 'pass');
Here is my debugging output just listing the available drivers and their
data sources:
1 (main::main)drivers (ARRAY(0x223058)) (7 elements)
2 (main::main)drivers[0]: |DBM|
3 (main::main)drivers[1]: |ExampleP|
4 (main::main)drivers[2]: |File|
5 (main::main)drivers[3]: |Multiplex|
6 (main::main)drivers[4]: |ODBC|
7 (main::main)drivers[5]: |Proxy|
8 (main::main)drivers[6]: |Sponge|
1 (main::main)DBM data sources: |DBI:DBM:f_dir=.|
1 (main::main)ExampleP data sources: |dbi:ExampleP:dir=.|
1 (main::main)File data sources: |DBI:File:f_dir=.|
1 (main::main)Multiplex data sources (ARRAY(0x223058)) (0
elements)
1 (main::main)ODBC data sources: |DBI:ODBC:gunnison|
1 (main::main)Proxy data sources (ARRAY(0x223058)) (0 elements)
1 (main::main)Sponge data sources (ARRAY(0x223058)) (0 elements)
I'm trying to use the ODBC data source as listed above.
I turned the trace level to 999 and got the following output:
DBI 1.48-nothread default trace level set to 0x300/7 (pid 6214)
-> DBI->connect(DBI:ODBC:gunnison, mv, ****, HASH(0x10ad58))
-> connect for DBD::ODBC::dr (DBI::dr=HASH(0x7cd510)~0x6c0214
'gunnison' 'mv' **** HASH(0x8a6d4c))
New DBI::db (for DBD::ODBC::db, parent=DBI::dr=HASH(0x6c0214), id=)
dbih_setup_handle(DBI::db=HASH(0x7e3510)=>DBI::db=HASH(0x8a6d40),
DBD::ODBC::db, 1ba7ec, Null!)
dbih_make_com(DBI::dr=HASH(0x6c0214), 758f88, DBD::ODBC::db, 224, 0)
thr#0
dbih_setup_attrib(DBI::db=HASH(0x8a6d40), Err,
DBI::dr=HASH(0x6c0214)) SCALAR(0x1c2444) (already defined)
dbih_setup_attrib(DBI::db=HASH(0x8a6d40), State,
DBI::dr=HASH(0x6c0214)) SCALAR(0x1c24a4) (already defined)
dbih_setup_attrib(DBI::db=HASH(0x8a6d40), Errstr,
DBI::dr=HASH(0x6c0214)) SCALAR(0x1c2474) (already defined)
dbih_setup_attrib(DBI::db=HASH(0x8a6d40), TraceLevel,
DBI::dr=HASH(0x6c0214)) 0 (already defined)
dbih_setup_attrib(DBI::db=HASH(0x8a6d40), FetchHashKeyName,
DBI::dr=HASH(0x6c0214)) 'NAME' (already defined)
dbih_setup_attrib(DBI::db=HASH(0x8a6d40), HandleSetErr,
DBI::dr=HASH(0x6c0214)) undef (not defined)
dbih_setup_attrib(DBI::db=HASH(0x8a6d40), HandleError,
DBI::dr=HASH(0x6c0214)) undef (not defined)
SQLDriverConnect failed:
SQLConnect 'gunnison', 'mv'
dbd_error: err_rc=-1 rc=0 s/d/e: 0/8052744/8294408
dbd_error: SQL-IM002 (native 0): [unixODBC][Driver Manager]Data source
name not found, and no default driver specified (SQL-IM002)
dbd_error: err_rc=-1 rc=0 s/d/e: 0/0/8294408
db_login/SQLConnect error -1 recorded: [unixODBC][Driver Manager]Data
source name not found, and no default driver specified (SQL-IM002)(DBD:
db_login/SQLConnect err=-1)
<- connect= undef at
/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/DBI.pm line 598
-> $DBI::errstr (&) FETCH from lasth=HASH
>> DBD::ODBC::db::errstr
<- $DBI::errstr= '[unixODBC][Driver Manager]Data source name not
found, and no default driver specified (SQL-IM002)(DBD:
db_login/SQLConnect err=-1)'
DBI connect('gunnison','mv',...) failed: [unixODBC][Driver
Manager]Data source name not found, and no default driver specified
(SQL-IM002)(DBD: db_login/SQLConnect err=-1)
DBI connect('gunnison','mv',...) failed: [unixODBC][Driver Manager]Data
source name not found, and no default driver specified (SQL-IM002)(DBD:
db_login/SQLConnect err=-1) at atlantic-loadEmployee line 23
<> DESTROY(DBI::db=HASH(0x7e3510)) ignored for outer handle (inner
DBI::db=HASH(0x8a6d40) has ref cnt 1)
-> DESTROY for DBD::ODBC::db (DBI::db=HASH(0x8a6d40)~INNER)
DESTROY for DBI::db=HASH(0x8a6d40) ignored - handle not
initialised
ERROR: -1 '[unixODBC][Driver Manager]Data source name not found,
and no default driver specified (SQL-IM002)(DBD: db_login/SQLConnect
err=-1)' (err#0)
<- DESTROY= undef
DESTROY (dbih_clearcom) (dbh 0x7e3510, com 0x7eae10, imp
DBD::ODBC::db):
FLAGS 0x100011: COMSET Warn PrintWarn
PARENT DBI::dr=HASH(0x6c0214)
KIDS 0 (0 Active)
IMP_DATA undef
dbih_clearcom 0x7e3510 (com 0x7eae10, type 2) done.
-- DBI::END
-> disconnect_all for DBD::Multiplex::dr
(DBI::dr=HASH(0x78d2b0)~0x7cd51c)
<- disconnect_all= undef at
/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/DBI.pm line 677 via
atlantic-loadEmployee line 0
-> disconnect_all in DBD::File::dr for DBD::DBM::dr
(DBI::dr=HASH(0x1bdeb4)~0x78bf8c)
<- disconnect_all= undef at
/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/DBI.pm line 677 via
atlantic-loadEmployee line 0
-> disconnect_all for DBD::File::dr
(DBI::dr=HASH(0x78d154)~0x78d2bc)
<- disconnect_all= undef at
/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/DBI.pm line 677 via
atlantic-loadEmployee line 0
-> disconnect_all for DBD::ExampleP::dr
(DBI::dr=HASH(0x78bf80)~0x78d0e8)
<- disconnect_all= (not implemented) at
/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/DBI.pm line 677 via
atlantic-loadEmployee line 0
-> disconnect_all for DBD::Sponge::dr
(DBI::dr=HASH(0x7f166c)~0x7e351c)
<- disconnect_all= (not implemented) at
/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/DBI.pm line 677 via
atlantic-loadEmployee line 0
-> disconnect_all for DBD::Proxy::dr
(DBI::dr=HASH(0x6c01e4)~0x7f160c)
<- disconnect_all= (not implemented) at
/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/DBI.pm line 677 via
atlantic-loadEmployee line 0
!! ERROR: -1 CLEARED by call to disconnect_all method
-> disconnect_all for DBD::ODBC::dr
(DBI::dr=HASH(0x7cd510)~0x6c0214)
<- disconnect_all= '' at
/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/DBI.pm line 677 via
atlantic-loadEmployee line 0
! -> DESTROY in DBD::_::common for DBD::Sponge::dr
(DBI::dr=HASH(0x7e351c)~INNER)
! <- DESTROY= undef during global destruction
DESTROY (dbih_clearcom) (drh 0x7f166c, com 0x720c40, imp global
destruction):
FLAGS 0x100215: COMSET Active Warn PrintWarn AutoCommit
PARENT undef
KIDS 0 (0 Active)
IMP_DATA undef
dbih_clearcom 0x7f166c (com 0x720c40, type 1) done.
! <> DESTROY for DBI::dr=HASH(0x7f166c) ignored (inner handle gone)
! -> DESTROY for DBD::Proxy::dr (DBI::dr=HASH(0x7f160c)~INNER)
! <- DESTROY= undef during global destruction
DESTROY (dbih_clearcom) (drh 0x6c01e4, com 0x790078, imp global
destruction):
FLAGS 0x100215: COMSET Active Warn PrintWarn AutoCommit
PARENT undef
KIDS 0 (0 Active)
IMP_DATA undef
dbih_clearcom 0x6c01e4 (com 0x790078, type 1) done.
! <> DESTROY for DBI::dr=HASH(0x6c01e4) ignored (inner handle gone)
! -> DESTROY in DBD::_::dr for DBD::ODBC::dr
(DBI::dr=HASH(0x6c0214)~INNER)
! <- DESTROY= undef during global destruction
DESTROY (dbih_clearcom) (drh 0x7cd510, com 0x758f88, imp global
destruction):
FLAGS 0x100215: COMSET Active Warn PrintWarn AutoCommit
PARENT undef
KIDS 0 (0 Active)
IMP_DATA undef
dbih_clearcom 0x7cd510 (com 0x758f88, type 1) done.
! <> DESTROY for DBI::dr=HASH(0x7cd510) ignored (inner handle gone)
! -> DESTROY for DBD::Multiplex::dr (DBI::dr=HASH(0x7cd51c)~INNER)
! <- DESTROY= undef during global destruction
DESTROY (dbih_clearcom) (drh 0x78d2b0, com 0x758bc8, imp global
destruction):
FLAGS 0x100215: COMSET Active Warn PrintWarn AutoCommit
PARENT undef
KIDS 0 (0 Active)
IMP_DATA undef
dbih_clearcom 0x78d2b0 (com 0x758bc8, type 1) done.
! <> DESTROY for DBI::dr=HASH(0x78d2b0) ignored (inner handle gone)
! -> DESTROY for DBD::ExampleP::dr (DBI::dr=HASH(0x78d0e8)~INNER)
! <- DESTROY= undef during global destruction
DESTROY (dbih_clearcom) (drh 0x78bf80, com 0x758ad8, imp global
destruction):
FLAGS 0x100215: COMSET Active Warn PrintWarn AutoCommit
PARENT undef
KIDS 0 (0 Active)
IMP_DATA ARRAY(0x78d07c)
dbih_clearcom 0x78bf80 (com 0x758ad8, type 1) done.
! -> DESTROY for DBD::File::dr (DBI::dr=HASH(0x78d2bc)~INNER)
! <- DESTROY= undef during global destruction
DESTROY (dbih_clearcom) (drh 0x78d154, com 0x758b50, imp global
destruction):
FLAGS 0x102215: COMSET Active Warn PrintWarn ShowErrorStatement
AutoCommit
PARENT undef
KIDS 0 (0 Active)
IMP_DATA undef
dbih_clearcom 0x78d154 (com 0x758b50, type 1) done.
! <> DESTROY for DBI::dr=HASH(0x78d154) ignored (inner handle gone)
! <> DESTROY for DBI::dr=HASH(0x78bf80) ignored (inner handle gone)
! <> DESTROY(DBI::dr=HASH(0x1bdeb4)) ignored for outer handle (inner
DBI::dr=HASH(0x78bf8c) has ref cnt 1)
! -> DESTROY in DBD::File::dr for DBD::DBM::dr
(DBI::dr=HASH(0x78bf8c)~INNER)
! <- DESTROY= undef during global destruction
DESTROY (dbih_clearcom) (drh 0x1bdeb4, com 0x6ca0f8, imp global
destruction):
FLAGS 0x102215: COMSET Active Warn PrintWarn ShowErrorStatement
AutoCommit
PARENT undef
KIDS 0 (0 Active)
IMP_DATA undef
dbih_clearcom 0x1bdeb4 (com 0x6ca0f8, type 1) done.
Can anyone offer any suggestions?
Thanks,
Mark
Mark Vaughan
Programmer III
Direct: +1 303 802 2426
Cell: +1 303 601 4434
Fax: +1 303 802 1420
mark.vaughan@xxxxxxxxxxxx
Evolving Systems, Inc.
9777 Mt. Pyramid Court, Suite 100, Englewood, CO USA 80112
www.evolving.com
-----Original Message-----
From: amonotod [mailto:amonotod@xxxxxxxxxxx]
Sent: Friday, April 29, 2005 6:48 AM
To: Mark Vaughan; DBI users
Subject: Re: Newbie problem connecting to MS SQL Server
> From: "Mark Vaughan" <mvaughan@xxxxxxxxxxxx>
> Date: 2005/04/28 Thu PM 01:33:05 CDT
> I am trying to connect to an MS SQL Server database, running on a
Win2k
> server, from a Solaris 5.8 system using Perl 5.6.1. I have installed
> DBI and Bundle::DBD, but I can't get a connection. I have read the
> READMEs, but am still unable to get the connection made.
I've no experience doing either of these, but I've seen it on the list
many times: You'll have to install the a Unix ODBC manager, the FreeTDS
driver, and then the DBD. Or, on the Win2k box, install and configure
DBD::Proxy...
> Thanks,
> Mark
HTH,
amonotod
--
`\|||/ amonotod@ | sun|perl|windows
(@@) charter.net | sysadmin|dba
ooO_(_)_Ooo____________________________________
_____|_____|_____|_____|_____|_____|_____|_____|
This e-mail and any attachments may be confidential and/or legally privileged. If you have received this e-mail and you are not a named addressee, please inform Evolving Systems TIS at tis@xxxxxxxxxxxx and then delete the e-mail from your system. If you are not a named addressee you must not use, disclose, distribute, copy, print or rely on this e-mail. To ensure regulatory compliance and for the protection of our clients and business, Evolving Systems may monitor and read e-mails sent to and from its servers. Although Evolving Systems routinely screens for viruses, addressees should scan this e-mail and any attachments for viruses. Evolving Systems makes no representation or warranty as to the absence of viruses in this e-mail or any attachments.
Registered Office: 9777 Mt. Pyramid Ct Suite 100, Englewood, CO 80112
.
- Prev by Date: RE: DBI install problem
- Next by Date: Re: DBD::Oracle Installation problem
- Previous by thread: Re: Newbie problem connecting to MS SQL Server
- Next by thread: last_insert_id() / MSSQL
- Index(es):
Relevant Pages
|
|