[ic] Database Handle and Global Subs

Sheamus Nulty interchange-users@lists.akopia.com
Fri Jun 8 11:05:01 2001


Mark,

Did that and I'm getting the following error

Safe: Can't locate object method "TIEHASH" via package "DBI::st" at
/usr/local/lib/perl5/site_perl/5.005/sun4-solaris/DBI.pm line 683.

I'm running version 1.13 of DBI.

Read something before about using Safe ::Hole to stop this but I'm not sure
where I'm suppose to put this command and its exact syntax.

Sheamus
----- Original Message -----
From: "Mark Johnson" <markj@redhat.com>
To: <interchange-users@developer.akopia.com>
Sent: 08 June 2001 14:40
Subject: Re: [ic] Database Handle and Global Subs


> Assuming you wish to run against the same database defined for "some"
> interchange table, say 'dbi_table':
>
> my $dbh = Vend::Data::database_exists_ref('dbi_table');
> $dbh = $dbh->ref();
> $dbh = $dbh->[$Vend::Table::DBI::DBI];
>
> This will give you the database handle for the DBI database that
> contains the table 'dbi_table'. Note that the actual table you query can
> be any table in the database and not just 'dbi_table', be it an
> IC-recognized table or not.
>
> Sheamus Nulty wrote:
> >
> > I trying to run a database query in a global tag but am running into a
> > problem with getting access to the database.
> > I'm using the following code
> >
> > sub test{
> >
> > use DBI;
> >
> > my $dbh = DBI->connect("DBI:mysql:$dbname", $dbuser, $dbpasswd);
> > .....
> >
> > }
> >
> > and I get an error saying
> >
> > Can't locate object method "connect" via package "DBI" at (eval 91) line
14.
> >
> > Can anybody shed some light on why this won't work.
> >
> > Thanks
> >
> > Sheamus
> >
> > _______________________________________________
> > Interchange-users mailing list
> > Interchange-users@lists.akopia.com
> > http://lists.akopia.com/mailman/listinfo/interchange-users
>
> --
> Mark Johnson
> Senior Systems Architect - Professional Services
> Red Hat, Inc.
> E-Business Solutions
> markj@redhat.com
> 703-456-2912
> _______________________________________________
> Interchange-users mailing list
> Interchange-users@lists.akopia.com
> http://lists.akopia.com/mailman/listinfo/interchange-users
>