SlideShare a Scribd company logo
04 - Perl Programming
Database
156
Danairat T.
Line ID: Danairat
FB: Danairat Thanabodithammachari
+668-1559-1446
Danairat T.
Perl at the client Side
Perl and Database
• Perl uses the DBI (Database Interface) for DB integration
purpose. The DBI is database-independent, which means that
it can work with vendor specific DBD (Database Driver) for any
of database, such as Postgres, mySQL, Oracle, Sybase,
Informix, Access, ODBC, etc.
157
Perl Program DBI
DBD::Pg
DBD::Oracle
Postgres
Oracle
Danairat T.
Perl and Database - Topics
• Perl Modules for Database
• Prepare Database Environment (Postgres)
• Database Handler
• Database Statement
• Database Manipulation
– Select
– Add
– Update
– Delete
158
Danairat T.
Perl Modules for Database
159
• Query your existing modules using command line:-
• perl -MFile::Find=find -MFile::Spec::Functions -lwe 'find { wanted =>
sub { print canonpath $_ if /.pmz/ }, no_chdir => 1 },
• The DBI is normally located at
/usr/perl5/vendor_perl/5.8.4/i86pc-solaris-64int/
• The DBDs are normally located at
/usr/perl5/vendor_perl/5.8.4/i86pc-solaris-64int/DBD/
Danairat T.
Perl Modules for Database
160
• Install the Perl DBI:-
1. Download DBI module “DBI-1.58.tar.gz” from
www.cpan.org
2. Unzip as a directory and cd to the directory
gzip -cd DBI-1.58.tar.gz | tar xf -
3. Run standard perl module installation
i. perl Makefile.PL
ii. make
iii. make test
iv. make install
4. Finished.
Danairat T.
Perl Modules for Database
161
• Install the Perl DBD for Postgres Database:-
1. Download DBD module “DBD-Pg-2.15.1.tar.gz” from
www.cpan.org
2. Unzip as a directory and cd to the directory
gzip -cd DBD-Pg-2.15.1.tar.gz | tar xf -
3. Run standard perl module installation
i. perl Makefile.PL
ii. make
iii. make test
iv. make install
4. Finished.
Danairat T.
Prepare Database Environment (Postgres)
162
1. Verify the system has the Postgres using pkginfo
• bash-3.00# pkginfo -i SUNWpostgr-server
• system SUNWpostgr-server The programs needed to create and run a PostgreSQL 8.1.1 7 server
• bash-3.00# pkginfo -i SUNWpostgr
• system SUNWpostgr PostgreSQL 8.1.17 client programs and libraries
• bash-3.00# pkginfo -i SUNWpostgr-libs
• system SUNWpostgr-libs The shared libraries required for any PostgreSQL 8.1.17 clients
• bash-3.00# pkginfo -i SUNWpostgr-server-data
• system SUNWpostgr-server-data The data directories needed to create and run a PostgreSQ L 8.1.8
server
• bash-3.00# pkginfo -i SUNWpostgr-contrib
• system SUNWpostgr-contrib Contributed source and binaries distributed with PostgreSQL 8.1.17
• bash-3.00# pkginfo -i SUNWpostgr-devel
• system SUNWpostgr-devel PostgreSQL 8.1.17 development header files and libraries
• bash-3.00# pkginfo -i SUNWpostgr-docs
• system SUNWpostgr-docs Extra documentation for PostgreSQL 8.1.8
Danairat T.
Prepare Database Environment (Postgres)
163
2. Create OS user for Postgres and Initialize the database:-
• #useradd -c 'PostgreSQL user' -d /export/home/postgres -m -s /bin/bash postgres
• #chown -R postgres:postgres /var/lib/pgsql
• #su - postgres
• bash-3.00$ initdb -D /var/lib/pgsql/data/mydata
• The files belonging to this database system will be owned by user "postgres".
• This user must also own the server process.
• The database cluster will be initialized with locale C.
• creating directory /var/lib/pgsql/data/mydata ... ok
• creating directory /var/lib/pgsql/data/mydata/global ... ok
• creating directory /var/lib/pgsql/data/mydata/pg_xlog ... ok
• creating directory /var/lib/pgsql/data/mydata/pg_xlog/archive_status ... ok
• creating directory /var/lib/pgsql/data/mydata/pg_clog ... ok
• creating directory /var/lib/pgsql/data/mydata/pg_subtrans ... ok
Danairat T.
Prepare Database Environment (Postgres)
164
• Create OS user for Postgres and Initialize the database (continue):-
• creating directory /var/lib/pgsql/data/mydata/pg_twophase ... ok
• creating directory /var/lib/pgsql/data/mydata/pg_multixact/members ... ok
• creating directory /var/lib/pgsql/data/mydata/pg_multixact/offsets ... ok
• creating directory /var/lib/pgsql/data/mydata/base ... ok
• creating directory /var/lib/pgsql/data/mydata/base/1 ... ok
• creating directory /var/lib/pgsql/data/mydata/pg_tblspc ... ok
• selecting default max_connections ... 100
• selecting default shared_buffers ... 1000
• creating configuration files ... ok
• creating template1 database in /var/lib/pgsql/data/mydata/base/1 ... ok
• initializing pg_authid ... ok
• enabling unlimited row size for system tables ... ok
• initializing dependencies ... ok
• creating system views ... ok
• loading pg_description ... ok
• creating conversions ... ok
• setting privileges on built-in objects ... ok
Danairat T.
Prepare Database Environment (Postgres)
165
• Create OS user for Postgres and Initialize the database (continue):-
• creating information schema ... ok
• vacuuming database template1 ... ok
• copying template1 to template0 ... ok
• copying template1 to postgres ... ok
• WARNING: enabling "trust" authentication for local connections
• You can change this by editing pg_hba.conf or using the -A option the
• next time you run initdb.
• Success. You can now start the database server using:
• postmaster -D /var/lib/pgsql/data/mydata
• or
• pg_ctl -D /var/lib/pgsql/data/mydata -l logfile start
Danairat T.
Prepare Database Environment (Postgres)
166
3. Start the Postgres database using:-
bash-3.00$ pg_ctl -D /var/lib/pgsql/data/mydata -l /tmp/postgres.log start
postmaster starting
bash-3.00$
4. See the Postgres Process ID
bash-3.00$ ps -ef |grep postgres
postgres 1281 1 0 12:02:58 pts/4 0:00 /usr/bin/postmaster -D /var/lib/pgsql/data/mydata
postgres 1283 1281 0 12:02:59 pts/4 0:00 /usr/bin/postmaster -D /var/lib/pgsql/data/mydata
postgres 1263 1134 0 11:59:13 pts/4 0:00 -bash
postgres 1327 1263 0 12:14:46 pts/4 0:00 ps -ef
postgres 1284 1281 0 12:02:59 pts/4 0:00 /usr/bin/postmaster -D /var/lib/pgsql/data/mydata
postgres 1285 1284 0 12:02:59 pts/4 0:00 /usr/bin/postmaster -D /var/lib/pgsql/data/mydata
Danairat T.
Prepare Database Environment (Postgres)
167
5. Access the database:-
-bash-3.00$ psql postgres
Welcome to psql 8.1.17, the PostgreSQL interactive terminal.
Type: copyright for distribution terms
h for help with SQL commands
? for help with psql commands
g or terminate with semicolon to execute query
q to quit
postgres=#
Postgres Command Line UI Postgres Graphical UI
Danairat T.
Prepare Database Environment (Postgres)
168
6(a). Select the database:-
postgres=# select * from megaliths;
id | name | location | description | site_type_id | mapref
----+-------------+---------------+--------------------------+--------------+------------
1 | Stonehenge | Wiltshire | "Stone Circle and Henge" | 1 | SU 123 422
2 | Avebury | Wiltshire | "Stone Circle and Henge" | 2 | SU 103 700
3 | Sunhoney | Aberdeenshire | "Recumbent Stone Circle" | 2 | NJ 716 058
4 | Lundin | Links Fife | "Four Poster" | 3 | NO 404 027
5 | Callanish I | Western Isles | "Stone Circle and Rows" | 3 | NB 213 330
(5 rows)
Postgres Command Line UI
Danairat T.
Prepare Database Environment (Postgres)
169
6(b). Select the database:-
Postgres Graphical UI
Danairat T.
Prepare Database Environment (Postgres)
170
7. Shutdown the Postgres database:-
bash-3.00$ pg_ctl -D /var/lib/pgsql/data/mydata stop
waiting for postmaster to shut down.... done
postmaster stopped
Danairat T.
Database Handler
171
• Using the DBI to connect to Postgress and return to the DB handler
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
# db name is postgres, user is postgres and password is none
if (my $dbh = DBI->connect("dbi:Pg:dbname=postgres", "postgres", "")) {
print "Connected.n";
} else {
print "Could not connect to DB $DBI::errstrn";
}
exit(0);
DBHandlerEx01.pl
Results:-
Connected.
Danairat T.
Database Statement
172
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
# Connect to the database
if (my $dbh = DBI->connect("dbi:Pg:dbname=postgres", "postgres", "")) {
# Statement from DB handler
my $sth = $dbh->prepare( "SELECT * FROM megaliths" )
or die "Can't prepare SQL statement: $DBI::errstrn";
# Execute the statement in the database
$sth->execute()
or die "Can't execute SQL statement: $DBI::errstrn";
$sth->finish()
or die "Error finish the SQL statement: $DBI::errstrn";
# Disconnect database
$dbh->disconnect()
or warn "Error disconnecting: $DBI::errstrn";
} else {
print "Could not connect to DB $DBI::errstrn";
}
exit(0);
DBSthEx01.pl
Results:-
<no displayed result>
Danairat T.
Database Manipulation
173
• Retrieve database records
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
# 1. Connect to the database
if (my $dbh = DBI->connect("dbi:Pg:dbname=postgres", "postgres", "")) {
my $sth = $dbh->prepare( "SELECT * FROM megaliths" )
or die "Can't prepare SQL statement: $DBI::errstrn";
# 2. Execute the statement in the database
$sth->execute() or die "Can't execute SQL statement: $DBI::errstrn";
# 3. Retrieve DB records
my @row;
while ( @row = $sth->fetchrow_array() ) {
my ($id, $name, $location, $desc, $siteId, $mapRef) = @row;
print "id=$id, name=$name, location=$location, mapRef=$mapRefn";
}
# 4. Finish the statement
$sth->finish() or die "Error finish the SQL statement: $DBI::errstrn";
# 5. Disconnect database
$dbh->disconnect()
or warn "Error disconnecting: $DBI::errstrn";
} else {
print "Could not connect to DB $DBI::errstrn";
}
exit(0);
DBSelectEx01.pl
Results:-
id=1, name=Stonehenge, location=Wiltshire, mapRef=SU 123 422
id=2, name=Avebury, location=Wiltshire, mapRef=SU 103 700
id=3, name=Sunhoney, location=Aberdeenshire, mapRef=NJ 716 058
id=4, name=Lundin, location=Links Fife, mapRef=NO 404 027
id=5, name=Callanish I, location=Western Isles, mapRef=NB 213 330
Danairat T.
Database Manipulation
174
• Add new records
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
my $newRecord = "6, Stone Big, The Area 51, The most biggest stone, 3, CA 8759 993";
# Connect to the database
if (my $dbh = DBI->connect("dbi:Pg:dbname=postgres", "postgres", "")) {
# Prepare the statement
my $sth = $dbh->prepare( "INSERT INTO megaliths (id, name, location, description, site_type_id,
mapref) VALUES (?,?,?,?,?,?)" )
or die "Can't prepare SQL statement: $DBI::errstrn";
# Extract the input to variable
my ($id, $name, $location, $description, $site_type_id, $mapref) = split (/,/,$newRecord);
# Execute the statement in the database
$sth->execute($id, $name, $location, $description, $site_type_id, $mapref)
or die "Can't execute SQL statement: $DBI::errstrn";
# Finish the statement
$sth->finish() or die "Error finish the SQL statement: $DBI::errstrn";
# Disconnect database
$dbh->disconnect()
or warn "Error disconnecting: $DBI::errstrn";
} else {
print "Could not connect to DB $DBI::errstrn";
}
exit(0);
DBAddEx01.pl
Results:-
<please see the db result there is one new record inserted>
Danairat T.
Database Manipulation
175
• Update records from table
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
my $newRecord = "6, Stone Biggest, The Area 51, The most biggest stone, 3, CA 8759 993";
# Connect to the database
if (my $dbh = DBI->connect("dbi:Pg:dbname=postgres", "postgres", "")) {
# Prepare the statement
my $sth = $dbh->prepare( "UPDATE megaliths SET name=? WHERE (id=?)" )
or die "Can't prepare SQL statement: $DBI::errstrn";
# Extract the input to variable
my ($id, $name, @others) = split (/,/,$newRecord);
# Execute the statement in the database
$sth->execute($name, $id)
or die "Can't execute SQL statement: $DBI::errstrn";
# Finish the statement
$sth->finish() or die "Error finish the SQL statement: $DBI::errstrn";
# Disconnect database
$dbh->disconnect()
or warn "Error disconnecting: $DBI::errstrn";
} else {
print "Could not connect to DB $DBI::errstrn";
}
exit(0);
DBUpdateEx01.pl
Results:-
<please see the db result >
Danairat T.
Database Manipulation
176
• Delete records from table
#!/usr/bin/perl
use strict;
use warnings;
use DBI;
my $newRecord = "6, Stone Biggest, The Area 51, The most biggest stone, 3, CA 8759 993";
# Connect to the database
if (my $dbh = DBI->connect("dbi:Pg:dbname=postgres", "postgres", "")) {
# Prepare the statement
my $sth = $dbh->prepare( "DELETE FROM megaliths WHERE (id=?)" )
or die "Can't prepare SQL statement: $DBI::errstrn";
# Extract the input to variable
my ($id, @others) = split (/,/,$newRecord);
# Execute the statement in the database
$sth->execute($id)
or die "Can't execute SQL statement: $DBI::errstrn";
# Finish the statement
$sth->finish() or die "Error finish the SQL statement: $DBI::errstrn";
# Disconnect database
$dbh->disconnect()
or warn "Error disconnecting: $DBI::errstrn";
} else {
print "Could not connect to DB $DBI::errstrn";
}
exit(0);
DBDeleteEx01.pl
Results:-
<please see the db result >
Danairat T.
Line ID: Danairat
FB: Danairat Thanabodithammachari
+668-1559-1446
Thank you

More Related Content

What's hot

HADOOP 실제 구성 사례, Multi-Node 구성
HADOOP 실제 구성 사례, Multi-Node 구성HADOOP 실제 구성 사례, Multi-Node 구성
HADOOP 실제 구성 사례, Multi-Node 구성
Young Pyo
 
Mongodb replication
Mongodb replicationMongodb replication
Mongodb replication
PoguttuezhiniVP
 
HiveServer2
HiveServer2HiveServer2
HiveServer2
Schubert Zhang
 
Advanced Sqoop
Advanced Sqoop Advanced Sqoop
Advanced Sqoop
Yogesh Kulkarni
 
A brief introduction to PostgreSQL
A brief introduction to PostgreSQLA brief introduction to PostgreSQL
A brief introduction to PostgreSQL
Vu Hung Nguyen
 
Beginning hive and_apache_pig
Beginning hive and_apache_pigBeginning hive and_apache_pig
Beginning hive and_apache_pig
Mohamed Ali Mahmoud khouder
 
Hadoop single node installation on ubuntu 14
Hadoop single node installation on ubuntu 14Hadoop single node installation on ubuntu 14
Hadoop single node installation on ubuntu 14
jijukjoseph
 
PostgreSQL Administration for System Administrators
PostgreSQL Administration for System AdministratorsPostgreSQL Administration for System Administrators
PostgreSQL Administration for System Administrators
Command Prompt., Inc
 
SQL to Hive Cheat Sheet
SQL to Hive Cheat SheetSQL to Hive Cheat Sheet
SQL to Hive Cheat Sheet
Hortonworks
 
Exadata - BULK DATA LOAD Testing on Database Machine
Exadata - BULK DATA LOAD Testing on Database Machine Exadata - BULK DATA LOAD Testing on Database Machine
Exadata - BULK DATA LOAD Testing on Database Machine
Monowar Mukul
 
Percona Live 2017 ­- Sharded cluster tutorial
Percona Live 2017 ­- Sharded cluster tutorialPercona Live 2017 ­- Sharded cluster tutorial
Percona Live 2017 ­- Sharded cluster tutorial
Antonios Giannopoulos
 
Friends of Solr - Nutch & HDFS
Friends of Solr - Nutch & HDFSFriends of Solr - Nutch & HDFS
Friends of Solr - Nutch & HDFS
Saumitra Srivastav
 
Postgresql Database Administration- Day3
Postgresql Database Administration- Day3Postgresql Database Administration- Day3
Postgresql Database Administration- Day3
PoguttuezhiniVP
 
phptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorialphptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorial
Wim Godden
 
Web scraping with nutch solr
Web scraping with nutch solrWeb scraping with nutch solr
Web scraping with nutch solr
Mike Frampton
 
Hadoop HDFS Concepts
Hadoop HDFS ConceptsHadoop HDFS Concepts
Hadoop HDFS Concepts
ProTechSkills Training
 

What's hot (20)

HADOOP 실제 구성 사례, Multi-Node 구성
HADOOP 실제 구성 사례, Multi-Node 구성HADOOP 실제 구성 사례, Multi-Node 구성
HADOOP 실제 구성 사례, Multi-Node 구성
 
Mongodb replication
Mongodb replicationMongodb replication
Mongodb replication
 
HiveServer2
HiveServer2HiveServer2
HiveServer2
 
Advanced Sqoop
Advanced Sqoop Advanced Sqoop
Advanced Sqoop
 
A brief introduction to PostgreSQL
A brief introduction to PostgreSQLA brief introduction to PostgreSQL
A brief introduction to PostgreSQL
 
Beginning hive and_apache_pig
Beginning hive and_apache_pigBeginning hive and_apache_pig
Beginning hive and_apache_pig
 
SphinxSE with MySQL
SphinxSE with MySQLSphinxSE with MySQL
SphinxSE with MySQL
 
Oracle Golden Gate
Oracle Golden GateOracle Golden Gate
Oracle Golden Gate
 
Hadoop single node installation on ubuntu 14
Hadoop single node installation on ubuntu 14Hadoop single node installation on ubuntu 14
Hadoop single node installation on ubuntu 14
 
PostgreSQL Administration for System Administrators
PostgreSQL Administration for System AdministratorsPostgreSQL Administration for System Administrators
PostgreSQL Administration for System Administrators
 
SQL to Hive Cheat Sheet
SQL to Hive Cheat SheetSQL to Hive Cheat Sheet
SQL to Hive Cheat Sheet
 
Exadata - BULK DATA LOAD Testing on Database Machine
Exadata - BULK DATA LOAD Testing on Database Machine Exadata - BULK DATA LOAD Testing on Database Machine
Exadata - BULK DATA LOAD Testing on Database Machine
 
Postgre sql unleashed
Postgre sql unleashedPostgre sql unleashed
Postgre sql unleashed
 
Percona Live 2017 ­- Sharded cluster tutorial
Percona Live 2017 ­- Sharded cluster tutorialPercona Live 2017 ­- Sharded cluster tutorial
Percona Live 2017 ­- Sharded cluster tutorial
 
Friends of Solr - Nutch & HDFS
Friends of Solr - Nutch & HDFSFriends of Solr - Nutch & HDFS
Friends of Solr - Nutch & HDFS
 
Postgresql Database Administration- Day3
Postgresql Database Administration- Day3Postgresql Database Administration- Day3
Postgresql Database Administration- Day3
 
phptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorialphptek13 - Caching and tuning fun tutorial
phptek13 - Caching and tuning fun tutorial
 
Web scraping with nutch solr
Web scraping with nutch solrWeb scraping with nutch solr
Web scraping with nutch solr
 
Hadoop
HadoopHadoop
Hadoop
 
Hadoop HDFS Concepts
Hadoop HDFS ConceptsHadoop HDFS Concepts
Hadoop HDFS Concepts
 

Viewers also liked

JEE Programming - 03 Model View Controller
JEE Programming - 03 Model View ControllerJEE Programming - 03 Model View Controller
JEE Programming - 03 Model View Controller
Danairat Thanabodithammachari
 
Setting up Hadoop YARN Clustering
Setting up Hadoop YARN ClusteringSetting up Hadoop YARN Clustering
Setting up Hadoop YARN Clustering
Danairat Thanabodithammachari
 
Big data Hadoop Analytic and Data warehouse comparison guide
Big data Hadoop Analytic and Data warehouse comparison guideBig data Hadoop Analytic and Data warehouse comparison guide
Big data Hadoop Analytic and Data warehouse comparison guide
Danairat Thanabodithammachari
 
Digital Transformation, Enterprise Architecture, Big Data by Danairat
Digital Transformation, Enterprise Architecture, Big Data by DanairatDigital Transformation, Enterprise Architecture, Big Data by Danairat
Digital Transformation, Enterprise Architecture, Big Data by Danairat
Danairat Thanabodithammachari
 
Perl Programming - 02 Regular Expression
Perl Programming - 02 Regular ExpressionPerl Programming - 02 Regular Expression
Perl Programming - 02 Regular Expression
Danairat Thanabodithammachari
 
Perl Programming - 01 Basic Perl
Perl Programming - 01 Basic PerlPerl Programming - 01 Basic Perl
Perl Programming - 01 Basic Perl
Danairat Thanabodithammachari
 
The Business value of agile development
The Business value of agile developmentThe Business value of agile development
The Business value of agile developmentPhavadol Srisarnsakul
 
IBM Cognos Analytics: Empowering business by infusing intelligence across the...
IBM Cognos Analytics: Empowering business by infusing intelligence across the...IBM Cognos Analytics: Empowering business by infusing intelligence across the...
IBM Cognos Analytics: Empowering business by infusing intelligence across the...
IBM Analytics
 
JEE Programming - 02 The Containers
JEE Programming - 02 The ContainersJEE Programming - 02 The Containers
JEE Programming - 02 The Containers
Danairat Thanabodithammachari
 
JEE Programming - 05 JSP
JEE Programming - 05 JSPJEE Programming - 05 JSP
JEE Programming - 05 JSP
Danairat Thanabodithammachari
 
JEE Programming - 06 Web Application Deployment
JEE Programming - 06 Web Application DeploymentJEE Programming - 06 Web Application Deployment
JEE Programming - 06 Web Application Deployment
Danairat Thanabodithammachari
 
JEE Programming - 08 Enterprise Application Deployment
JEE Programming - 08 Enterprise Application DeploymentJEE Programming - 08 Enterprise Application Deployment
JEE Programming - 08 Enterprise Application Deployment
Danairat Thanabodithammachari
 
Glassfish JEE Server Administration - JEE Introduction
Glassfish JEE Server Administration - JEE IntroductionGlassfish JEE Server Administration - JEE Introduction
Glassfish JEE Server Administration - JEE Introduction
Danairat Thanabodithammachari
 
JEE Programming - 01 Introduction
JEE Programming - 01 IntroductionJEE Programming - 01 Introduction
JEE Programming - 01 Introduction
Danairat Thanabodithammachari
 
Glassfish JEE Server Administration - The Enterprise Server
Glassfish JEE Server Administration - The Enterprise ServerGlassfish JEE Server Administration - The Enterprise Server
Glassfish JEE Server Administration - The Enterprise Server
Danairat Thanabodithammachari
 
A Guide to IT Consulting- Business.com
A Guide to IT Consulting- Business.comA Guide to IT Consulting- Business.com
A Guide to IT Consulting- Business.com
Business.com
 

Viewers also liked (16)

JEE Programming - 03 Model View Controller
JEE Programming - 03 Model View ControllerJEE Programming - 03 Model View Controller
JEE Programming - 03 Model View Controller
 
Setting up Hadoop YARN Clustering
Setting up Hadoop YARN ClusteringSetting up Hadoop YARN Clustering
Setting up Hadoop YARN Clustering
 
Big data Hadoop Analytic and Data warehouse comparison guide
Big data Hadoop Analytic and Data warehouse comparison guideBig data Hadoop Analytic and Data warehouse comparison guide
Big data Hadoop Analytic and Data warehouse comparison guide
 
Digital Transformation, Enterprise Architecture, Big Data by Danairat
Digital Transformation, Enterprise Architecture, Big Data by DanairatDigital Transformation, Enterprise Architecture, Big Data by Danairat
Digital Transformation, Enterprise Architecture, Big Data by Danairat
 
Perl Programming - 02 Regular Expression
Perl Programming - 02 Regular ExpressionPerl Programming - 02 Regular Expression
Perl Programming - 02 Regular Expression
 
Perl Programming - 01 Basic Perl
Perl Programming - 01 Basic PerlPerl Programming - 01 Basic Perl
Perl Programming - 01 Basic Perl
 
The Business value of agile development
The Business value of agile developmentThe Business value of agile development
The Business value of agile development
 
IBM Cognos Analytics: Empowering business by infusing intelligence across the...
IBM Cognos Analytics: Empowering business by infusing intelligence across the...IBM Cognos Analytics: Empowering business by infusing intelligence across the...
IBM Cognos Analytics: Empowering business by infusing intelligence across the...
 
JEE Programming - 02 The Containers
JEE Programming - 02 The ContainersJEE Programming - 02 The Containers
JEE Programming - 02 The Containers
 
JEE Programming - 05 JSP
JEE Programming - 05 JSPJEE Programming - 05 JSP
JEE Programming - 05 JSP
 
JEE Programming - 06 Web Application Deployment
JEE Programming - 06 Web Application DeploymentJEE Programming - 06 Web Application Deployment
JEE Programming - 06 Web Application Deployment
 
JEE Programming - 08 Enterprise Application Deployment
JEE Programming - 08 Enterprise Application DeploymentJEE Programming - 08 Enterprise Application Deployment
JEE Programming - 08 Enterprise Application Deployment
 
Glassfish JEE Server Administration - JEE Introduction
Glassfish JEE Server Administration - JEE IntroductionGlassfish JEE Server Administration - JEE Introduction
Glassfish JEE Server Administration - JEE Introduction
 
JEE Programming - 01 Introduction
JEE Programming - 01 IntroductionJEE Programming - 01 Introduction
JEE Programming - 01 Introduction
 
Glassfish JEE Server Administration - The Enterprise Server
Glassfish JEE Server Administration - The Enterprise ServerGlassfish JEE Server Administration - The Enterprise Server
Glassfish JEE Server Administration - The Enterprise Server
 
A Guide to IT Consulting- Business.com
A Guide to IT Consulting- Business.comA Guide to IT Consulting- Business.com
A Guide to IT Consulting- Business.com
 

Similar to Perl Programming - 04 Programming Database

Managing Your Security Logs with Elasticsearch
Managing Your Security Logs with ElasticsearchManaging Your Security Logs with Elasticsearch
Managing Your Security Logs with Elasticsearch
Vic Hargrave
 
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
Dave Stokes
 
Postgresql Database Administration Basic - Day2
Postgresql  Database Administration Basic  - Day2Postgresql  Database Administration Basic  - Day2
Postgresql Database Administration Basic - Day2
PoguttuezhiniVP
 
Introduction to firebidSQL 3.x
Introduction to firebidSQL 3.xIntroduction to firebidSQL 3.x
Introduction to firebidSQL 3.x
Fabio Codebue
 
10 Reasons to Start Your Analytics Project with PostgreSQL
10 Reasons to Start Your Analytics Project with PostgreSQL10 Reasons to Start Your Analytics Project with PostgreSQL
10 Reasons to Start Your Analytics Project with PostgreSQL
Satoshi Nagayasu
 
Advance Mobile Application Development class 01
Advance Mobile Application Development class 01Advance Mobile Application Development class 01
Advance Mobile Application Development class 01
Dr. Mazin Mohamed alkathiri
 
Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014
Michael Renner
 
#WeSpeakLinux Session
#WeSpeakLinux Session#WeSpeakLinux Session
#WeSpeakLinux Session
Kellyn Pot'Vin-Gorman
 
TrinityCore server install guide
TrinityCore server install guideTrinityCore server install guide
TrinityCore server install guide
Seungmin Shin
 
Python Utilities for Managing MySQL Databases
Python Utilities for Managing MySQL DatabasesPython Utilities for Managing MySQL Databases
Python Utilities for Managing MySQL Databases
Mats Kindahl
 
Jdbc Java Programming
Jdbc Java ProgrammingJdbc Java Programming
Jdbc Java Programming
chhaichivon
 
20141011 mastering mysqlnd
20141011 mastering mysqlnd20141011 mastering mysqlnd
20141011 mastering mysqlnd
do_aki
 
Automating complex infrastructures with Puppet
Automating complex infrastructures with PuppetAutomating complex infrastructures with Puppet
Automating complex infrastructures with Puppet
Kris Buytaert
 
MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015
Dave Stokes
 
Using existing language skillsets to create large-scale, cloud-based analytics
Using existing language skillsets to create large-scale, cloud-based analyticsUsing existing language skillsets to create large-scale, cloud-based analytics
Using existing language skillsets to create large-scale, cloud-based analytics
Microsoft Tech Community
 
BITS: Introduction to MySQL - Introduction and Installation
BITS: Introduction to MySQL - Introduction and InstallationBITS: Introduction to MySQL - Introduction and Installation
BITS: Introduction to MySQL - Introduction and Installation
BITS
 
Get to know PostgreSQL!
Get to know PostgreSQL!Get to know PostgreSQL!
Get to know PostgreSQL!
Oddbjørn Steffensen
 
Building node.js applications with Database Jones
Building node.js applications with Database JonesBuilding node.js applications with Database Jones
Building node.js applications with Database Jones
John David Duncan
 
DjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling DisqusDjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling Disqus
zeeg
 

Similar to Perl Programming - 04 Programming Database (20)

Managing Your Security Logs with Elasticsearch
Managing Your Security Logs with ElasticsearchManaging Your Security Logs with Elasticsearch
Managing Your Security Logs with Elasticsearch
 
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
 
Postgresql Database Administration Basic - Day2
Postgresql  Database Administration Basic  - Day2Postgresql  Database Administration Basic  - Day2
Postgresql Database Administration Basic - Day2
 
Introduction to firebidSQL 3.x
Introduction to firebidSQL 3.xIntroduction to firebidSQL 3.x
Introduction to firebidSQL 3.x
 
10 Reasons to Start Your Analytics Project with PostgreSQL
10 Reasons to Start Your Analytics Project with PostgreSQL10 Reasons to Start Your Analytics Project with PostgreSQL
10 Reasons to Start Your Analytics Project with PostgreSQL
 
Advance Mobile Application Development class 01
Advance Mobile Application Development class 01Advance Mobile Application Development class 01
Advance Mobile Application Development class 01
 
Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014
 
#WeSpeakLinux Session
#WeSpeakLinux Session#WeSpeakLinux Session
#WeSpeakLinux Session
 
TrinityCore server install guide
TrinityCore server install guideTrinityCore server install guide
TrinityCore server install guide
 
Python Utilities for Managing MySQL Databases
Python Utilities for Managing MySQL DatabasesPython Utilities for Managing MySQL Databases
Python Utilities for Managing MySQL Databases
 
Jdbc Java Programming
Jdbc Java ProgrammingJdbc Java Programming
Jdbc Java Programming
 
20141011 mastering mysqlnd
20141011 mastering mysqlnd20141011 mastering mysqlnd
20141011 mastering mysqlnd
 
Automating complex infrastructures with Puppet
Automating complex infrastructures with PuppetAutomating complex infrastructures with Puppet
Automating complex infrastructures with Puppet
 
MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015MySQL Utilities -- PyTexas 2015
MySQL Utilities -- PyTexas 2015
 
Using existing language skillsets to create large-scale, cloud-based analytics
Using existing language skillsets to create large-scale, cloud-based analyticsUsing existing language skillsets to create large-scale, cloud-based analytics
Using existing language skillsets to create large-scale, cloud-based analytics
 
The Accidental DBA
The Accidental DBAThe Accidental DBA
The Accidental DBA
 
BITS: Introduction to MySQL - Introduction and Installation
BITS: Introduction to MySQL - Introduction and InstallationBITS: Introduction to MySQL - Introduction and Installation
BITS: Introduction to MySQL - Introduction and Installation
 
Get to know PostgreSQL!
Get to know PostgreSQL!Get to know PostgreSQL!
Get to know PostgreSQL!
 
Building node.js applications with Database Jones
Building node.js applications with Database JonesBuilding node.js applications with Database Jones
Building node.js applications with Database Jones
 
DjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling DisqusDjangoCon 2010 Scaling Disqus
DjangoCon 2010 Scaling Disqus
 

More from Danairat Thanabodithammachari

Thailand State Enterprise - Business Architecture and SE-AM
Thailand State Enterprise - Business Architecture and SE-AMThailand State Enterprise - Business Architecture and SE-AM
Thailand State Enterprise - Business Architecture and SE-AM
Danairat Thanabodithammachari
 
Agile Management
Agile ManagementAgile Management
Agile Organization and Enterprise Architecture v1129 Danairat
Agile Organization and Enterprise Architecture v1129 DanairatAgile Organization and Enterprise Architecture v1129 Danairat
Agile Organization and Enterprise Architecture v1129 Danairat
Danairat Thanabodithammachari
 
Blockchain for Management
Blockchain for ManagementBlockchain for Management
Blockchain for Management
Danairat Thanabodithammachari
 
Enterprise Architecture and Agile Organization Management v1076 Danairat
Enterprise Architecture and Agile Organization Management v1076 DanairatEnterprise Architecture and Agile Organization Management v1076 Danairat
Enterprise Architecture and Agile Organization Management v1076 Danairat
Danairat Thanabodithammachari
 
Agile Enterprise Architecture - Danairat
Agile Enterprise Architecture - DanairatAgile Enterprise Architecture - Danairat
Agile Enterprise Architecture - Danairat
Danairat Thanabodithammachari
 
Big data hadooop analytic and data warehouse comparison guide
Big data hadooop analytic and data warehouse comparison guideBig data hadooop analytic and data warehouse comparison guide
Big data hadooop analytic and data warehouse comparison guide
Danairat Thanabodithammachari
 
JEE Programming - 04 Java Servlets
JEE Programming - 04 Java ServletsJEE Programming - 04 Java Servlets
JEE Programming - 04 Java Servlets
Danairat Thanabodithammachari
 
JEE Programming - 07 EJB Programming
JEE Programming - 07 EJB ProgrammingJEE Programming - 07 EJB Programming
JEE Programming - 07 EJB Programming
Danairat Thanabodithammachari
 
Glassfish JEE Server Administration - Clustering
Glassfish JEE Server Administration - ClusteringGlassfish JEE Server Administration - Clustering
Glassfish JEE Server Administration - Clustering
Danairat Thanabodithammachari
 
Glassfish JEE Server Administration - Module 4 Load Balancer
Glassfish JEE Server Administration - Module 4 Load BalancerGlassfish JEE Server Administration - Module 4 Load Balancer
Glassfish JEE Server Administration - Module 4 Load Balancer
Danairat Thanabodithammachari
 
Java Programming - 07 java networking
Java Programming - 07 java networkingJava Programming - 07 java networking
Java Programming - 07 java networking
Danairat Thanabodithammachari
 
Java Programming - 08 java threading
Java Programming - 08 java threadingJava Programming - 08 java threading
Java Programming - 08 java threading
Danairat Thanabodithammachari
 
Java Programming - 06 java file io
Java Programming - 06 java file ioJava Programming - 06 java file io
Java Programming - 06 java file io
Danairat Thanabodithammachari
 
Java Programming - 05 access control in java
Java Programming - 05 access control in javaJava Programming - 05 access control in java
Java Programming - 05 access control in java
Danairat Thanabodithammachari
 

More from Danairat Thanabodithammachari (15)

Thailand State Enterprise - Business Architecture and SE-AM
Thailand State Enterprise - Business Architecture and SE-AMThailand State Enterprise - Business Architecture and SE-AM
Thailand State Enterprise - Business Architecture and SE-AM
 
Agile Management
Agile ManagementAgile Management
Agile Management
 
Agile Organization and Enterprise Architecture v1129 Danairat
Agile Organization and Enterprise Architecture v1129 DanairatAgile Organization and Enterprise Architecture v1129 Danairat
Agile Organization and Enterprise Architecture v1129 Danairat
 
Blockchain for Management
Blockchain for ManagementBlockchain for Management
Blockchain for Management
 
Enterprise Architecture and Agile Organization Management v1076 Danairat
Enterprise Architecture and Agile Organization Management v1076 DanairatEnterprise Architecture and Agile Organization Management v1076 Danairat
Enterprise Architecture and Agile Organization Management v1076 Danairat
 
Agile Enterprise Architecture - Danairat
Agile Enterprise Architecture - DanairatAgile Enterprise Architecture - Danairat
Agile Enterprise Architecture - Danairat
 
Big data hadooop analytic and data warehouse comparison guide
Big data hadooop analytic and data warehouse comparison guideBig data hadooop analytic and data warehouse comparison guide
Big data hadooop analytic and data warehouse comparison guide
 
JEE Programming - 04 Java Servlets
JEE Programming - 04 Java ServletsJEE Programming - 04 Java Servlets
JEE Programming - 04 Java Servlets
 
JEE Programming - 07 EJB Programming
JEE Programming - 07 EJB ProgrammingJEE Programming - 07 EJB Programming
JEE Programming - 07 EJB Programming
 
Glassfish JEE Server Administration - Clustering
Glassfish JEE Server Administration - ClusteringGlassfish JEE Server Administration - Clustering
Glassfish JEE Server Administration - Clustering
 
Glassfish JEE Server Administration - Module 4 Load Balancer
Glassfish JEE Server Administration - Module 4 Load BalancerGlassfish JEE Server Administration - Module 4 Load Balancer
Glassfish JEE Server Administration - Module 4 Load Balancer
 
Java Programming - 07 java networking
Java Programming - 07 java networkingJava Programming - 07 java networking
Java Programming - 07 java networking
 
Java Programming - 08 java threading
Java Programming - 08 java threadingJava Programming - 08 java threading
Java Programming - 08 java threading
 
Java Programming - 06 java file io
Java Programming - 06 java file ioJava Programming - 06 java file io
Java Programming - 06 java file io
 
Java Programming - 05 access control in java
Java Programming - 05 access control in javaJava Programming - 05 access control in java
Java Programming - 05 access control in java
 

Recently uploaded

Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
Cyanic lab
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
Tier1 app
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
Globus
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
rickgrimesss22
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
Globus
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 

Recently uploaded (20)

Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Cyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdfCyaniclab : Software Development Agency Portfolio.pdf
Cyaniclab : Software Development Agency Portfolio.pdf
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERRORTROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
TROUBLESHOOTING 9 TYPES OF OUTOFMEMORYERROR
 
Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024Globus Compute Introduction - GlobusWorld 2024
Globus Compute Introduction - GlobusWorld 2024
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptxTop Features to Include in Your Winzo Clone App for Business Growth (4).pptx
Top Features to Include in Your Winzo Clone App for Business Growth (4).pptx
 
How to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good PracticesHow to Position Your Globus Data Portal for Success Ten Good Practices
How to Position Your Globus Data Portal for Success Ten Good Practices
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 

Perl Programming - 04 Programming Database

  • 1. 04 - Perl Programming Database 156 Danairat T. Line ID: Danairat FB: Danairat Thanabodithammachari +668-1559-1446
  • 2. Danairat T. Perl at the client Side Perl and Database • Perl uses the DBI (Database Interface) for DB integration purpose. The DBI is database-independent, which means that it can work with vendor specific DBD (Database Driver) for any of database, such as Postgres, mySQL, Oracle, Sybase, Informix, Access, ODBC, etc. 157 Perl Program DBI DBD::Pg DBD::Oracle Postgres Oracle
  • 3. Danairat T. Perl and Database - Topics • Perl Modules for Database • Prepare Database Environment (Postgres) • Database Handler • Database Statement • Database Manipulation – Select – Add – Update – Delete 158
  • 4. Danairat T. Perl Modules for Database 159 • Query your existing modules using command line:- • perl -MFile::Find=find -MFile::Spec::Functions -lwe 'find { wanted => sub { print canonpath $_ if /.pmz/ }, no_chdir => 1 }, • The DBI is normally located at /usr/perl5/vendor_perl/5.8.4/i86pc-solaris-64int/ • The DBDs are normally located at /usr/perl5/vendor_perl/5.8.4/i86pc-solaris-64int/DBD/
  • 5. Danairat T. Perl Modules for Database 160 • Install the Perl DBI:- 1. Download DBI module “DBI-1.58.tar.gz” from www.cpan.org 2. Unzip as a directory and cd to the directory gzip -cd DBI-1.58.tar.gz | tar xf - 3. Run standard perl module installation i. perl Makefile.PL ii. make iii. make test iv. make install 4. Finished.
  • 6. Danairat T. Perl Modules for Database 161 • Install the Perl DBD for Postgres Database:- 1. Download DBD module “DBD-Pg-2.15.1.tar.gz” from www.cpan.org 2. Unzip as a directory and cd to the directory gzip -cd DBD-Pg-2.15.1.tar.gz | tar xf - 3. Run standard perl module installation i. perl Makefile.PL ii. make iii. make test iv. make install 4. Finished.
  • 7. Danairat T. Prepare Database Environment (Postgres) 162 1. Verify the system has the Postgres using pkginfo • bash-3.00# pkginfo -i SUNWpostgr-server • system SUNWpostgr-server The programs needed to create and run a PostgreSQL 8.1.1 7 server • bash-3.00# pkginfo -i SUNWpostgr • system SUNWpostgr PostgreSQL 8.1.17 client programs and libraries • bash-3.00# pkginfo -i SUNWpostgr-libs • system SUNWpostgr-libs The shared libraries required for any PostgreSQL 8.1.17 clients • bash-3.00# pkginfo -i SUNWpostgr-server-data • system SUNWpostgr-server-data The data directories needed to create and run a PostgreSQ L 8.1.8 server • bash-3.00# pkginfo -i SUNWpostgr-contrib • system SUNWpostgr-contrib Contributed source and binaries distributed with PostgreSQL 8.1.17 • bash-3.00# pkginfo -i SUNWpostgr-devel • system SUNWpostgr-devel PostgreSQL 8.1.17 development header files and libraries • bash-3.00# pkginfo -i SUNWpostgr-docs • system SUNWpostgr-docs Extra documentation for PostgreSQL 8.1.8
  • 8. Danairat T. Prepare Database Environment (Postgres) 163 2. Create OS user for Postgres and Initialize the database:- • #useradd -c 'PostgreSQL user' -d /export/home/postgres -m -s /bin/bash postgres • #chown -R postgres:postgres /var/lib/pgsql • #su - postgres • bash-3.00$ initdb -D /var/lib/pgsql/data/mydata • The files belonging to this database system will be owned by user "postgres". • This user must also own the server process. • The database cluster will be initialized with locale C. • creating directory /var/lib/pgsql/data/mydata ... ok • creating directory /var/lib/pgsql/data/mydata/global ... ok • creating directory /var/lib/pgsql/data/mydata/pg_xlog ... ok • creating directory /var/lib/pgsql/data/mydata/pg_xlog/archive_status ... ok • creating directory /var/lib/pgsql/data/mydata/pg_clog ... ok • creating directory /var/lib/pgsql/data/mydata/pg_subtrans ... ok
  • 9. Danairat T. Prepare Database Environment (Postgres) 164 • Create OS user for Postgres and Initialize the database (continue):- • creating directory /var/lib/pgsql/data/mydata/pg_twophase ... ok • creating directory /var/lib/pgsql/data/mydata/pg_multixact/members ... ok • creating directory /var/lib/pgsql/data/mydata/pg_multixact/offsets ... ok • creating directory /var/lib/pgsql/data/mydata/base ... ok • creating directory /var/lib/pgsql/data/mydata/base/1 ... ok • creating directory /var/lib/pgsql/data/mydata/pg_tblspc ... ok • selecting default max_connections ... 100 • selecting default shared_buffers ... 1000 • creating configuration files ... ok • creating template1 database in /var/lib/pgsql/data/mydata/base/1 ... ok • initializing pg_authid ... ok • enabling unlimited row size for system tables ... ok • initializing dependencies ... ok • creating system views ... ok • loading pg_description ... ok • creating conversions ... ok • setting privileges on built-in objects ... ok
  • 10. Danairat T. Prepare Database Environment (Postgres) 165 • Create OS user for Postgres and Initialize the database (continue):- • creating information schema ... ok • vacuuming database template1 ... ok • copying template1 to template0 ... ok • copying template1 to postgres ... ok • WARNING: enabling "trust" authentication for local connections • You can change this by editing pg_hba.conf or using the -A option the • next time you run initdb. • Success. You can now start the database server using: • postmaster -D /var/lib/pgsql/data/mydata • or • pg_ctl -D /var/lib/pgsql/data/mydata -l logfile start
  • 11. Danairat T. Prepare Database Environment (Postgres) 166 3. Start the Postgres database using:- bash-3.00$ pg_ctl -D /var/lib/pgsql/data/mydata -l /tmp/postgres.log start postmaster starting bash-3.00$ 4. See the Postgres Process ID bash-3.00$ ps -ef |grep postgres postgres 1281 1 0 12:02:58 pts/4 0:00 /usr/bin/postmaster -D /var/lib/pgsql/data/mydata postgres 1283 1281 0 12:02:59 pts/4 0:00 /usr/bin/postmaster -D /var/lib/pgsql/data/mydata postgres 1263 1134 0 11:59:13 pts/4 0:00 -bash postgres 1327 1263 0 12:14:46 pts/4 0:00 ps -ef postgres 1284 1281 0 12:02:59 pts/4 0:00 /usr/bin/postmaster -D /var/lib/pgsql/data/mydata postgres 1285 1284 0 12:02:59 pts/4 0:00 /usr/bin/postmaster -D /var/lib/pgsql/data/mydata
  • 12. Danairat T. Prepare Database Environment (Postgres) 167 5. Access the database:- -bash-3.00$ psql postgres Welcome to psql 8.1.17, the PostgreSQL interactive terminal. Type: copyright for distribution terms h for help with SQL commands ? for help with psql commands g or terminate with semicolon to execute query q to quit postgres=# Postgres Command Line UI Postgres Graphical UI
  • 13. Danairat T. Prepare Database Environment (Postgres) 168 6(a). Select the database:- postgres=# select * from megaliths; id | name | location | description | site_type_id | mapref ----+-------------+---------------+--------------------------+--------------+------------ 1 | Stonehenge | Wiltshire | "Stone Circle and Henge" | 1 | SU 123 422 2 | Avebury | Wiltshire | "Stone Circle and Henge" | 2 | SU 103 700 3 | Sunhoney | Aberdeenshire | "Recumbent Stone Circle" | 2 | NJ 716 058 4 | Lundin | Links Fife | "Four Poster" | 3 | NO 404 027 5 | Callanish I | Western Isles | "Stone Circle and Rows" | 3 | NB 213 330 (5 rows) Postgres Command Line UI
  • 14. Danairat T. Prepare Database Environment (Postgres) 169 6(b). Select the database:- Postgres Graphical UI
  • 15. Danairat T. Prepare Database Environment (Postgres) 170 7. Shutdown the Postgres database:- bash-3.00$ pg_ctl -D /var/lib/pgsql/data/mydata stop waiting for postmaster to shut down.... done postmaster stopped
  • 16. Danairat T. Database Handler 171 • Using the DBI to connect to Postgress and return to the DB handler #!/usr/bin/perl use strict; use warnings; use DBI; # db name is postgres, user is postgres and password is none if (my $dbh = DBI->connect("dbi:Pg:dbname=postgres", "postgres", "")) { print "Connected.n"; } else { print "Could not connect to DB $DBI::errstrn"; } exit(0); DBHandlerEx01.pl Results:- Connected.
  • 17. Danairat T. Database Statement 172 #!/usr/bin/perl use strict; use warnings; use DBI; # Connect to the database if (my $dbh = DBI->connect("dbi:Pg:dbname=postgres", "postgres", "")) { # Statement from DB handler my $sth = $dbh->prepare( "SELECT * FROM megaliths" ) or die "Can't prepare SQL statement: $DBI::errstrn"; # Execute the statement in the database $sth->execute() or die "Can't execute SQL statement: $DBI::errstrn"; $sth->finish() or die "Error finish the SQL statement: $DBI::errstrn"; # Disconnect database $dbh->disconnect() or warn "Error disconnecting: $DBI::errstrn"; } else { print "Could not connect to DB $DBI::errstrn"; } exit(0); DBSthEx01.pl Results:- <no displayed result>
  • 18. Danairat T. Database Manipulation 173 • Retrieve database records #!/usr/bin/perl use strict; use warnings; use DBI; # 1. Connect to the database if (my $dbh = DBI->connect("dbi:Pg:dbname=postgres", "postgres", "")) { my $sth = $dbh->prepare( "SELECT * FROM megaliths" ) or die "Can't prepare SQL statement: $DBI::errstrn"; # 2. Execute the statement in the database $sth->execute() or die "Can't execute SQL statement: $DBI::errstrn"; # 3. Retrieve DB records my @row; while ( @row = $sth->fetchrow_array() ) { my ($id, $name, $location, $desc, $siteId, $mapRef) = @row; print "id=$id, name=$name, location=$location, mapRef=$mapRefn"; } # 4. Finish the statement $sth->finish() or die "Error finish the SQL statement: $DBI::errstrn"; # 5. Disconnect database $dbh->disconnect() or warn "Error disconnecting: $DBI::errstrn"; } else { print "Could not connect to DB $DBI::errstrn"; } exit(0); DBSelectEx01.pl Results:- id=1, name=Stonehenge, location=Wiltshire, mapRef=SU 123 422 id=2, name=Avebury, location=Wiltshire, mapRef=SU 103 700 id=3, name=Sunhoney, location=Aberdeenshire, mapRef=NJ 716 058 id=4, name=Lundin, location=Links Fife, mapRef=NO 404 027 id=5, name=Callanish I, location=Western Isles, mapRef=NB 213 330
  • 19. Danairat T. Database Manipulation 174 • Add new records #!/usr/bin/perl use strict; use warnings; use DBI; my $newRecord = "6, Stone Big, The Area 51, The most biggest stone, 3, CA 8759 993"; # Connect to the database if (my $dbh = DBI->connect("dbi:Pg:dbname=postgres", "postgres", "")) { # Prepare the statement my $sth = $dbh->prepare( "INSERT INTO megaliths (id, name, location, description, site_type_id, mapref) VALUES (?,?,?,?,?,?)" ) or die "Can't prepare SQL statement: $DBI::errstrn"; # Extract the input to variable my ($id, $name, $location, $description, $site_type_id, $mapref) = split (/,/,$newRecord); # Execute the statement in the database $sth->execute($id, $name, $location, $description, $site_type_id, $mapref) or die "Can't execute SQL statement: $DBI::errstrn"; # Finish the statement $sth->finish() or die "Error finish the SQL statement: $DBI::errstrn"; # Disconnect database $dbh->disconnect() or warn "Error disconnecting: $DBI::errstrn"; } else { print "Could not connect to DB $DBI::errstrn"; } exit(0); DBAddEx01.pl Results:- <please see the db result there is one new record inserted>
  • 20. Danairat T. Database Manipulation 175 • Update records from table #!/usr/bin/perl use strict; use warnings; use DBI; my $newRecord = "6, Stone Biggest, The Area 51, The most biggest stone, 3, CA 8759 993"; # Connect to the database if (my $dbh = DBI->connect("dbi:Pg:dbname=postgres", "postgres", "")) { # Prepare the statement my $sth = $dbh->prepare( "UPDATE megaliths SET name=? WHERE (id=?)" ) or die "Can't prepare SQL statement: $DBI::errstrn"; # Extract the input to variable my ($id, $name, @others) = split (/,/,$newRecord); # Execute the statement in the database $sth->execute($name, $id) or die "Can't execute SQL statement: $DBI::errstrn"; # Finish the statement $sth->finish() or die "Error finish the SQL statement: $DBI::errstrn"; # Disconnect database $dbh->disconnect() or warn "Error disconnecting: $DBI::errstrn"; } else { print "Could not connect to DB $DBI::errstrn"; } exit(0); DBUpdateEx01.pl Results:- <please see the db result >
  • 21. Danairat T. Database Manipulation 176 • Delete records from table #!/usr/bin/perl use strict; use warnings; use DBI; my $newRecord = "6, Stone Biggest, The Area 51, The most biggest stone, 3, CA 8759 993"; # Connect to the database if (my $dbh = DBI->connect("dbi:Pg:dbname=postgres", "postgres", "")) { # Prepare the statement my $sth = $dbh->prepare( "DELETE FROM megaliths WHERE (id=?)" ) or die "Can't prepare SQL statement: $DBI::errstrn"; # Extract the input to variable my ($id, @others) = split (/,/,$newRecord); # Execute the statement in the database $sth->execute($id) or die "Can't execute SQL statement: $DBI::errstrn"; # Finish the statement $sth->finish() or die "Error finish the SQL statement: $DBI::errstrn"; # Disconnect database $dbh->disconnect() or warn "Error disconnecting: $DBI::errstrn"; } else { print "Could not connect to DB $DBI::errstrn"; } exit(0); DBDeleteEx01.pl Results:- <please see the db result >
  • 22. Danairat T. Line ID: Danairat FB: Danairat Thanabodithammachari +668-1559-1446 Thank you