Most of database stuff is done for you already with SQLite and there's a CPAN.org module for it. See module DBD::SQLite. Other methods can be found on the link to DBD from the module. On Linux use your package manager to install it, search for "dbd-sqlite". Windows can install it with PPM but I haven't used that in some time.
I also have packages "sqlite" (command line), "sqlite-doc" (docs) and "sqliteman" (GUI) installed under Linux. This is everything you need to create the database file without PERL. You can learn the syntax and play around with the DB. DB File needs RW access and the directory must be at least X (executable).
PERL access starts with...
There are lots of ways to get rows, see all the fetch methods in the DBD module. For example, you can get one row at a time in an array or in a hash, or all the rows at once in an array or array ref, etc. Variables can be bound to columns for easier access.
The table was created from command line. Here's the SQL92 statement.
SQL92 is a subset of the full standard, see documentation.
Last edited by m1xram; 01-28-2011 at 10:28 AM..
Reason: missing semicolon
Hi,
While i am trying to connect to Oracle database from Perl using DBI module,am getting the error as follows :
Can't load '/usr/local/fuseperl-modules/lib/i586-linux-thread-multi/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libwtc9.so: cannot open shared object file: No such file... (4 Replies)
Hi,
I tried to run this code but it isnt giving me any output or errors.
My aim is to retrieve the row based on the flag name(this is the primary key).
flag_test is my table
This is how i ran it:
perl read_db.pl flag1
flag1 is the criteria in where clause
--------
this is my... (2 Replies)
Dear Scripting Gods
I've never done shell scripting before and have only recently got to grips with Perl, so apologies for my naivity. I've written a perl program which takes in two files as arguments (these are text documents which take in the information I need) The perl program spits out a... (1 Reply)
hi there.
in perl, I am struggling to find a simple method of connecting to a database, determining if the result of my query is "true" and then testing against the result. I dont even really want the data that i am 'SELECT'íng. i effectively just want to check that a record exists with a UID... (2 Replies)
How to connect to SQL Server database from perl script using JDBC driver?
---------- Post updated at 05:33 PM ---------- Previous update was at 05:07 PM ----------
i have sqljdbc.jar file. by setting the class path how can i connect to the database using perl script? (2 Replies)
Hey guys i am using perl and trying to pull a list of books from a database and then populate the list in a separate TT2 file. When the list is generated there should be 39 book names. When I do the foreach statement in my tt2 below, the first statement gives me 39 Array(random number) and the... (1 Reply)
Hello;
I was trying to set up a mysql database using following script, but never went through. The code seems fine without any syntax error as I tested it:
perl -c Brapa0101-db.pl
Brapa0101-db.pl syntax OKHowever, whenever I run it, an error message was tossed out:
DBD::mysql::st execute... (7 Replies)
#!/usr/local/bin/perl
use DBI;
use File::Copy;
use Time::Local;
use Data::Dumper;
-Comments Describing what I'm doing--------------
-I'm pulling information from a database that has an ID and Name. They are separated by a space and I'm trying to load them into a multidimensional array so as... (3 Replies)
Need assistance
Below script get the output correctly
I want to convert the date format .Below is the output . Any idea ?
#!/usr/bin/perl -w
use DBI;
# Get a database handle by connecting to the database
my $db = DBI->connect(... (3 Replies)
Please tell me how to convert below program from shell script to perl. Same commands need to use in shutdown, just need program help for startup.
export ORACLE_BASE=/home/oracle1
lsnrctl start lndb1
sqlplus '/ as sysdba'
startup; (2 Replies)
Discussion started by: learnbash
2 Replies
LEARN ABOUT LINUX
dbd::sponge
DBD::Sponge(3pm) User Contributed Perl Documentation DBD::Sponge(3pm)NAME
DBD::Sponge - Create a DBI statement handle from Perl data
SYNOPSIS
my $sponge = DBI->connect("dbi:Sponge:","","",{ RaiseError => 1 });
my $sth = $sponge->prepare($statement, {
rows => $data,
NAME => $names,
%attr
}
);
DESCRIPTION
DBD::Sponge is useful for making a Perl data structure accessible through a standard DBI statement handle. This may be useful to DBD module
authors who need to transform data in this way.
METHODS
connect()
my $sponge = DBI->connect("dbi:Sponge:","","",{ RaiseError => 1 });
Here's a sample syntax for creating a database handle for the Sponge driver. No username and password are needed.
prepare()
my $sth = $sponge->prepare($statement, {
rows => $data,
NAME => $names,
%attr
}
);
o The $statement here is an arbitrary statement or name you want to provide as identity of your data. If you're using DBI::Profile it
will appear in the profile data.
Generally it's expected that you are preparing a statement handle as if a "select" statement happened.
o $data is a reference to the data you are providing, given as an array of arrays.
o $names is a reference an array of column names for the $data you are providing. The number and order should match the number and
ordering of the $data columns.
o %attr is a hash of other standard DBI attributes that you might pass to a prepare statement.
Currently only NAME, TYPE, and PRECISION are supported.
BUGS
Using this module to prepare INSERT-like statements is not currently documented.
AUTHOR AND COPYRIGHT
This module is Copyright (c) 2003 Tim Bunce
Documentation initially written by Mark Stosberg
The DBD::Sponge module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. In particular
permission is granted to Tim Bunce for distributing this as a part of the DBI.
SEE ALSO
DBI
perl v5.12.3 2007-09-26 DBD::Sponge(3pm)