NEVUG - August 2004 To Boldly Go: Using Perl and the Perl DBI as an Adjunct to MS Access for Custom Reports Maggie Rioux MBLWHOI Library Woods Hole, Mass.

Slides:



Advertisements
Similar presentations
Easily retrieve data from the Baan database
Advertisements

Connecting to Databases. relational databases tables and relations accessed using SQL database -specific functionality –transaction processing commit.
Programming MySQL, Perl COEN 351. Reading List Paul DuBois: MySQL and Perl for the Web, New Riders, 2002 Jacqueline D. Hamilton: CGI Programming 101,
Delicious Data: Automated Techniques for Complex Reports Presented by Jeff Godin and Benjamin Shum.
Murali Mani SQL-PL Interface. Murali Mani Some Possible Options Web Interface Perl /CGI with Oracle/mySQL Install your own web server and use servlets.
W EB A PPLICATION D EVELOPMENT A PPLICATION T O B IO -I NFORMATICS -III Vicky Khanna M-Tech Bioinformatics.
Library Online Catalog Tutorial Pentagon Library Last Updated March 2008.
Table design screen Field name Data type Field size Other properties.
VOYAGER REQUEST FORMS REVIEW. Login Blocks & Request Errors.
VOYAGER REQUEST FORMS REVIEW. Login Blocks & Request Errors.
Voyager Interest Group Voyager Access Reports: what they are and how they work October 29, 2008.
River Campus Libraries Creating Usable User Interfaces (with Voyager, Encompass, and SFX) David Lindahl, Digital Initiatives Manager
Table design screen Field name Data type Field size Other properties.
Perl DBI Scripting with the ILS Roy Zimmer Western Michigan University.
SCARY QUERIES LAID TO REST Getting Started with Voyager Prepackaged Access Reports Presented by Jean Vik, Associate Library Director The University of.
University of Georgia Libraries / Cataloging design robin fay We will explore the following concepts: UNIT.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 25 – Perl and CGI (Common Gateway Interface) Outline 25.1 Introduction 25.2 Perl 25.3 String Processing.
DAY 21: MICROSOFT ACCESS – CHAPTER 5 MICROSOFT ACCESS – CHAPTER 6 MICROSOFT ACCESS – CHAPTER 7 Akhila Kondai October 30, 2013.
The New Books List Michael Doran, Systems Librarian Ex Libris Southwest Users Group February 6, 2008 – Santa Ana College.
USG Institutional Billing Process In GIL Express Bob Trotter University System of Georgia Developer Meets Developer March 25-26, 2009.
CSCI 6962: Server-side Design and Programming
1 Insert, Update and Delete Queries. 2 Return to you Address Book database. Insert a record.
Developer Chicago 1-2 Feb 2010 Ken Herold Hamilton College.
Copyright © 2003 Pearson Education, Inc. Slide 8-1 The Web Wizard’s Guide to PHP by David Lash.
South Dakota Library Network ALEPH XSL Creator © South Dakota Library Network, 2008 Modified for SDLN Version 16 Last Update: June 2008 South Dakota Library.
ShelfLister ShelfLister Real-time Voyager Shelf Lists via Wireless PDA Michael Doran, Systems Librarian Ex Libris Southwest Users Group February 6, 2008.
The physical parts of a computer are called hardware.
What’s New in VRS? GUGM May 15, 2008 Presenter: Kelly P. Robinson GIL Service Georgia State University
DBI tutorial February 5 th, What is DBI DBI is short for Database Interface, which is a Perl module DBI is short for Database Interface, which is.
Project Overview Bibliographic merging, Endeca, and Web application.
PHP meets MySQL.
Let VRS Work for You! ELUNA Conference 2008 Presenter: Kelly P. Robinson GIL Service Georgia State University
SQL pepper. Why SQL File I/O is a great deal of code Optimal file organization and indexing is critical and a great deal of code and theory implementation.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
Midterm Hardware vs. Software Everyone got this right!
(Chapter 10 continued) Our examples feature MySQL as the database engine. It's open source and free. It's fully featured. And it's platform independent.
Putting it all together Dynamic Data Base Access Norman White Stern School of Business.
Dr Gordon Russell, Napier University Unit Embedded SQL - V3.0 1 Embedded SQL Unit 5.1.
Templates, Databases and Frameworks. Databases: DBI Common database interface for perl Provides a functional,
Create Lists in Millennium Jenny Schmidt SWITCH Library Consortium.
Database Development Tr ươ ng Quý Quỳnh. References UDEMY: SQL Database MasterClass: Go From Pupil To Master! Database Systems - A Practical Approach.
CS1100: Microsoft Access Managing Data in Relational Databases Created By Martin Schedlbauer CS11001Microsoft Access - Introduction.
GTR Data Inc. Welcome to our EDI Demonstration G.T.R. Data Inc. August 1997.
Programming in R SQL in R. Running SQL in R In this session I will show you how to: Run basic SQL commands within R.
CSCI 3327 Visual Basic Chapter 13: Databases and LINQ UTPA – Fall 2011.
Keyword Searching Weighted Federated Search with Key Word in Context Date: 10/2/2008 Dan McCreary President Dan McCreary & Associates
Leveraging Sustainable Staff Engagement Michael Frisbie ~ Library Specialist Johnson County Community College Voyager Analyzer.
PHP getting data from a MySQL database. Replacing XML as data source with MySQL Previously we obtained the data about the training session from an XML.
DataSet Your Database student test score Database Connection Your program needs to establish a connection to the database. Click on “Add New Data Source.”
Voyager and Spine Labels
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Intermediate Perl Programming Class Four Instructor:
Copyright 2007 Byrne Reese. Distributed under Creative Commons, share and share alike with attribution. Intermediate Perl Programming Class Three Instructor:
Voyage meets MeLCat: MC’ing the Introductions. MeLCat extract sequences Voyager bibout.pl bib extract patout.pl today’s extract yesterday’s extract patdiff.pl.
CP476 Internet Computing Perl CGI and MySql 1 Relational Databases –A database is a collection of data organized to allow relatively easy access for retrievals,
Using SQL for Patron Card Expiration Reminders For Norcal IUG – Nov. 20, 2015 At the Berkeley Public Library.
LINQ to DATABASE-2.  Creating the BooksDataContext  The code combines data from the three tables in the Books database and displays the relationships.
DBI: The Neophyte's Guide1 What is DBI? DBI = DataBase Interface DBI is database-independent DBI allows you to write code that interacts with databases.
ILL Inter-Library Loan. Inter-Library Loan Overview The ILL module is for the management of Inter-library loans received and sent by Your library.
Oracle Business Intelligence Foundation – Testing and Deploying OBI Repository.
SQL pepper. Why SQL File I/O is a great deal of code Optimal file organization and indexing is critical and a great deal of code and theory implementation.
PHP and SQL Server: Connection IST 210: Organization of Data IST2101.
Please remember to thank our sponsors!
Database Mysql Hayk Avdalyan.
Perl Database – Just Enough
INFO/CSE 100, Spring 2005 Fluency in Information Technology
Advanced Topics Web Programming.
SQL Standard Query Language Good for manipulating a Database
INFO/CSE 100, Spring 2006 Fluency in Information Technology
JMP® Meets SQL: Using Query Builder for JMP Data Tables
Presentation transcript:

NEVUG - August 2004 To Boldly Go: Using Perl and the Perl DBI as an Adjunct to MS Access for Custom Reports Maggie Rioux MBLWHOI Library Woods Hole, Mass.

NEVUG - August 2004 Using Perl and the Perl DBI as an Adjunct to MS Access for Custom Reports

NEVUG - August 2004 What is the Perl DBI An add-on Perl module You already have it as part of the standard Voyager install Lets you write a Perl program that talks to the Oracle tables just like MS Access does from your PC Then you can use all the power of Perl to play with the results

NEVUG - August 2004 How to Use the Perl DBI Develop your query using MS Access Translate the Access SQL into Oracle SQL Interfacing the Perl with Oracle is all in the book: Programming the Perl DBI Automate running the program using cron

NEVUG - August 2004 And now some examples:

NEVUG - August 2004 Active Holds/Recalls: The Access Report

NEVUG - August 2004 Active Holds/Recalls: The Access SQL SELECT [LAST_NAME]+", "+[FIRST_NAME] AS Name, WHOIDB_BIB_TEXT.TITLE, WHOIDB_MFHD_MASTER.DISPLAY_CALL_NO, WHOIDB_ITEM_BARCODE.ITEM_BARCODE, WHOIDB_HOLD_RECALL.HOLD_RECALL_TYPE, WHOIDB_HOLD_RECALL.CREATE_DATE, WHOIDB_PATRON_ADDRESS.ADDRESS_LINE1 FROM ((WHOIDB_ITEM_BARCODE INNER JOIN ((WHOIDB_BIB_MFHD INNER JOIN (WHOIDB_MFHD_ITEM INNER JOIN ((WHOIDB_HOLD_RECALL INNER JOIN WHOIDB_HOLD_RECALL_ITEMS ON WHOIDB_HOLD_RECALL.HOLD_RECALL_ID = WHOIDB_HOLD_RECALL_ITEMS.HOLD_RECALL_ID) INNER JOIN WHOIDB_PATRON ON WHOIDB_HOLD_RECALL.PATRON_ID = WHOIDB_PATRON.PATRON_ID) ON WHOIDB_MFHD_ITEM.ITEM_ID = WHOIDB_HOLD_RECALL_ITEMS.ITEM_ID) ON WHOIDB_BIB_MFHD.MFHD_ID = WHOIDB_MFHD_ITEM.MFHD_ID) INNER JOIN WHOIDB_BIB_TEXT ON WHOIDB_BIB_MFHD.BIB_ID = WHOIDB_BIB_TEXT.BIB_ID) ON WHOIDB_ITEM_BARCODE.ITEM_ID = WHOIDB_HOLD_RECALL_ITEMS.ITEM_ID) INNER JOIN WHOIDB_MFHD_MASTER ON WHOIDB_MFHD_ITEM.MFHD_ID = WHOIDB_MFHD_MASTER.MFHD_ID) INNER JOIN WHOIDB_PATRON_ADDRESS ON WHOIDB_PATRON.PATRON_ID = WHOIDB_PATRON_ADDRESS.PATRON_ID WHERE (((WHOIDB_ITEM_BARCODE.BARCODE_STATUS)="1") AND ((WHOIDB_HOLD_RECALL_ITEMS.HOLD_RECALL_STATUS)="1") AND ((WHOIDB_PATRON_ADDRESS.ADDRESS_TYPE)="3")) ORDER BY [LAST_NAME]+", "+[FIRST_NAME];

NEVUG - August 2004 Active Holds/Recalls: The Perl DBI/Oracle SQL $SQL = "SELECT WHOIDB.PATRON.LAST_NAME, WHOIDB.PATRON.FIRST_NAME, WHOIDB.BIB_TEXT.TITLE, WHOIDB.MFHD_MASTER.DISPLAY_CALL_NO, WHOIDB.ITEM_BARCODE.ITEM_BARCODE, WHOIDB.HOLD_RECALL.HOLD_RECALL_TYPE, WHOIDB.HOLD_RECALL.CREATE_DATE, WHOIDB.PATRON_ADDRESS.ADDRESS_LINE1 FROM WHOIDB.ITEM_BARCODE, WHOIDB.BIB_MFHD, WHOIDB.MFHD_ITEM, WHOIDB.HOLD_RECALL, WHOIDB.HOLD_RECALL_ITEMS, WHOIDB.BIB_TEXT, WHOIDB.MFHD_MASTER, WHOIDB.PATRON_ADDRESS, WHOIDB.PATRON …….

NEVUG - August 2004 Active Holds/Recalls: The Perl DBI/Oracle SQL …… WHERE WHOIDB.HOLD_RECALL.HOLD_RECALL_ID = WHOIDB.HOLD_RECALL_ITEMS.HOLD_RECALL_ID AND WHOIDB.HOLD_RECALL.PATRON_ID = WHOIDB.PATRON.PATRON_ID AND WHOIDB.MFHD_ITEM.ITEM_ID = WHOIDB.HOLD_RECALL_ITEMS.ITEM_ID AND WHOIDB.BIB_MFHD.MFHD_ID = WHOIDB.MFHD_ITEM.MFHD_ID AND WHOIDB.BIB_MFHD.BIB_ID = WHOIDB.BIB_TEXT.BIB_ID AND WHOIDB.ITEM_BARCODE.ITEM_ID = WHOIDB.HOLD_RECALL_ITEMS.ITEM_ID AND WHOIDB.MFHD_ITEM.MFHD_ID = WHOIDB.MFHD_MASTER.MFHD_ID AND WHOIDB.PATRON.PATRON_ID = WHOIDB.PATRON_ADDRESS.PATRON_ID AND WHOIDB.ITEM_BARCODE.BARCODE_STATUS = '1' AND WHOIDB.HOLD_RECALL_ITEMS.HOLD_RECALL_STATUS = '1' AND WHOIDB.PATRON_ADDRESS.ADDRESS_TYPE = '3' ORDER BY WHOIDB.PATRON.LAST_NAME, WHOIDB.PATRON.FIRST_NAME";

NEVUG - August 2004 Active Holds/Recalls: The Meat of the Perl DBI Code First set this important variable Connect to the database Set $SQL = the SQL you “fixed” #set environment variable $ENV{ORACLE_HOME} = "/oracle/app/oracle/product/8.0.5"; # connect to whoidb $dbh = DBI->connect( "dbi:Oracle:LIBR", “xxxread", “Cxxx" ) || die "Can't cconnect to Oracle database: $DBI:errstr\n" $SQL = "SELECT … ";

NEVUG - August 2004 Active Holds/Recalls: The Meat of the Perl DBI Code “Prepare” and execute Deal with each returned line as an element in an array Disconnect from the database when done $sth = $dbh->prepare($SQL); $sth->execute(); while = $sth->fetchrow_array ) { … # disconnect from database & close output file $dbh->disconnect || warn "Disconnection failed: $DBI:errstr\n";

NEVUG - August 2004 Active Holds/Recalls: Perl Program Output

NEVUG - August 2004 Patrons Leaving with Books Out: Output of the Access Query

NEVUG - August 2004 Patrons Leaving with Books Out: The Access SQL SELECT DISTINCTROW WHOIDB_PATRON.LAST_NAME AS [Last Name], WHOIDB_PATRON.FIRST_NAME AS [First Name], WHOIDB_PATRON.CURRENT_CHARGES AS [Books Out], WHOIDB_PATRON.EXPIRE_DATE AS Leaving, WHOIDB_PATRON_ADDRESS.ADDRESS_LINE1 AS [Address Info] FROM WHOIDB_PATRON INNER JOIN WHOIDB_PATRON_ADDRESS ON WHOIDB_PATRON.PATRON_ID = WHOIDB_PATRON_ADDRESS.PATRON_ID WHERE (((WHOIDB_PATRON.CURRENT_CHARGES)>"0") AND ((WHOIDB_PATRON.EXPIRE_DATE)<DateAdd("d",1,[Enter criterion date:])) AND ((WHOIDB_PATRON_ADDRESS.ADDRESS_TYPE)="1")) ORDER BY WHOIDB_PATRON.EXPIRE_DATE, WHOIDB_PATRON.LAST_NAME, WHOIDB_PATRON.FIRST_NAME;

NEVUG - August 2004 Patrons Leaving with Books Out: Editing the Access SQL Step 1 - Separate lines, change all WHOIDB_ to WHOIDB., take out the field labels (AS […]) SELECT DISTINCTROW WHOIDB.PATRON.LAST_NAME, WHOIDB.PATRON.FIRST_NAME, WHOIDB.PATRON.CURRENT_CHARGES, WHOIDB.PATRON.EXPIRE_DATE, WHOIDB.PATRON_ADDRESS.ADDRESS_LINE1, FROM WHOIDB.PATRON INNER JOIN WHOIDB_PATRON_ADDRESS ON WHOIDB.PATRON.PATRON_ID = WHOIDB.PATRON_ADDRESS.PATRON_ID WHERE (((WHOIDB.PATRON.CURRENT_CHARGES)>"0") AND ((WHOIDB.PATRON.EXPIRE_DATE)<DateAdd("d",1,[Enter criterion date:])) AND ((WHOIDB.PATRON_ADDRESS.ADDRESS_TYPE)="1")) ORDER BY WHOIDB.PATRON.EXPIRE_DATE, WHOIDB.PATRON.LAST_NAME, WHOIDB.PATRON.FIRST_NAME;

NEVUG - August 2004 Patrons Leaving with Books Out: Editing the Access SQL Step 2 - Change DISTINCTROW to DISTINCT or possibly UNIQUE, but probably not necessary in this case since there’s an address type used Step 3 - Change the joins to regular SQL format

NEVUG - August 2004 Patrons Leaving with Books Out: Editing the Access SQL SELECT WHOIDB.PATRON.FIRST_NAME, WHOIDB.PATRON.CURRENT_CHARGES, WHOIDB.PATRON.EXPIRE_DATE, WHOIDB.PATRON_ADDRESS.ADDRESS_LINE1 FROM WHOIDB.PATRON, WHOIDB.PATRON_ADDRESS WHERE WHOIDB.PATRON.PATRON_ID = WHOIDB.PATRON_ADDRESS.PATRON_ID AND WHOIDB.PATRON.CURRENT_CHARGES > ’0’ AND WHOIDB.PATRON.EXPIRE_DATE < $cutoffdate AND WHOIDB.PATRON_ADDRESS.ADDRESS_TYPE = ‘1’ ORDER BY WHOIDB.PATRON.EXPIRE_DATE, WHOIDB.PATRON.LAST_NAME, WHOIDB.PATRON.FIRST_NAME;

NEVUG - August 2004 Patrons Leaving with Books Out: The Final Perl DBI SQL Put this into a proper SQL statement = to a variable & also change $cutoffdate to something that actually works $SQL = “SELECT WHOIDB.PATRON.FIRST_NAME, WHOIDB.PATRON.CURRENT_CHARGES, WHOIDB.PATRON.EXPIRE_DATE, WHOIDB.PATRON_ADDRESS.ADDRESS_LINE1 FROM WHOIDB.PATRON, WHOIDB.PATRON_ADDRESS WHERE WHOIDB.PATRON.PATRON_ID = WHOIDB.PATRON_ADDRESS.PATRON_ID AND WHOIDB.PATRON.CURRENT_CHARGES > ’0’ AND WHOIDB.PATRON.EXPIRE_DATE < SYSDATE + $days_to_add AND WHOIDB.PATRON_ADDRESS.ADDRESS_TYPE = ‘1’ ORDER BY WHOIDB.PATRON.EXPIRE_DATE, WHOIDB.PATRON.LAST_NAME, WHOIDB.PATRON.FIRST_NAME”;

NEVUG - August 2004 Patrons Leaving with Books Out: Output of the Perl Program