This document provides an overview of connecting to and working with DB2 for IBM i from PHP applications. It discusses using Zend Server, which includes the ibm_db2 driver for connecting to DB2. The document reviews parameters for db2_connect() such as database name, username, password and optional options. It also covers topics like setting a default library, using library lists, and strategies for user profiles. An included sample script demonstrates prepared statements, binding parameters, and retrieving result sets from DB2 using ibm_db2.
Strategic Modernization with PHP on IBM iAlan Seiden
You know you need to modernize your IBM i applications, but where to start? In this talk, Alan will inspire you with creative examples of modernization on IBM i that provided a strong return on investment while controlling risk. Learn how to choose projects with the best return on investment, and then complete them with confidence. We will lead an honest discussion of the most effective strategies. Can RPG programmers learn PHP? Yes. Can new PHP developers be integrated into an existing IT department? Yes. Both approaches have merit. See creative ways to use PHP, not only to create new GUI front-ends, but to enhance existing interactive RPG programs. Please your users and business people by incorporating PHP into your shop.
PHP is famous for its ability to build web-based front ends, but it's also a flexible tool within batch processes--that is, as a utility language. Alan will show how to accomplish marvelous tasks by calling PHP from ordinary CL programs and with Job Queue functionality in Zend Server.
From Zero to ZF: Your first zend framework project on ibm iAlan Seiden
Step by step, I'll demonstrate the creation of a Zend Framework (ZF) project, with special attention to configuring the db2 adapter so it works well with IBM i.
How to measure and optimize performance of applications that use Zend Framework 1.x. A talk presented at the New York City Zend Framework Meetup (http://www.meetup.com/ZendFramework-NYCmetro/) on August 23, 2011.
PHP Toolkit from Zend and IBM: Open Source on IBM iAlan Seiden
PHP developers on IBM i have a new way to access resources such as RPG and COBOL programs, system commands, data areas, and more, using a new, free, flexible, open source toolkit, supported by Zend. Using IBM's XMLSERVICE toolkit on the back end, it's all open source, enabling a high level of quality and functionality delivered by Zend, IBM, and IBM i community members who take the initiative.
You will learn:
• How your older PHP applications can use the new toolkit with minimal changes, thanks to the Compatibility Wrapper (CW), developed for Zend by Alan
And how to:
• Optimize performance
• Develop PHP on your laptop (Windows, Linux) or in the "cloud" and deploy to the IBM i
With suggestions for:
• Security
• Troubleshooting
• Tips and tricks to work with your IBM i in new ways
Create a welcoming development environment on IBM iAlan Seiden
Thanks to languages such as PHP, young developers are entering the IBM i world, but may be unprepared for their new environment. They may not realize that IBM i has an SSH shell environment that can have them feeling at home and productive.
This talk will offer tools and tips to allow developers to work from a UNIX command line in the manner they may be used to (with minor adjustments) on IBM i. Improve job satisfaction with the tips presented here.
Topics will include:
* create a chroot environment for safe experimentation on IBM i
* install bash shell with tab autocomplete and other familar features
* access DB2 and IBM i operations from the command line
* use familiar editing tools such as vi
* use php-cli efficiently
If your web application runs slowly, your reputation and business could suffer. To restore confidence, you must improve performance immediately, because frustrated users might not return to give you a second chance. You need “Web Performance First Aid.”
In this talk, Alan will share "first aid" techniques that can improve web performance within minutes.
Once your site starts to run faster, positive word of mouth may be generated among users, restoring confidence in your efforts and giving you breathing room to examine your application for further improvements.
Particular focus will be given to free tools that help diagnose performance bottlenecks, how to configure the Apache web server for speed, and making best use of the unique characteristics of IBM i.
IBM i: Fertile Ground for PHP DevelopersAlan Seiden
The IBM i platform, which evolved from System i, i5, iSeries, and AS/400, is a highly reliable, secure, self-managing, and integrated operating environment with a loyal, devoted following among thousands of businesses. A PHP developer who knows how to speak "IBM i" will be differentiated in the job market, gaining interesting employment and consulting opportunities.
In this talk, Alan Seiden will introduce you to the world of IBM i, covering the basics of this unique platform.
Strategic Modernization with PHP on IBM iAlan Seiden
You know you need to modernize your IBM i applications, but where to start? In this talk, Alan will inspire you with creative examples of modernization on IBM i that provided a strong return on investment while controlling risk. Learn how to choose projects with the best return on investment, and then complete them with confidence. We will lead an honest discussion of the most effective strategies. Can RPG programmers learn PHP? Yes. Can new PHP developers be integrated into an existing IT department? Yes. Both approaches have merit. See creative ways to use PHP, not only to create new GUI front-ends, but to enhance existing interactive RPG programs. Please your users and business people by incorporating PHP into your shop.
PHP is famous for its ability to build web-based front ends, but it's also a flexible tool within batch processes--that is, as a utility language. Alan will show how to accomplish marvelous tasks by calling PHP from ordinary CL programs and with Job Queue functionality in Zend Server.
From Zero to ZF: Your first zend framework project on ibm iAlan Seiden
Step by step, I'll demonstrate the creation of a Zend Framework (ZF) project, with special attention to configuring the db2 adapter so it works well with IBM i.
How to measure and optimize performance of applications that use Zend Framework 1.x. A talk presented at the New York City Zend Framework Meetup (http://www.meetup.com/ZendFramework-NYCmetro/) on August 23, 2011.
PHP Toolkit from Zend and IBM: Open Source on IBM iAlan Seiden
PHP developers on IBM i have a new way to access resources such as RPG and COBOL programs, system commands, data areas, and more, using a new, free, flexible, open source toolkit, supported by Zend. Using IBM's XMLSERVICE toolkit on the back end, it's all open source, enabling a high level of quality and functionality delivered by Zend, IBM, and IBM i community members who take the initiative.
You will learn:
• How your older PHP applications can use the new toolkit with minimal changes, thanks to the Compatibility Wrapper (CW), developed for Zend by Alan
And how to:
• Optimize performance
• Develop PHP on your laptop (Windows, Linux) or in the "cloud" and deploy to the IBM i
With suggestions for:
• Security
• Troubleshooting
• Tips and tricks to work with your IBM i in new ways
Create a welcoming development environment on IBM iAlan Seiden
Thanks to languages such as PHP, young developers are entering the IBM i world, but may be unprepared for their new environment. They may not realize that IBM i has an SSH shell environment that can have them feeling at home and productive.
This talk will offer tools and tips to allow developers to work from a UNIX command line in the manner they may be used to (with minor adjustments) on IBM i. Improve job satisfaction with the tips presented here.
Topics will include:
* create a chroot environment for safe experimentation on IBM i
* install bash shell with tab autocomplete and other familar features
* access DB2 and IBM i operations from the command line
* use familiar editing tools such as vi
* use php-cli efficiently
If your web application runs slowly, your reputation and business could suffer. To restore confidence, you must improve performance immediately, because frustrated users might not return to give you a second chance. You need “Web Performance First Aid.”
In this talk, Alan will share "first aid" techniques that can improve web performance within minutes.
Once your site starts to run faster, positive word of mouth may be generated among users, restoring confidence in your efforts and giving you breathing room to examine your application for further improvements.
Particular focus will be given to free tools that help diagnose performance bottlenecks, how to configure the Apache web server for speed, and making best use of the unique characteristics of IBM i.
IBM i: Fertile Ground for PHP DevelopersAlan Seiden
The IBM i platform, which evolved from System i, i5, iSeries, and AS/400, is a highly reliable, secure, self-managing, and integrated operating environment with a loyal, devoted following among thousands of businesses. A PHP developer who knows how to speak "IBM i" will be differentiated in the job market, gaining interesting employment and consulting opportunities.
In this talk, Alan Seiden will introduce you to the world of IBM i, covering the basics of this unique platform.
Web services on IBM i with PHP and Zend FrameworkAlan Seiden
Case study of connecting to Windows-based SOAP server (UPS Roadnet) with a client running on IBM i with PHP and Zend Framework. Lots of tips and help to get started.
Install MariaDB on IBM i - Tips, troubleshooting, and moreRod Flohr
MariaDB is the new open source drop-in replacement for MySQL that has been adopted by IBM for use on Power Linux and IBM i. ZendDBi is the installer provided by Zend for installation of MariaDB on the IBM i. In this session we'll show how to use ZendDBi to install MariaDB and provide some important tips for post-installation. We'll also demonstrate troubleshooting some common installation issues. While most installations of MariaDB are trouble free, the troubleshooting procedures will give us a chance to understand a bit more about the operation of MariaDB on the IBM i. It'll also give us the opportunity to explore some concepts on IBM i that may not be familiar to some RPG programmers.
A a sneak peek into PHP 7, Zend Server 9, Zend Studio 13.5, and what the combination brings to IBM i users. Available in Q3, sporting a new DB2 extension and lots of new goodies, Zend Server 9 will prove to be the biggest open source story to hit IBM i this year. Once you add the latest Zend Studio release (13.5), you’ll be well on your way to full web enablement.
Browser tools that make web development easierAlan Seiden
A departure from my usual PHP talks, I discussed browser-based tools that help with client-side tasks such as performance diagnostics, page analysis, HTTP flow analysis, the ability to step through javascript, and much more. Developers can work smarter with downloadable browser tools.
Everyone knows installing PHP on IBM i is easy. Just download the save file and run the RSTLICPGM command. But not everyone knows what that RSTLICPGM does. What is it putting on the machine? Where is it putting it? How does it all work together? In this session, we'll take a look at the IFS directories added by the Zend Server installer, to see what's in them. We'll see where PHP and PHP extensions, Apache and FastCGI configurations, log files, and more are kept. We'll also talk about how these new file objects interact with existing prerequisite software on the IBM i to present dynamic pages to the web. This session is for PHP developers and administrators interested in learning how PHP fits in with the unique operating environment of IBM i.
This presentation reviews of the many aspects of PHP performance that can impact day-to-day living. It explores basic concepts for resolution when PHP performance has got you down. The focus is on Zend Server configuration options including, but not limited to: caching, Apache settings, PHP syntax fundamentals, diagnosing bottlenecks, and DB2/SQL optimization.
Running open source PHP applications on you IBM iProximity Group
At International i-Power 2015, Pete Samways presented a hands-on workshop entitled 'Running open source products on your IBM i'.
As the IBM i is a more open platform than it has ever been, it has become an excellent platform for running and developing web and mobile applications. In this practical workshop, attendees were guided through the process of installing and running open source PHP applications on their IBM i such as Drupal, Magento, WordPress, Mantis Bug Tracker and Sugar CRM. The session included live and guided demonstrations of installing Zend Server, Zend DBi and the applications themselves from a .zpk or from source.
Download the slides from the workshop to find out about more about Zend Server, some top tips for configuring Zend Server, what open source is, why PHP for open source and the advantages of PHP on the IBM i.
Zend con 2016 bdd with behat for beginnersAdam Englander
Learn the basics of behavioral driven development (BDD) with Behat to build high quality and well documented applications. You'll learn how BDD can help you deliver greater business value more efficiently while accurately documenting the functionality of your application along the way. You'll learn how to utilize Behat as your BDD tool. With Behat, you'll create tests for the features in your application by utilizing a natural language syntax called Gherkin backed by PHP code to execute the steps executed in the feature's scenarios.
This will be a hands-on tutorial. You'll learn how to implement BDD for a web application. This will include utilizing Selenium WebDriver for real world multi-browser testing including introductions to Selenium Grid and hosted integration services utilizing Selenium.
Getting Started with SQL Server Compact Edition 3.51Mark Ginnebaugh
SQL Server Compact 3.51 is a free, easy-to-use, embedded database engine that lets developers build robust Windows Desktop and mobile applications that run on all Windows platforms including Windows XP, Vista, Pocket PC, and Smartphone. It allows you to replicate a local database with a big brother SQL Server using Sync Services over the web.
This slide deck was presented to the San Francisco .NET User Group by Don Robins on July 29, 2009.
In this presentation you will learn:
•What SQL Server Compact Edition 3.51 is and how it works
•How you can synchronize a database with a back-end server over the web
This webinar lays the foundation for your PHP app. If you have at least one year of PHP experience, this webinar explains these key building blocks for creating and maintaining enterprise-class applications, mobile services, and third-party libraries. It covers: what makes mission-critical PHP different? (including cloud-based solutions); how to maintain your PHP stack; how to ensure code security; and what to do when your system goes down?
IBM Connect 2016 - 60+ in 60 - Admin Tips Power HourChris Miller
See the full slides at http://idonot.es/60in60for2016
With a guaranteed minimum of 60 administration tips in 60 minutes you will walk out with a list of items to immediately help you tune your collaboration environment. Covering IBM Domino, Sametime, Connections, Traveler and more will have you eager to get back and implement some of the ideas. We will take best practices from the my SocialBizUg Admin Tips newsletter, customer case stories and other best practices. Have no fear, we will move faster that you can write so everything will be available for you to download. This is an ode to the hundreds of tips brought to you by the letters M and G (Mooney and Gab) over the years.
This is the slide deck of the "Performance Tuning PHP on IBM i" given by Mike Pavlak and Alan Seiden in Feb 2012. They discuss some of the more fundamental areas that reveal performance bottlenecks. They explore hardware, software and configuration options that will help your PHP applications fly. The discussion reviews features for both Zend Server and Zend Server CE.
To watch the recording, visit http://bit.ly/A4NjYM
Php Dependency Management with Composer ZendCon 2016Clark Everetts
A deep-dive for beginners into Composer, the dependency manager for PHP. Learn how Composer helps you obtain the components your applications depend upon, installs them into your project, and controls their update to newer versions.
Abstraction, encapsulation, polymorphism, and interfaces: whether you've been programming in PHP for years or are just starting your journey, these terms can be overwhelming even on a good day. Variables, conditionals, those all make sense. But this whole object-oriented thing is way more complicated. Not only that, people that already understand it, act like it's so easy and they talk right over the simple questions and never explain the basic concepts in a way that actually makes sense. In this session, we'll take you through real-life examples of object-oriented terminology in a way that will make sense of all the mumbo jumbo and allow you to utilize object-oriented programming (OOP) immediately.
Web services on IBM i with PHP and Zend FrameworkAlan Seiden
Case study of connecting to Windows-based SOAP server (UPS Roadnet) with a client running on IBM i with PHP and Zend Framework. Lots of tips and help to get started.
Install MariaDB on IBM i - Tips, troubleshooting, and moreRod Flohr
MariaDB is the new open source drop-in replacement for MySQL that has been adopted by IBM for use on Power Linux and IBM i. ZendDBi is the installer provided by Zend for installation of MariaDB on the IBM i. In this session we'll show how to use ZendDBi to install MariaDB and provide some important tips for post-installation. We'll also demonstrate troubleshooting some common installation issues. While most installations of MariaDB are trouble free, the troubleshooting procedures will give us a chance to understand a bit more about the operation of MariaDB on the IBM i. It'll also give us the opportunity to explore some concepts on IBM i that may not be familiar to some RPG programmers.
A a sneak peek into PHP 7, Zend Server 9, Zend Studio 13.5, and what the combination brings to IBM i users. Available in Q3, sporting a new DB2 extension and lots of new goodies, Zend Server 9 will prove to be the biggest open source story to hit IBM i this year. Once you add the latest Zend Studio release (13.5), you’ll be well on your way to full web enablement.
Browser tools that make web development easierAlan Seiden
A departure from my usual PHP talks, I discussed browser-based tools that help with client-side tasks such as performance diagnostics, page analysis, HTTP flow analysis, the ability to step through javascript, and much more. Developers can work smarter with downloadable browser tools.
Everyone knows installing PHP on IBM i is easy. Just download the save file and run the RSTLICPGM command. But not everyone knows what that RSTLICPGM does. What is it putting on the machine? Where is it putting it? How does it all work together? In this session, we'll take a look at the IFS directories added by the Zend Server installer, to see what's in them. We'll see where PHP and PHP extensions, Apache and FastCGI configurations, log files, and more are kept. We'll also talk about how these new file objects interact with existing prerequisite software on the IBM i to present dynamic pages to the web. This session is for PHP developers and administrators interested in learning how PHP fits in with the unique operating environment of IBM i.
This presentation reviews of the many aspects of PHP performance that can impact day-to-day living. It explores basic concepts for resolution when PHP performance has got you down. The focus is on Zend Server configuration options including, but not limited to: caching, Apache settings, PHP syntax fundamentals, diagnosing bottlenecks, and DB2/SQL optimization.
Running open source PHP applications on you IBM iProximity Group
At International i-Power 2015, Pete Samways presented a hands-on workshop entitled 'Running open source products on your IBM i'.
As the IBM i is a more open platform than it has ever been, it has become an excellent platform for running and developing web and mobile applications. In this practical workshop, attendees were guided through the process of installing and running open source PHP applications on their IBM i such as Drupal, Magento, WordPress, Mantis Bug Tracker and Sugar CRM. The session included live and guided demonstrations of installing Zend Server, Zend DBi and the applications themselves from a .zpk or from source.
Download the slides from the workshop to find out about more about Zend Server, some top tips for configuring Zend Server, what open source is, why PHP for open source and the advantages of PHP on the IBM i.
Zend con 2016 bdd with behat for beginnersAdam Englander
Learn the basics of behavioral driven development (BDD) with Behat to build high quality and well documented applications. You'll learn how BDD can help you deliver greater business value more efficiently while accurately documenting the functionality of your application along the way. You'll learn how to utilize Behat as your BDD tool. With Behat, you'll create tests for the features in your application by utilizing a natural language syntax called Gherkin backed by PHP code to execute the steps executed in the feature's scenarios.
This will be a hands-on tutorial. You'll learn how to implement BDD for a web application. This will include utilizing Selenium WebDriver for real world multi-browser testing including introductions to Selenium Grid and hosted integration services utilizing Selenium.
Getting Started with SQL Server Compact Edition 3.51Mark Ginnebaugh
SQL Server Compact 3.51 is a free, easy-to-use, embedded database engine that lets developers build robust Windows Desktop and mobile applications that run on all Windows platforms including Windows XP, Vista, Pocket PC, and Smartphone. It allows you to replicate a local database with a big brother SQL Server using Sync Services over the web.
This slide deck was presented to the San Francisco .NET User Group by Don Robins on July 29, 2009.
In this presentation you will learn:
•What SQL Server Compact Edition 3.51 is and how it works
•How you can synchronize a database with a back-end server over the web
This webinar lays the foundation for your PHP app. If you have at least one year of PHP experience, this webinar explains these key building blocks for creating and maintaining enterprise-class applications, mobile services, and third-party libraries. It covers: what makes mission-critical PHP different? (including cloud-based solutions); how to maintain your PHP stack; how to ensure code security; and what to do when your system goes down?
IBM Connect 2016 - 60+ in 60 - Admin Tips Power HourChris Miller
See the full slides at http://idonot.es/60in60for2016
With a guaranteed minimum of 60 administration tips in 60 minutes you will walk out with a list of items to immediately help you tune your collaboration environment. Covering IBM Domino, Sametime, Connections, Traveler and more will have you eager to get back and implement some of the ideas. We will take best practices from the my SocialBizUg Admin Tips newsletter, customer case stories and other best practices. Have no fear, we will move faster that you can write so everything will be available for you to download. This is an ode to the hundreds of tips brought to you by the letters M and G (Mooney and Gab) over the years.
This is the slide deck of the "Performance Tuning PHP on IBM i" given by Mike Pavlak and Alan Seiden in Feb 2012. They discuss some of the more fundamental areas that reveal performance bottlenecks. They explore hardware, software and configuration options that will help your PHP applications fly. The discussion reviews features for both Zend Server and Zend Server CE.
To watch the recording, visit http://bit.ly/A4NjYM
Php Dependency Management with Composer ZendCon 2016Clark Everetts
A deep-dive for beginners into Composer, the dependency manager for PHP. Learn how Composer helps you obtain the components your applications depend upon, installs them into your project, and controls their update to newer versions.
Abstraction, encapsulation, polymorphism, and interfaces: whether you've been programming in PHP for years or are just starting your journey, these terms can be overwhelming even on a good day. Variables, conditionals, those all make sense. But this whole object-oriented thing is way more complicated. Not only that, people that already understand it, act like it's so easy and they talk right over the simple questions and never explain the basic concepts in a way that actually makes sense. In this session, we'll take you through real-life examples of object-oriented terminology in a way that will make sense of all the mumbo jumbo and allow you to utilize object-oriented programming (OOP) immediately.
Magento 2 is here, and it's time to dive in! Composer, PSRs, and a full test suite make Magento 2 easy and enjoyable to learn. The goal of this tutorial is to introduce the framework concepts of Magento 2 as a foundation for customizing and extending the application. There will also be plenty of commerce anecdotes to go around. Show up, participate, and walk out with both a working Magento 2 environment and module.
Bringing modern PHP development to IBM i (ZendCon 2016)James Titcumb
Zend Server for IBM i has done a great job at allowing enterprise PHP applications to run smoothly on the IBM i platform. But what about developing for the platform? Having recently been hired for a PHP project on IBM i, we wanted to ensure the project was using the best practices possible. This involved embarking on a whole new collaborative journey - uniting expert platform knowledge with bleeding-edge modern PHP development practices. We'll show you the process our team went through on the project to revolutionize the client's development process by introducing database abstraction, unit tests, functional tests, continuous integration, automated deployment, and more.
All the Laravel things: up and running to making $$Joe Ferguson
Laravel 5 has established itself as one of the best PHP rapid application development frameworks. Come learn about all the tools in the Laravel ecosystem designed to save you time and prevent you from writing the boring cruft you have to write for every application. We'll cover getting started with local development, building a basic application, and deploying to production. We'll review how Laravel easily handles vagrant, testing, oauth login services, billing and subscriptions services through Laravel Spark, and deploying your application with services such as Laravel Envoyer and Forge to manage your servers.
J2EE is already the perfect solution for complex business/enterprise systems, and JSF2.x is the perfect chance to reach out to the consumer and small business market. JSF is easier to use than it's ever been before, but small businesses have different needs than larger companies and corporations. PrettyFaces is for all projects, small and large; this presentation explains why "pretty, bookmark-able URLs" are important for client-facing applications, addressing SEO optimization, and creating clean, consistent, intuitive client interactions on the web.
View slides from Chris Conlon's presentation about securing MySQL - including an intro to SSL, and performance statistics for MySQL SSL usage.
To learn more about yaSSL products or the CyaSSL embedded SSL library, visit www.wolfssl.com.
Kicking off with Zend Expressive and Doctrine ORM (Sunshine PHP 2017)James Titcumb
You've heard of Zend's new framework, Expressive, and you've heard it's the new hotness. In this talk, I will introduce the concepts of Expressive, how to bootstrap a simple application with the framework using best practices, and finally how to integrate a third party tool like Doctrine ORM.
Framing the Argument: How to Scale Faster with NoSQLInside Analysis
The Briefing Room with Dr. Robin Bloor and IBM Cloudant
Live Webcast March 24, 2015
Watch the Archive: https://bloorgroup.webex.com/bloorgroup/onstage/g.php?MTID=e8bf62408d47e76c43aa73be08377e41c
Context matters. Perspective matters. Thinking outside the box? That's often the key! While the Structured Query Language remains the lingua Franca of data, there are some views of the world that are best rendered with the benefit of NoSQL engines. As usual, that's easier said than done. How can your organization migrate from a structured query to unstructured or semi-structured query language?
Register for this episode of The Briefing Room to find out! Veteran Analyst Dr. Robin Bloor will provide a detailed assessment of serious considerations when using NoSQL engines in conjunction with SQL. He'll be briefed by Ryan Millay of IBM Cloudant, who will showcase his company's solution, and how it's addressing the more vexing challenges facing today's information managers.
Visit InsideAnalysis.com for more information.
Developing Connections Plug-ins and applications is full of "What the??" moments, from what browser technologies and versions are supported through to common functions working in different ways in different parts of Connections, any of these can put a real dent in your delivery date but most are easy to cure and avoid with a little bit of hindsight and knowledge, here is that knowledge for you to take home and help you deliver on time.
This is the slide deck of the Zend webinar "Introduction to column oriented databases in PHP".
This webinar is a quick crash-course and practical session that will explain:
* What are column oriented databases and how do they differ from the standard rational (row oriented) databases.
* Advantages and disadvantages
* Is a column oriented database for me?
* How to use it from PHP
Presenter – Slavey Karadzhov
Way #5 Don’t end up in a ditch because you weren’t aware of roadblocks in you...panagenda
Recording: https://pan.news/idna20200311
It’s dangerous to underestimate the impact of database design on the future of your Notes/Domino applications. It doesn’t matter if you are modernizing or migrating. Each path has to deal with its own challenges around platform dependencies or incompatibility in the source code. Having the code base at your fingertips is key to mastering these challenges before they turn into issues.
Join Franz Walder for this webinar and learn how to identify the potential roadblocks. You will leave being able to apply these findings to your own project. They will help you avoid the complications so many others have run into. Project managers and developers alike will benefit from increased efficiency while reducing risk at the same time.
The talk will be about the project to find a replacement for all IBM products in the company with the example for the databases. What was the goal of the project, the learning, a short overview about the options
we migrated about 500 db2 databases to EnterpriseDB. The database size was from a small size up to 4 TB and we implemented a completely new fully automated deployment of VM and database. Databases are now 11 month in production. The talk will have an overview of the project, the learnings, a few parameters and technical parameters that were found for stability and performance.
ZF2 takes a different approach to services; there are several services out there and you should be providing the ability for ZF2 to integrate with this. ZF2 marries services with composer and a different packaging mechanism to ensure that services can be released without a specific framework version. This not only helps the framework but helps you prevent an API changing in between framework releases without having an issue of awaiting a framework release.
Engage 2020 - Best Practices for analyzing Domino Applicationspanagenda
Let's take an in-depth look at why and how to best analyze your Domino applications from a design and code perspective. We will cover modernization, migration and optimization topics, look at Lotusscript, @Formulas and Java examples, and get a good understanding of the many design elements that make up your applications and how they make a difference. If you're an admin, bring some (Notes) development knowledge along, please. This session is vendor and solution independent and will help you better understand why you should analyze your Domino applications and what to watch out for.
1.Wireless Communication System_Wireless communication is a broad term that i...JeyaPerumal1
Wireless communication involves the transmission of information over a distance without the help of wires, cables or any other forms of electrical conductors.
Wireless communication is a broad term that incorporates all procedures and forms of connecting and communicating between two or more devices using a wireless signal through wireless communication technologies and devices.
Features of Wireless Communication
The evolution of wireless technology has brought many advancements with its effective features.
The transmitted distance can be anywhere between a few meters (for example, a television's remote control) and thousands of kilometers (for example, radio communication).
Wireless communication can be used for cellular telephony, wireless access to the internet, wireless home networking, and so on.
# Internet Security: Safeguarding Your Digital World
In the contemporary digital age, the internet is a cornerstone of our daily lives. It connects us to vast amounts of information, provides platforms for communication, enables commerce, and offers endless entertainment. However, with these conveniences come significant security challenges. Internet security is essential to protect our digital identities, sensitive data, and overall online experience. This comprehensive guide explores the multifaceted world of internet security, providing insights into its importance, common threats, and effective strategies to safeguard your digital world.
## Understanding Internet Security
Internet security encompasses the measures and protocols used to protect information, devices, and networks from unauthorized access, attacks, and damage. It involves a wide range of practices designed to safeguard data confidentiality, integrity, and availability. Effective internet security is crucial for individuals, businesses, and governments alike, as cyber threats continue to evolve in complexity and scale.
### Key Components of Internet Security
1. **Confidentiality**: Ensuring that information is accessible only to those authorized to access it.
2. **Integrity**: Protecting information from being altered or tampered with by unauthorized parties.
3. **Availability**: Ensuring that authorized users have reliable access to information and resources when needed.
## Common Internet Security Threats
Cyber threats are numerous and constantly evolving. Understanding these threats is the first step in protecting against them. Some of the most common internet security threats include:
### Malware
Malware, or malicious software, is designed to harm, exploit, or otherwise compromise a device, network, or service. Common types of malware include:
- **Viruses**: Programs that attach themselves to legitimate software and replicate, spreading to other programs and files.
- **Worms**: Standalone malware that replicates itself to spread to other computers.
- **Trojan Horses**: Malicious software disguised as legitimate software.
- **Ransomware**: Malware that encrypts a user's files and demands a ransom for the decryption key.
- **Spyware**: Software that secretly monitors and collects user information.
### Phishing
Phishing is a social engineering attack that aims to steal sensitive information such as usernames, passwords, and credit card details. Attackers often masquerade as trusted entities in email or other communication channels, tricking victims into providing their information.
### Man-in-the-Middle (MitM) Attacks
MitM attacks occur when an attacker intercepts and potentially alters communication between two parties without their knowledge. This can lead to the unauthorized acquisition of sensitive information.
### Denial-of-Service (DoS) and Distributed Denial-of-Service (DDoS) Attacks
Bridging the Digital Gap Brad Spiegel Macon, GA Initiative.pptxBrad Spiegel Macon GA
Brad Spiegel Macon GA’s journey exemplifies the profound impact that one individual can have on their community. Through his unwavering dedication to digital inclusion, he’s not only bridging the gap in Macon but also setting an example for others to follow.
Multi-cluster Kubernetes Networking- Patterns, Projects and GuidelinesSanjeev Rampal
Talk presented at Kubernetes Community Day, New York, May 2024.
Technical summary of Multi-Cluster Kubernetes Networking architectures with focus on 4 key topics.
1) Key patterns for Multi-cluster architectures
2) Architectural comparison of several OSS/ CNCF projects to address these patterns
3) Evolution trends for the APIs of these projects
4) Some design recommendations & guidelines for adopting/ deploying these solutions.
APNIC Foundation, presented by Ellisha Heppner at the PNG DNS Forum 2024APNIC
Ellisha Heppner, Grant Management Lead, presented an update on APNIC Foundation to the PNG DNS Forum held from 6 to 10 May, 2024 in Port Moresby, Papua New Guinea.
2. DB2 and PHP: EssentialsSeiden Group
Seiden Group and Club Seiden
Alan is a leader and expert in PHP on IBM i; leader, Zend’s PHP Toolkit
for IBM i; and “Performance guru of PHP on IBM i”
Seiden Group is a team of experts available for
mentoring/troubleshooting/project advice/development.
seidengroup.com, alan@seidengroup.com
2
3. DB2 and PHP: EssentialsSeiden Group
Contact
3
Alan Seiden
alan@seidengroup.com
201-447-2437
www.SeidenGroup.com
twitter: @alanseiden
4. DB2 and PHP: EssentialsSeiden Group
Today’s discussion will include:
• Uniqueness of DB2 for IBM i
• Which DB2-enabled middleware to use with PHP
• Securing your SQL with prepared queries
• Connection options for speed and reliability
§ Persistent connections
§ Library lists
• What’s NEW in ibm_db2
• Connecting from “off the box”
• Many other tips
4
5. DB2 and PHP: EssentialsSeiden Group
Why learn DB2 best practices?
•As chief database on IBM i, DB2 runs these:
•Most transaction processing systems
•Stored procedures
•“XMLSERVICE” Toolkit
• Accessible with db2 stored procedures from PHP
•DB2 knowledge will help you:
•Maximize speed
•Reduce CPU usage
•Maximize reliability
• Avoid unexpected locking and other operational problems
5
6. DB2 and PHP: EssentialsSeiden Group
Heart of IBM i is DB2
• DB2 built in
§ Transaction processing workhorse
§ Database implemented below operating system level!
• IBM i’s “Machine Interface (MI)” between OS and hardware
§ Journaling, auditing, commitment control very commonly used
§ Never corrupted
• Doesn’t lose data even if knock out power plug
• Database often taken for granted
§ So self-managing, DBAs are rare
6
8. DB2 and PHP: EssentialsSeiden Group
Nondisruptive business growth
• Scales vertically
§ One system can handle large and diverse workloads
• Total Cost of Ownership (TCO), including reduced operator
costs, is said to be competitive or cheaper than assembling
server farms
§ Can activate additional processors without restarting system
• Dependable
§ Resistant to viruses
• Object-based system since the 1970s
§ Journaling, commitment control, replication, high availability
§ Security features galore
§ Keeps on running
• You will sleep soundly at night
8
9. DB2 and PHP: EssentialsSeiden Group
IBM i can “phone home”
9
10. DB2 and PHP: EssentialsSeiden Group
Data and programs last forever
• IBM has been dedicated to legacy app longevity
and data longevity
§ RPG (and occasionally COBOL) running for 30-40 years
§ DB2 data evolving 30-40 years
§ Middleware insulates applications from hardware changes
10
IBM i Heritage chart from Trevor Perry
http://blog.angustheitchap.com/?p=415
11. DB2 and PHP: EssentialsSeiden Group
Long-serving back ends, new front ends
• What does this mean to you?
§ RPG and DB2, mature and evolving for years, can be part of
your data model, accessed by PHP
§ Create web GUI interfaces and web services around these
venerable resources
• Business logic is encapsulated in RPG/COBOL/DB2
• You can keep your hands somewhat clean of business details
11
12. DB2 and PHP: EssentialsSeiden Group
DB2 on IBM i is…
•Fully integrated business database
• Coded at the kernel level (below the OS)
• Other database systems are .exe files
• User profiles = real IBM i user profiles
• Security, logging, auditing consistent throughout the system
• Other databases have “pretend” users whose security is enforced
only by database code
•Always present and available
• No daemon that can be ended or hacked
• “Who shut down the database?” Not on IBM i!
12
13. DB2 and PHP: EssentialsSeiden Group
DB2 on IBM i is…
•Indestructible, low maintenance (cost-effective)
• Data corruption almost unheard of
• 30+ years of work for reliability and throughput
• DBA-less operation. Scale vertically. Add disk and go!
• DB2 on i is
not this:
13
Disclaimer: Not singling out other
databases as “bad.” A NoSQL
database such as Mongo prizes
flexibility more than management ease
14. DB2 and PHP: EssentialsSeiden Group
Database jargon
• Modern and traditional IBM i terminology coexist
* a logical file resembles an “index + view”
Modern views, triggers, etc. are supported by DB2.
14
Modern term Traditional term or phrase
Schema Library
Table File or Physical File
Index Logical File*
Row Record
Column Field
15. DB2 and PHP: EssentialsSeiden Group
Tip: LF indexes used automatically
• Logical file keys treated as indexes by SQL
•To take advantage of LF “indexes,” use ORDER BY,
WHERE, and JOIN in your SQL as usual
§ Indexes from LFs will be chosen automatically as appropriate
§ No need to specify LF in SQL: use physical file/table
• If your preferred indexes aren’t selected by the optimizer, try
Visual Explain to learn why.
§ http://www.ibmsystemsmag.com/ibmi/developer/general/
visual_explain/
§ Visual Explain runs in Access Client Solutions (ACS) and the
older IBM i Navigator.
15
17. DB2 and PHP: EssentialsSeiden Group
Zend Server for IBM i
• Download Zend Server 8.x
• http://www.zend.com/en/products/server/downloads-ibmi
• Easy upgrade from 6.x
• Includes ibm_db2 version 1.9.7
with many updates
• Editions
• Basic (free), Professional, Enterprise
• http://www.zend.com/en/products/server/editions
• Same download, different license
17
18. DB2 and PHP: EssentialsSeiden Group
DB2 is an exciting growth zone for IBM i
•Behooves you to stay on top of it
•Example of update:
•http://www.mcpressonline.com/ibm-i-os/400-i5/os/step-right-up-
and-hear-about-db2-and-tr9.html
•Regular expressions in WHERE clause
•System info available via SQL…joblog, liblist, more
18
20. DB2 and PHP: EssentialsSeiden Group
A select list of features (1 of 2)
• SQL Views
§ Act like a table (SELECT) but implements “virtual” logic
• User defined functions (UDF)
§ Less functionality than the others (generic)
§ “Free” connections from other platforms
• Stored procedures
§ Efficient, flexible
§ Good place for business logic
§ Run multiple queries if desired
more…
20
21. DB2 and PHP: EssentialsSeiden Group
A select list of features (2 of 2)
• VARCHAR/Trim
§ Avoid extra spaces caused by fixed-length strings
• Web service support
§ DB2 can retrieve/send HTTP data and parse XML
21
22. DB2 and PHP: EssentialsSeiden Group
Views
• Like old “join logical” file and much more
create view presllmstj1
(programcode, programdesc, item, orderbydate, orderbydate_mmddyy, expired) as
select trim(pccode), trim(pcdesc), pmprod, pmobdate,
mmddyy_slashes(pmobdate),
CASE WHEN CURRENT_DATE > PMOBDATE THEN 1 ELSE 0 END as expired
from PRESLLMST left join PRESLLCDE on PMCODE = PCCODE
select * from presllmstj1
22
23. DB2 and PHP: EssentialsSeiden Group
User-defined functions (UDF)
• Create your own function in DB2
e.g. 6 digit numeric date mmddyy to real date
old way:
select date(substr(digits(phdate),1,2) || '/' || substr(digits(phdate),3,2) || '/' ||
substr(digits(phdate),5,2)) as podate from podet inner join pohead on
pipo=phpo where piprod = 4317140;
CREATE FUNCTION mmddyy_to_date (thedate numeric(6,0))
RETURNS DATE LANGUAGE SQL
BEGIN
RETURN date(substr(digits(thedate),1,2) || '/' || substr(digits(thedate),
3,2) || '/' || substr(digits(thedate),5,2));
END
New way:
select MMDDYY_TO_DATE(phdate) as podate from podet
inner join pohead on pipo=phpo where piprod = 4317140
23
24. DB2 and PHP: EssentialsSeiden Group
Stored procedures
• Most flexible.
• Multiple queries, resultsets, call RPG, SQL, all
sorts of logic, parameters
24
25. DB2 and PHP: EssentialsSeiden Group
Varchar/trim
• VARCHAR/Trim
§ Avoid extra spaces caused by fixed-length strings
§ <input type=text name='srvczip' size=9 value="43031 "
id="srvczip" maxlength="9">
• Extra spaces caused by CHAR (fixed length
strings)
• Use VARCHAR instead for automatic trimming
or trim(MyField) in SQL
25
26. DB2 and PHP: EssentialsSeiden Group
Web services
• DB2 can GET/POST HTTP
• Parse XML
• So DB2 can be a web service engine
• See my presentation on “PHP Tricks for RPG
developers”
26
28. DB2 and PHP: EssentialsSeiden Group
Choice of middleware to access DB2
• Zend Server includes at least three such
extensions:
• odbc
§ Less functionality than the others (generic)
§ “Free” connections from other platforms
• IBM_PDO
§ PDO = PHP Data Objects
§ Generic DB2. Experimental “/” separator and library lists
• ibm_db2
§ Provides IBM i-specific features such as library list support
28
29. DB2 and PHP: EssentialsSeiden Group
ibm_db2 documentation
• Manual page
§ http://php.net/ibm_db2
• Source code and additional documentation at the
“PECL” PHP extension repository
§ http://pecl.php.net/package/ibm_db2
§ Read the “C” source sometime—it’s educational
• We will examine ibm_db2 in detail today
29
31. DB2 and PHP: EssentialsSeiden Group
Connect with db2_connect()
• db2_connect() creates a database connection
§ Accepts four parameters that you should master
• Three string parameters
• One array of optional options
• resource db2_connect (string $database,
string $username,
string $password
[, array $options ])
• db2_pconnect() is similar
§ pconnect creates persistent connections (more on that later)
31
32. DB2 and PHP: EssentialsSeiden Group
db2_connect() string parameters
• $database
§ Leave blank ('') for default local database
§ Use a db name from WRKRDBDIRE for a choice of
databases
• Database name can be *LOCAL or that of an LPAR, IASP
(Independent auxiliary storage pool), or another machine
• $username
§ Leave blank ('') for default Apache user (QTMHHTTP)
• Not recommended
§ Use any valid user profile to associate queries with that user
• $password
§ Leave blank ('') if $database and $username were blank
§ Otherwise, provide password corresponding to $username
32
33. DB2 and PHP: EssentialsSeiden Group
db2_connect() basic examples
• Empty params
§ $conn = db2_connect('', '', '');
§ Connects to local database with web user QTMHHTTP
§ Not recommended: may be disallowed in future release
• Better: use specific values
§ $conn = db2_connect('MYDB', 'MYUSER',
'MYPASS');
§ Connects to MYDB database (must be configured in
WRKRDBDIRE) with user MYUSER
33
34. DB2 and PHP: EssentialsSeiden Group
How to connect to remote DB or iASP
•Connect to another partition, server, or iASP as if local
•Useful for testing PHP scripts against databases of
multiple partitions (dev/test/production)
•Example: remote server is at IP 1.2.3.4 and has database
named SANJOSE
•We will refer to it on our box with alias “DEVBOX”
•Use WRKRDBDIRE (Work with Relational Database
Directory Entries) to create local alias to remote database
34
35. DB2 and PHP: EssentialsSeiden Group
WRKRDBDIRE to set up alias
35
36. DB2 and PHP: EssentialsSeiden Group
Now we can access “DEVBOX” database
• User and password must be correct for the remote
database
$db = db2_connect('DEVBOX', 'DEVUSER', 'DEVPWD');
36
37. DB2 and PHP: EssentialsSeiden Group
Fourth parameter (array $options)
• Optional array to fine-tune the connection
• Below are choices that are most relevant for IBM i
• Details as we go
• i5_lib
• Set a single default library
• i5_naming
• Choose “system” or SQL naming
• i5_libl
• Set a library list (be sure to set i5_naming on)
• i5_commit
• Commitment control options
• autocommit
• DB2_AUTOCOMMIT_ON (default) or _OFF
37
38. DB2 and PHP: EssentialsSeiden Group
i5_lib
• Specify one library as default
§ 'i5_lib'=>'MYLIB'
• Any unqualified files/tables will be assumed to use
this library
38
39. DB2 and PHP: EssentialsSeiden Group
i5_naming for library lists
• DB2_I5_NAMING_ON
§ A constant equal to 1 that turns on “system naming” mode
§ Table files qualified using the slash (/) delimiter
§ Unqualified files are resolved using the library list for the job
• DB2_I5_NAMING_OFF
§ A constant equal to 0 (default) that enables “SQL naming”
mode
§ Table files qualified using the period (.) delimiter
§ Unqualified files are resolved using either the default library
(i5_lib) or the user profile name specified on db2_connect()
(could be QTMHHTTP)
• Message to watch for:
MYTABLE in YOURNAME type *FILE not found.
SQLCODE=-204”
39
41. DB2 and PHP: EssentialsSeiden Group
Three techniques (1 of 3)
• Small number of "system" user profiles. One user per
library list. When "real" user signs in, authenticate against
a database, LDAP, etc. Not against user profile list
41
42. DB2 and PHP: EssentialsSeiden Group
Three techniques (2 of 3)
• db2_connect with real user profile
§ user can get disabled when wrong password is
entered
§ revealing an actual user profile to end users (OK for
internal. security problem if external)
§ benefit: authority, program logic, journal entries will
work with "real" IBM i user profile
• db2_pconnect works the same except that the jobs stay
semi-active, visible to operator
42
43. DB2 and PHP: EssentialsSeiden Group
Three techniques (3 of 3)
• db2_pconnect with generic "system" profile but then
switch to "real" profile after authentication
• fast connection
• limits number of active jobs
• performance cost of the "switch"
• security concerns about mixed generic/specific user
profile attributes/authority in a job
• need to "switch back" afterward
43
48. DB2 and PHP: EssentialsSeiden Group
Assure data integrity
•Commitment control allows “all or none” logic when
running multiple update/insert/delete queries
•If one query fails, roll back previous related queries
•Example: If a detail record update fails, roll back the
header update
•Requires that journaling be enabled on files/tables
being written to
48
49. DB2 and PHP: EssentialsSeiden Group
Use commitment control for data integrity
•Example: “all or none” for two INSERTS
§ with ibm_db2.i5_allow_commit = 1
§ and autocommit = DB2_AUTOCOMMIT_OFF
$conn = db2_pconnect('', '', '', array('autocommit'=>DB2_AUTOCOMMIT_OFF));
$stmt=db2_prepare($conn,"INSERT INTO MYTABLE (IDNUM, NAME) VALUES(?, ?)");
$result1 = db2_execute($stmt, array(1, 'jane')); // should insert OK
$result2 = db2_execute($stmt, array('x', 'bob')); // not numeric!
// check if both INSERTs succeeded
if ($result1 && $result2) {
// Success. Commit both inserts
db2_commit($conn);
} else {
// *** Error with one of the inserts; roll them both back ***
db2_rollback($conn);
}
// Neither record will be in the table. We rolled back.
49
50. DB2 and PHP: EssentialsSeiden Group
i5_commit
•i5_commit
§ Options for isolation level
§ Gives you fine-grained control (and ability to turn off altogether)
§ Before Zend Server 8.5, must also enable commitment control
system-wide
• ibm_db2.i5_allow_commit = 1 in INI file
§ Choices:
• DB2_I5_TXN_NO_COMMIT – turns off commitment control for this
connection
• DB2_I5_TXN_READ_UNCOMMITTED
• DB2_I5_TXN_READ_COMMITTED
• DB2_I5_TXN_REPEATABLE_READ
• DB2_I5_TXN_SERIALIZABLE
50
51. DB2 and PHP: EssentialsSeiden Group
autocommit
• DB2_AUTOCOMMIT_ON
§ A constant equal to 1 (default)
§ Turns autocommit on
• End of script causes commit
§ Only relevant when commitment control is used
§ Convenient: insert/update/delete will work without db2_commit()
• DB2_AUTOCOMMIT_OFF
§ A constant equal to 0
§ Turns autocommit off
§ Only relevant when commitment control is used
§ Provides flexibility to ensure data integrity in multi-step transactions by
using db2_commit()/db2_rollback() around groups of insert/update/
delete queries
51
52. DB2 and PHP: EssentialsSeiden Group
Commitment control tips
•In php.ini:
§ To use commitment control before 1.9.6-sg25, set
ibm_db2.i5_allow_commit = 1
•In db2_connect() option array:
§ Modify default settings with ‘i5_commit’ option
§ Choose ‘autocommit’ on or off
•Turn on journaling for schemas (libraries)
§ Already on if schema created via “CREATE SCHEMA” (SQL/DDL)
§ Extra step needed for libraries created via CRTLIB
• Start Journal Library (STRJRNLIB, v6.1+) makes a library a journaled
object. Any objects eligible to be journaled that are added to the library
can be automatically journaled
• http://www.redbooks.ibm.com/abstracts/tips0662.html
52
53. DB2 and PHP: EssentialsSeiden Group
More about db2_connect, db2_pconnect
•Manual pages
§http://www.php.net/manual/en/function.db2-
connect.php
§http://www.php.net/manual/en/function.db2-
pconnect.php
§http://www.php.net/manual/en/features.persistent-
connections.php
53
56. DB2 and PHP: EssentialsSeiden Group
“Prepared” = safe and fast
•Prepared queries help in several ways
§ Eliminate errors due to un-escaped single quotes
§ Protect your data from SQL Injection attacks
§ Speed up repeated queries
•They are also known as prepared statements
• Here’s an example of the mischief they prevent
56
57. DB2 and PHP: EssentialsSeiden Group
Apostrophes confuse query parsers
// mysite.com?name=whatever
$name = $_GET['name'];
$sql = "select custno from custfile
where name = '$name' and status = 'ACTIVE' ";
• Do you see any potential problems?
• What if the name is “O’Shea” ? Error!
$sql = "select custno from custfile
where name = 'O'Shea' and status = 'ACTIVE' ";
• Single quotes confuse query parser when they serve two purposes
§ Used as apostrophe in data
§ Delimiter of string literals in the SQL syntax
57
58. DB2 and PHP: EssentialsSeiden Group
Malicious users can try “SQL Injection”
// mysite.com?name=whatever
$name = $_GET['name'];
$sql = "select custno from custfile
where name = '$name' and status = 'ACTIVE' ";
• What if the name is the weird-looking “x' OR 1=1--”
(That is, a user typed: mysite.com?name=x' OR 1=1-- )
$sql = "select custno from custfile
where name = 'x' OR 1=1--' and status = 'ACTIVE' ";
• Every record in the table will be selected
§ OR 1=1 will always be true
§ -- turns subsequent ‘where’ criteria into a comment (ignored!)
58
59. DB2 and PHP: EssentialsSeiden Group
Safeguard data with prepared queries
// mysite.com?name=whatever
$name = $_GET['name'];
$sql = "select custno from custfile
where name = ? and status = 'ACTIVE' ";
•Represent parameters with question marks (?)
instead of literal values
•It’s fine to retain hard-coded values in the query
§ Such as ‘ACTIVE’ in the example above
•Supply parameters in an array
§ $params = array(“O'Shea”);
•Full example on next slide
59
60. DB2 and PHP: EssentialsSeiden Group
db2_prepare() with db2_execute()
$name = $_GET['name'];
$conn = db2_connect('','','');
$sql = "select custno from custfile
where name = ? and status = 'ACTIVE' ";
$params = array($name); // can be "O'Shea" for all we care
$stmt = db2_prepare($conn, $sql);
if ($stmt) { // prepared OK
$result = db2_execute($stmt, $params);
if ($result) { // ran query OK with parameters
while ($row = db2_fetch_assoc($stmt)) {
echo "$row['custno']n";
}
}
}
60
61. DB2 and PHP: EssentialsSeiden Group
Ordinary db2_exec() re-calcs plan
•Ex. of non-prepared SQL repeated with different params
$values = array('acme', 'shoprite', 'stop n shop');
foreach ($values as $value) {
$sql = "select custno from custfile
where name = '$value' and status = 'ACTIVE' ";
// query gets re-optimized in each iteration
$stmt = db2_exec($conn, $sql);
if ($stmt) { // do something with $stmt }
}
•The query plan will re-optimize on each db2_exec()
because a new SQL string was supplied each time
•OK for one-off queries but not when repeated
61
62. DB2 and PHP: EssentialsSeiden Group
Prepared statement allows re-use of plan
•Ex. of prepared SQL; execution with different params
// prepare the query ONCE
$sql = "select custno from custfile
where name = ? and status = 'ACTIVE' ";
$stmt = db2_prepare($conn, $sql);
// now execute with values only
$values = array('acme', 'shoprite', 'stop n shop');
foreach ($values as $value) {
$result = db2_execute($stmt, array($value));
if $result {// do something with $stmt }
}
•The query plan is calculated ONCE and reused with
each db2_execute(), saving time and CPU
62
63. DB2 and PHP: EssentialsSeiden Group
Prepared statements/queries are best
•Replace db2_exec() with
db2_prepare() and db2_execute()
•Benefits
§ Queries will run as intended, with fewer surprises
§ Protection from a common form of hacking (SQL injection)
§ Performance will improve for repeated queries
63
65. DB2 and PHP: EssentialsSeiden Group
New security technique
•Row and Column Access Control (RCAC)
•In IBM i 7.2+
•Implemented via additional SQL “WHERE” clauses and more
•Row control: limit what rows can be selected, at the
database level, depending on the user or any other
criteria
•Column Access: mask or manipulate columns at the
database level
•Will restrict in all applications
•More info
•http://www.ibmsystemsmag.com/Blogs/i-Can/September-2014/IBM-
i-7-2---Protect-Data-With-RCAC/
65
67. DB2 and PHP: EssentialsSeiden Group
Functions to get error codes/messages
•db2_conn_error() connection error code
•db2_conn_errormsg() connection error text
•db2_stmt_error() prepare/execute error code
•db2_stmt_errormsg() prepare/execute error text
67
68. DB2 and PHP: EssentialsSeiden Group
Connections return a resource or false
$conn = db2_connect("*LOCAL", "MYUSER", "BADPASS");
// test for false
if (!$conn) {
echo "Connection failed. SQL Err: ";
echo db2_conn_error() . "<br>";
echo db2_conn_errormsg();
die();
} else {
// use the connection....
}
An incorrect password will generate this output:
Connection failed. SQL Err: 08001
Authorization failure on distributed database
connection attempt. SQLCODE=-30082
68
69. DB2 and PHP: EssentialsSeiden Group
Prepare/execute: resource or false
$sql = "SELECT * FROM BADLIB.SP_CUST WHERE CUST_ID > ?";
$stmt= db2_prepare($conn, $sql);
if (!$stmt) {
echo 'The db2 prepare failed. ';
echo 'SQLSTATE value: ' . db2_stmt_error() . '<BR>';
echo ' Message: ' . db2_stmt_errormsg();
}
The error code and message might resemble:
SQLSTATE value: 42704
Message: SP_CUST in BADLIB type *FILE not found.
SQLCODE=-204
69
70. DB2 and PHP: EssentialsSeiden Group
Other trace/debug ideas
Advanced use only: special libdb400 tracing driver:
http://yips.idevcloud.com/wiki/index.php/PASE/Service
70
72. DB2 and PHP: EssentialsSeiden Group
Prestart jobs in QSYSWRK by default
DB2 queries run in separate prestart jobs
72
73. DB2 and PHP: EssentialsSeiden Group
Prestart job optimization
• QSQSRVR prestart jobs run in QSYSWRK
• Or, if remote DRDA, QRWTSRVR in QUSRWRK
• Configurable pool of jobs
CHGPJE SBSD(QSYS/QSYSWRK) PGM(QSYS/QSQSRVR)
STRJOBS(*YES) INLJOBS(xx) THRESHOLD(xx)
ADLJOBS(xx) MAXUSE(xx or *NOMAX)
• More on prestart db2 jobs and “server mode”
§ http://www.redbooks.ibm.com/abstracts/tips0658.html
§ http://www.mcpressonline.com/tips-techniques/database/techtip-
grab-control-of-the-db2-qsqsrvr-jobs.html
§ http://www.mcpressonline.com/database/db2/finding-sql-server-
mode-connecting-jobs.html
73
75. DB2 and PHP: EssentialsSeiden Group
db2_free_result() clears “pseudo locks”
•In persistent mode, SELECT statements can cause
*SHRRD (shared read) pseudo locks
§ See them in QSQSRVR jobs via the WRKOBJLCK command
• Pseudo locks help retain performance-enhancing cursors
• Normally, CLRPFM and other exclusive ops will clear the locks
•If exclusive operations on your ‘i’ occur while your
script is active, use db2_free_result() to release
cursors
$stmt=db2_exec($conn,"SELECT * FROM MYTABLE");
while($row=db2_fetch_array($stmt)) {
echo "n<br>";
var_dump($row);
}
db2_free_result ($stmt); // allow exclusive ops
75
76. DB2 and PHP: EssentialsSeiden Group
Another way to clear “pseudo locks”
•If persistent connections create “shared read locks”
Run this command in your CL job stream before nightly exclusive
lock attempts.
ALCOBJ OBJ((MYLIB/MYFILE *FILE *EXCL *N))
CONFLICT(*RQSRLS)
if a member:
ALCOBJ OBJ((MYLIB/MYFILE *FILE *EXCL MYMEMBER))
CONFLICT(*RQSRLS)
Make sure you add a MONMSG immediately after the ALCOBJ
command to handle any messages such as "cannot allocate..."
which may arise normally.
76
78. DB2 and PHP: EssentialsSeiden Group
Most efficient way to set library list
• Let IBM i set library list based on user profile
§ No extra program calls required
• Use a user profile that has an “initial library list” in its
job description (JOBD)
• Specify the user profile and i5_naming=ON
§ $conn = db2_connect('*LOCAL', 'LIBLUSER', 'PASS',
array('i5_naming' => DB2_I5_NAMING_ON));
78
79. DB2 and PHP: EssentialsSeiden Group
“JOBD” technique in detail
Create jobd:
CRTJOBD JOBD(QGPL/APPROD)
INLLIBL(LIB1 LIB2 LIB3 QGPL)
Set jobd in user profile (or create new profile):
CHGUSRPRF USRPRF(APPRODUSR)
JOBD(QGPL/APPROD)
•In PHP, specify the user profile and i5_naming=ON
§ $conn = db2_connect('*LOCAL', 'LIBLUSER', ‘PASS’,
array('i5_naming' => DB2_I5_NAMING_ON));
79
80. DB2 and PHP: EssentialsSeiden Group
Middle ground: i5_libl
•$options array accepts 'i5_libl'
• i5_libl is a space-delimited library list
§ 'i5_libl'=>'MYLIB YOURLIB ANYLIB’
•Causes ibm_db2 to run CHGLIBL at the middleware
level
•Example:
§ $conn = db2_connect('*LOCAL' ,'MYUSER', 'MYPASS',
array('i5_naming' => DB2_I5_NAMING_ON,
'i5_libl' => 'MYLIB1 MYLIB2’));
•Note: with persistent connections, CHGLIBL only run
the first time in, so be sure to distinguish different jobs
by user profile
80
81. DB2 and PHP: EssentialsSeiden Group
More work but most flexible
•If maximum flexibility required:
§ Run a command or program that sets up library list
§ Use CHGLIBL instead of ADDLIBLE
§ ADDLIBLE could generate “already in library list” error,
causing toolkit to retrieve joblog (slow)
$db = db2_connect(‘*LOCAL', 'MYUSER', 'MYPASS',
array('i5_naming' => DB2_I5_NAMING_ON));
// connect to toolkit using existing DB2 conn
$tkitConn = ToolkitService::getInstance($db,
DB2_I5_NAMING_ON);
// toolkit will share job with DB2
$tkitConn->setOptions(array('stateless' => true));
$tkitConn->CLCommand('CHGLIBL LIBL(NXSRTQA QGPL
QTEMP)');
81
82. DB2 and PHP: EssentialsSeiden Group
db2_connect() example with $options
$database = 'MYDB';
$user = 'MYUSER';
$password = 'MYPASS';
$options = array('i5_naming' => DB2_I5_NAMING_ON,
'i5_libl' => 'MYLIB1 MYLIB2'
);
$conn = db2_connect($database, $user, $password, $options);
if ($conn) {
echo "Connection succeeded.";
} else {
echo "Connection failed.";
}
// MYTABLE will be found, if in library MYLIB1 or MYLIB2
$stmt=db2_exec($conn,"SELECT * FROM MYTABLE");
82
84. DB2 and PHP: EssentialsSeiden Group
Config file(s) for ibm_db2
•ibm_db2.ini
•Main location for these settings
•/usr/local/zendsvr6/etc/conf.d/ibm_db2.ini
•A small file containing only ibm_db2 settings
•Initial contents:
extension=ibm_db2.so
•php.ini
•Less common location
•/usr/local/zendsvr6/etc/php.ini
•Large file containing hundreds of settings
•Add or modify settings under the section [ibm_db2]
84
85. DB2 and PHP: EssentialsSeiden Group
New ibm_db2 config options
• Shipped since Zend Server 7
• See change log for news
• http://www.youngiprofessionals.com/wiki/index.php/
XMLSERVICE/PHPDB2ChangeLog
• Highlights coming right up
85
86. DB2 and PHP: EssentialsSeiden Group
Highlights new (slide 1 of 2)
Setting Default What it does
ibm_db2.i5_sys_naming 0,1 1 enables library lists by
default (even in LUW DB2
Connect 10.5)
ibm_db2.i5_blank_userid 0,1 When 0, blank user id/
password become invalid
ibm_db2.i5_max_pconnect 0-n Cleans up persistent
QSQSRVR jobs every so
many connections
ibm_db2.i5_check_pconnect 0-4 Checks pconnect job. 0
means no test; 1-4
progressively more
robust to test for a valid
connection. If connection
invalid, reconnect fresh
86
87. DB2 and PHP: EssentialsSeiden Group
Highlights new (slide 2 of 2)
Setting Values What it does
ibm_db2.i5_log_verbose 0,1 Log DB2 errors in /usr/local/
zendsvr(6)/var/logs/php.log
Alan recommends 1
ibm_db2.
i5_servermode_subsystem
[empty],
*SAME,
subsystem
(QSYSWRK)
Exposes connection
attribute SQL_ATTR_
SERVERMODE_
SUBSYSTEM to specify
subsystem for
QSQSRVR jobs
ibm_db2.i5_guard_profile 0,1 Restore job’s original
“current user” at end of
PHP request (this feature
subject to change)
87
88. DB2 and PHP: EssentialsSeiden Group
Alan’s recommended settings
/usr/local/zendsvr6/etc/conf.d/ibm_db2.ini
extension=ibm_db2.so
; log db2 errors in PHP error log
ibm_db2.i5_log_verbose=1
; Reset persistent connection after every 200
connection requests
ibm_db2.i5_max_pconnect=200
; Quick check on each pconnect (conn. alive)
ibm_db2.i5_check_pconnect=1
88
89. DB2 and PHP: EssentialsSeiden Group
Defaults you may wish to change
/usr/local/zendsvr6/etc/conf.d/ibm_db2.ini
; no commitment control
ibm_db2.i5_allow_commit=0
; allow blank user/pw (change to 0 if you can)
ibm_db2.i5_blank_userid=1
89
91. DB2 and PHP: EssentialsSeiden Group
“How do I develop on non-i, deploy on i?”
•Developer goal:
§ Develop IBM i-based PHP code on a non-i machine (Linux,
Windows)
§ Connect to DB2 on IBM i using code that will also work on ‘i’
later in production
•Requires a separate product from IBM
91
92. DB2 and PHP: EssentialsSeiden Group
IBM DB2 Connect from Windows/Linux
•Purchase IBM’s “DB2 Connect”
• http://www-01.ibm.com/software/data/db2/db2connect
• Not free. We’ll see how this develops (no more Personal Edition)
•Your non-i computer will host a local “dummy” DB2
database that actually accesses DB2 on your IBM i
• Use the same ibm_db2 functions that you normally do
• Configuration tips: http://yips.idevcloud.com/wiki/index.php/Tier2/
DB2Connect
•Library lists (system naming) available in DB2
Connect 10.5 on IBM i 7.1+
92
93. DB2 and PHP: EssentialsSeiden Group
ODBC alternative to DB2 Connect
•ODBC: no charge
•ODBC not optimized for IBM i, not actively
maintained/supported
•Some have had success with it
•I don’t recommend for mission-critical systems but
you are welcome to try it, especially if your software
already supports ODBC
•Less portable than DB2 Connect in moving app to/
from IBM i
93
95. DB2 and PHP: EssentialsSeiden Group
Email from a PHP fan
“I’ve run into a little problem with DB2. I’m used to being
able to use the LIMIT option in MySQL to set a range of
records I want to view, perhaps the 20-29 records for
instance.
“Could you tell me if there is or is not a way to do that on
IBM i? My boss and I are beginning to think that such an
option does not exist for use on the AS400 IBM i.”
• Yes, it can be done via a choice of two techniques
• Useful for pagination (page-at-a-time logic)
• LIMIT and OFFSET are non-standard, not in DB2
95
96. DB2 and PHP: EssentialsSeiden Group
1. ibm_db2 middleware technique
// specify DB2_SCROLLABLE in db2_exec or db2_execute
$startingRow = 20;
$endingRow = 29;
$stmt = db2_execute($stmt,
array('cursor' => DB2_SCROLLABLE));
$currentRow = $startingRow;
while (($currentRow <= $endingRow) &&
$row = db2_fetch_array($stmt, $currentRow)) {
print "$row[0]n";
$currentRow++;
}
Note additional param for row number:
array db2_fetch_array ( resource $stmt [, int $row_number = -1 ] )
Disadvantage: middleware-dependent (only works with ibm_db2)
96
97. DB2 and PHP: EssentialsSeiden Group
2. SQL technique
• DB2’s row_number() and over() functions can select
records by number in a recordset
• This simulates LIMIT and OFFSET
• Example coming up
97
98. DB2 and PHP: EssentialsSeiden Group
Record range selection in DB2
Start with this:
$queryString = "SELECT CUST_ID, COMPANY FROM SP_CUST
order by CUST_ID”
Use row_number() and over() to limit the record selection:
$queryString = "SELECT CUST_ID, COMPANY FROM
(select row_number() over (order by CUST_ID) as rowid,
CUST_ID, COMPANY
from SP_CUST) as t
where t.rowid between 20 and 29";
98
99. DB2 and PHP: EssentialsSeiden Group
Or let Zend Framework handle it
•Use ZF’s Zend Db component from regular PHP
•Builds SQL, hiding complexity of LIMIT/OFFSET
implementation, with cross-database code
•Full script: https://github.com/alanseiden/Code-
Examples/blob/master/IBMi/DB2/ZF2LimitOffset.php
// works with v2.3.2 of ZF2.
$sql = new Sql($adapter);
$select = $sql->select();
$select->from('SP_CUST')
->where('CUST_ID > 1220')
->order('CUST_ID ASC')
->limit(10)
->offset(20);
99
100. DB2 and PHP: EssentialsSeiden Group
Sample DB2 on i pagination script
coded by Zend’s Clark Everetts
https://github.com/clarkphp/Code-Examples/tree/master/
IBMi/pagination
100
101. DB2 and PHP: EssentialsSeiden Group
3. “Real” LIMIT and OFFSET
• New: LIMIT and OFFSET support in TR11 (7.1) and
TR3 (7.2)
• https://www.ibm.com/developerworks/community/
wikis/home?lang=en#!/wiki/IBM%20i%20Technology
%20Updates/page/OFFSET%20and%20LIMIT
• Coming soon in those Technology Refreshes
• From Scott Forstie’s wiki page:
• LIMIT: alternative to FETCH FIRST x ROWS ONLY
• OFFSET: skip rows in the query result
101
102. DB2 and PHP: EssentialsSeiden Group
Stored procedure from Scott Forstie
102
104. DB2 and PHP: EssentialsSeiden Group
Performance tips
•Use persistent connections (see next slides)
•Optimize SQL
§ A few specific tips (there are so many ways):
• Avoid scalar functions (such as UPPER) in WHERE clause
• OPTIMIZE FOR n ROWS (when know how many rows)
• Check out IBM Rochester’s DB2 SQL performance class
•Index properly
§ Refer to Plan Cache and Index Advisor
§ Try Encoded Vector Indexes when appropriate
•System configuration
§ More memory, more memory!
§ Consider separate memory pool to keep data together
104
105. DB2 and PHP: EssentialsSeiden Group
DB2 query optimization
• IBM i has great tools
• I’ll share a couple of favorites
‣ Index Advisor
‣ SQL Plan Cache
• See IBM’s book
• IBM i Database Performance and Query Optimization
• http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/rzajq/
rzajq.pdf
105
106. DB2 and PHP: EssentialsSeiden Group
Index Advisor
• Recommends indexes across all queries
• Now in web-based Navigator as well as thick client
106
107. DB2 and PHP: EssentialsSeiden Group
SQL Plan Cache
• Lets you see what queries are REALLY running,
who’s running them, and how long they take
107
108. DB2 and PHP: EssentialsSeiden Group
Persistent connections
•Create a pool of database jobs
•Known as a “connection pool”
•You will connect quickly because a job is waiting for you
•DB2 will...
• Choose a QSQSRVR job when your PHP job first connects
• Create new jobs to handle high workload
•The word “persistent” may be misleading
•No guarantee that a browser session reconnects to same job
•Between requests, cannot rely on maintaining state (QTEMP,
library lists). OK within a request, though
108
109. DB2 and PHP: EssentialsSeiden Group
db2_pconnect() to connect persistently
•resource db2_pconnect ( string $database , string
$username , string $password [, array $options ] )
•Persistent is much faster than non-persistent
§ db2_pconnect can reuse connections, reducing the time needed
to connect (after the first time) to almost zero
§ SQL statement objects can also be reused, speeding queries
•How db2_pconnect() reuses connections
§ Connections defined by database, username, and password
§ Tries to reuse an existing connection matching these 3 params
§ db2_close() on a persistent connection does nothing
§ db2_pclose() forces the conn to close
109
111. DB2 and PHP: EssentialsSeiden Group
There’s more than STRSQL
•Operations Navigator (old reliable, but Windows only)
•Web-based navigator
§ Starting to get quite good, with Run SQL window just added
§ http://myibmi:2001
§ IBM i Access
§ New client for Mac, Linux, Windows 10+
§ http://www-03.ibm.com/systems/power/software/i/access/
•Other tools such as SQL Workbench/J, Data Studio
§ http://www.sql-workbench.net/, https://www.ibm.com/
developerworks/ibmi/library/i-debugger-db2-i/
111
112. DB2 and PHP: EssentialsSeiden Group
SQL Workbench/J
112
113. DB2 and PHP: EssentialsSeiden Group
SQL Workbench/J
113
115. DB2 and PHP: EssentialsSeiden Group
CCSID is magical (when it works)
•Coded Character Set Identifier (CCSID) helps convert
data from EBCDIC to ASCII
•DB2 operates in multiple language environments
§ Each human language requires a different conversion
•CCSIDs are listed here
§ http://www-01.ibm.com/software/globalization/ccsid/ccsid_registered.html
•I use CCSID 37, good for USA, Canada, Netherlands,
Portugal, Brazil, Australia, New Zealand
115
116. DB2 and PHP: EssentialsSeiden Group
Default CCSID of 65535 can cause trouble
•QCCSID value is 65535 by default
•65535 means to treat data as hex or “binary,” not to be converted
•When a table/file has CCSID 65535, you get
gibberish
SELECT CUST from CUSTFILE WHERE ID = 1
•Result:
•$#%#%#(*#$
•A clue in a Zend Server startup message
•“The Zend Server Apache job CCSID is set to 65535. This setting
might have unpredictable results when accessing data base data.”
116
117. DB2 and PHP: EssentialsSeiden Group
Solutions (old and new)
•SQL Casting
§ CAST data to the proper EBCDIC CCSID, such as 37
§ Requires that you provide the data type such as char(6)
§ SELECT CAST(CUST as char(6) CCSID 37) FROM
CUSTFILE WHERE ID = 1
* Casting still required when CCSID explicitly set at field level (such as in older JDE systems)
•System-wide settings
§ CHGSYSVAL SYSVAL(QCCSID) VALUE(37)
• 37 is mine; yours will vary
• Often safe to change, but check with ERP vendor (e.g. JDE)
§ Add to Apache ZENDSVR configuration file
• /www/zendsvr/conf/httpd.conf
DefaultFsCCSID 37
CGIJobCCSID 37
117
118. DB2 and PHP: EssentialsSeiden Group
DB2 and PHP Resources
• IBM
§ IBM_DB2 manual and open source repository
• http://php.net/ibm_db2, http://pecl.php.net/package/ibm_db2
§ DeveloperWorks wiki
• http://ibm.com/developerworks/ibmi
§ Many details about PHP and DB2 connections
• http://www.youngiprofessionals.com/wiki/index.php/PHP/
DB2Connection
• Zend
§ Zend Server for IBM i
• http://www.zend.com/en/products/server/zend-server-ibm-i
§ Forums for PHP on IBM i
• http://forums.zend.com/viewforum.php?f=67
118
120. DB2 and PHP: EssentialsSeiden Group
For more info and learning
•DB2 for i SQL reference
•http://www-01.ibm.com/support/knowledgecenter/
ssw_ibm_i_72/db2/rbafzintro.htm?lang=en
•Young i PHP/Db2 page
•http://www.youngiprofessionals.com/wiki/index.php/PHP/
DB2Documents
•IBM DB2 forum
§ https://www.ibm.com/developerworks/community/forums/html/
forum?id=11111111-0000-0000-0000-000000000292&ps=50
120
122. DB2 and PHP: EssentialsSeiden Group
Contact and tips
Alan Seiden
Seiden Group
Ho-Ho-Kus, NJ
122
alan@seidengroup.com ● 201-447-2437 ● twitter: @alanseiden
Free newsletter:
http://seidengroup.com/tips
Please give feedback on this talk:
https://joind.in/talk/34c69