07-02-2008
DBI - Change database
Hello !
I am working on a small Perl script that should connect to the MySQL server, will select all the databases one by one and do some queryes on each. I started working on it but I just saw that on the
DBI manual page there's no method for changing the working database. Am I missing something or the only way to change the database is to disconnect and reconnect using a different DSN ?
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
We ran into an issue trying to install DBI and DB2 modules for perl for AIX from the link
http://www-306.ibm.com/software/data/db2/perl/
We tried to install the DBI module using
bash# perl -MCPAN -e 'install DBI'
command. However we ended up with the following error.
Stop.
... (3 Replies)
Discussion started by: jerardfjay
3 Replies
2. Shell Programming and Scripting
how to disable the contraint type of a field (which is present in diffrent tables ) in database using a single unix script file. (4 Replies)
Discussion started by: shaksing
4 Replies
3. Programming
hi i am trying to connect to an oracle database using dbi and i get this ::
Driver has not implemented the disconnect_all method. at /opt/perl/lib/site_perl/5.8.0/sun4-solaris/DBI.pm line 575
END failed--call queue aborted.
for all i know, the script was working earlier, but has... (1 Reply)
Discussion started by: poggendroff
1 Replies
4. Programming
Hello. I am taking a Perl class in college and we've briefly covered SQL and moved on. We have a term project and we can do whatever we want. My project will rely strongly on an SQL Database so I am trying to learn as much about Perl DBI as I can to get things up and going.
I am basically... (1 Reply)
Discussion started by: Dave247
1 Replies
5. Shell Programming and Scripting
Hi,
I want to connect perl with the mysql to select and so on but the connection don't work
code
#!/usr/bin/perl
BEGIN {
# PERL MODULES WE WILL BE USING
use DBI;
$dbh = DBI->connect('DBI:mysql:C:\Program Files\MySQL\MySQL Server 5.0\data\db1','','pass') or die $DBI::errstr;}
#... (1 Reply)
Discussion started by: eng_shimaa
1 Replies
6. UNIX for Advanced & Expert Users
i've been struggling with installing the Perl DBI & DBD modules all weekend, and I'm getting close, but no cigar as of yet. When I run the perl script db.pl I get the following mismatch error:
Mon Apr 19 09:43:29 EDT 2010
/Library/Perl/DBD-mysql-4.011 ->
peterv@MBP17.local<515>$: db.pl | tee... (0 Replies)
Discussion started by: peterv6
0 Replies
7. Shell Programming and Scripting
Hi there, I have a bit of code similar to below (which ive actually got from perldoc, but mine is similar enough)
$sth = $dbh->prepare(q{ SELECT region, sales FROM sales_by_region });
$sth->execute;
my ($region, $sales);
# Bind Perl variables to columns:
$rv =... (4 Replies)
Discussion started by: hcclnoodles
4 Replies
8. Shell Programming and Scripting
Hi All,
I installed DBI module in a non INC location and using it in my script via "use lib".
But it throw the below error at the "use DBI" step.
Please help
Usage: DBI::_install_method(dbi_class, meth_name, file, attribs=Nullsv) at /xx/xxx/xxxxx/xxxxx/oracle/lib/DBI.pm/oracle/lib/DBI.pm line... (2 Replies)
Discussion started by: prasperl
2 Replies
9. Red Hat
my os details as follow
bash-3.2$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.8 (Tikanga)
I run the following and encounter the following error
bash-3.2$ mysqlhotcopy -?
Can't locate DBI.pm in @INC (@INC contains:... (5 Replies)
Discussion started by: jediwannabe
5 Replies
LEARN ABOUT DEBIAN
jifty::dbi::filter::yaml
Jifty::DBI::Filter::YAML(3pm) User Contributed Perl Documentation Jifty::DBI::Filter::YAML(3pm)
NAME
Jifty::DBI::Filter::YAML - This filter stores arbitrary Perl via YAML
SYNOPSIS
use Jifty::DBI::Record schema {
column my_data =>
type is 'text',
filters are qw/ Jifty::DBI::Filter::YAML /;
};
my $thing = __PACKAGE__->new;
$thing->create( my_data => { foo => 'bar', baz => [ 1, 2, 3 ] } );
my $my_data = $thing->my_data;
while (my ($key, $value) = %$my_data) {
# do something...
}
DESCRIPTION
This filter provides the ability to store arbitrary data structures into a database column using YAML. This is very similar to the
Jifty::DBI::Filter::Storable filter except that the YAML format remains human-readable in the database. You can store virtually any Perl
data, scalar, hash, array, or object into the database using this filter.
In addition, YAML (at least the storage of scalars, hashes, and arrays) is compatible with data structures written in other languages, so
you may store or read data between applications written in different languages.
METHODS
encode
This method is used to encode the Perl data structure into YAML formatted text.
decode
This method is used to decode the YAML formatted text from the database into the Perl data structure.
IMPLEMENTATION
This class will attempt to use YAML::Syck if it is available and then fall back upon YAML. This has been done because the Syck library is
written in C and is considerably faster.
SEE ALSO
Jifty::DBI::Filter, YAML, YAML::Syck
AUTHOR
Andrew Sterling Hanenkamp <hanenkamp@cpan.org>
LICENSE
This program is free software and may be modified or distributed under the same terms as Perl itself.
perl v5.14.2 2010-09-21 Jifty::DBI::Filter::YAML(3pm)