Home Accessibility Courses Twitter The Mouth Facebook Resources Site Map About Us Contact
For 2021 - online Python 3 training - see ((here)).

Our plans were to retire in summer 2020 and see the world, but Coronavirus has lead us into a lot of lockdown programming in Python 3 and PHP 7.
We can now offer tailored online training - small groups, real tutors - works really well for groups of 4 to 14 delegates. Anywhere in the world; course language English.

Please ask about private 'maintenance' training for Python 2, Tcl, Perl, PHP, Lua, etc.
More HowTo diagrams - MySQL, Tomcat and Java

Here are some more diagrams "off the wall" from last week - showing "howto" and "whatis" information for Tomcat, Java and MySQL

Some Tomcat and Java Fundamentals

On the right of the board ... the main java programs ...
• the Java compiler is called javac
• the Java Virtual machins is in a program called java
• the jar utility is used to bundle and unbundle lots of java files ("classes") and directories ("packages") and associated files too.
javap may be used to look inside a class file if you want to find what externally visible members it contains.

The following environment variables are ones you should know about ...
CLASSPATH which defines where you find Java classes
PATH for the path on which the operating system searches for programs
JAVA_HOME to tell Tomcat where it should Java

On the left of the board ... the crucial configuration files ...
server.xml to define the main server configuration
web.xml to define the base parameters for each web applications. Settings may be overridden by individual web.xml files within each applications.
tomcat-users.xml to define the access account to the Tomcat Manager and potentially to other applications too if your programmers have used the facility.

A diagram of Tomcat ...
A SERVER (outer box) runs a SERVICE (next box) on an ENGINE (next box) supporting a HOST (inner box). A number of connectors (red splodges on the left) give access in to the server / service, supporting different protocols with different metrics. Very often, a production server will have just two services running - a SHUTDOWN service which may or may not be on the default 8005 port, and either an http or an ajp service - common port number are 8080, 8082 and 8009.

Some other words that crop up ...
ant is a Java build tool - defining what has to be done to put together and install an application through a series of rules and dependencies. For those readers who have come across make, you may consider ant to be the Java equivalent.
jasper The class that runs in your Tomcat Engine and lets you run JSPs (Java Server Pages)
jikes The Just in Time Java Compiler ... rather than precompile everything, Just in Time technology lets you compile Java on the fly.

Want to learn more from me on this subject? - see here
Looking for more articles and examples? - see here

The Connector Story

The majority of users of the Tomcat server also run an Apache httpd web server to "front" it - for load balancing, logging, serving out static pages, providing PHP support on the same domain as Java, for security, and for other reasons. The way it typically works is that it's httpd which is providing the post that's visible to web clients (browsers) and then httpd acts as a client to the Tomcat server - it's rather like you calling up your telephone company and talking to a single individual on the phone, but that individual going off and talking to others and / or looking things up on systems to help get you the answer whether it's direct from the person you're talking to or not.

There are at last 8 ways of combining httpd and Tomcat, with new options developing over time, older ones being deprecated and even (in the case of jk) a method being deprecated and then recalled. This board tells the story - but the full story is told (and the practicals done) on the course.

If I summarise the story ... these days, you'll probably choose mod_proxy or mod_jk, each of which has its own metrics. In some specific circumstances, mod_rewrite comes into its own too (and mod_rewrite is a fabulous module for other things!

Want to learn more from me on this subject? - see here
Looking for more articles and examples? - see here

MySQL - release levels

MySQL was an excellent database produce even back at release 3.23 - that's when it really took off - but it has come a long way sense, right through to the MySQL company being bought by Sun Microsystems earlier this (2008) year for - we are told - 1 billion dollars.

This board summarises some of the metrics that have changed between the various releases, and some of the things that you (the person deploying them or programming for them) really should be aware of.

In olden days, data was held in a table format called isam which was replaced by myisam ... or rather myisam was added, as the MySQL team is very careful to maintain data integrity so the old ones will still work. MyISAM tables do not support transactions, which were added around release 4.0, together this InnoDb tables to support them. Stored procedures were added at release 5.

One of the most significant changes, though, was actually made between releases 4.0 and 4.1, when the drivers and in particular the security of passwords were beefed up. That's no bad thing in that the connection from the clients to the MySQL server is now better protected that it was, but it has the unfortunate side effect thatit means that you can upgrade your MySQL from a 4.0 or earlier release to a 4.1 or later release and find that you applications no longer work ... that you need to rebuild PHP for example! There ARE ways that you can instruct a recent MySQL to accept logins to specific accounts with the older and less secure passwords, which is an excellent short term fix, but that's going beyond the scope of this particular board.

Want to learn more from me on this subject? - see here
Looking for more articles and examples? - see here

Table Types in MySQL

The MySQL database supports a number of different table types (formats) which are listed here.

Isam Which are the oldest type, and now largely superseded by MyIsam which have better data integrity in the even of an unexpected system halt, and are portable in their binary format between bigendian and littleendian processor systems.
MyIsam The default table type - ideal for many straightforward applications, with the data held (but you should NOT access it directly!) in directories with the same name as the database, and in there in files with the same name as the table names.
Heap A memory based table, ideal for very quick access but limited as to the column types you may use, and lost on server restart.
bdb MySQL supports the Berkeley Database Format which allows you to use MySQL based applications to directly edit thinsg like NIS tables, mail aliases and the X Windows System colour tables.
InnoDb InnoDb tables are typically used for the more "meaty" applications. They're stored in large files which are preallocated to help with efficiency at the Operating System level, and provide the ability to checkpoint and rollback - so that's transaction processing. They have not taken over from MyISAM tables as they're more involved to set up / use / administer, and some of the locking issues can leave them as being less rather than more practical in some circumstances.
Cluster A highly specialised, memory based table type which (I hope) you'll not come across in your typical, day to day, use of MySQL. I understand it's designed for telephoney switching applications ...

Want to learn more from me on this subject? - see here
Looking for more articles and examples? - see here

A balancing scheme for servers. Also MySQL account strategys

The upper diagram on this page shows a scheme for load balancing (rather than clustering!) between a series of near-identically configured servers. All users of the web site contact httpd on the leftmost box, which farms out the heavy work to Tomcat instances on the following boxes. The Tomcat instances do MySQL selects (i.e. read from the database) on their own box, but save any changes back to the rightmost box. Finally, the MySQL master is on the rightmost box, with slave servers handing off it on all the other boxes.

For a read-mostly application (and this scheme was drawn up for such!) this is a good solution. For low traffic installations it can all work on one box, but that can be widened out as need be. In terms of system failure and recovery, the MySQL master / client scheme allows for easy failower, and in terms of all the http traffic coming in at the front, you could use a heartbeat script on the second (and other) machines to keep track, or an extra balancer.

The lower diagram shows the authorisation levels for a MySQL account:
• Accounts have global permissions over all databases granted in the user table in the mysql database, plus
• Permissions of a per database basis granted in the db table plus
• per-table permissions plus
• per-column permissions.

Since some permission types simply don't apply once you get down to the more limited scopes, there are a large number of possible permissions than can be granted globally, reducing to just a few on a per column basis. Remember that the permissions granted in each of the categories are ADDATIVE so that if some one is granted select_priv in the user table they can read anything being served, even if select_priv is turned off to them for specific databases.

Want to learn more from me on this subject? - see here
Looking for more articles and examples? - see here

One distribution for three separate computers

The MySQL distribution includes the Mysql daemon (mysqld) which you'll want to install on your database server computer, the MySQL client programs which you may want to install on your own desktop, and the libraries that you may need to have on your web server prior to building PHP. You may be a little suprised that all three come in the same download / distribution and wonder why they're not separated my view is that actually the MySQL folks have made the right decision on this one - it just needs a wee bit of explanation.

The board goes on to show you how the various elements work together, and how the daemon provides a "gatehouse" through which all database accesses must be made. Within the data compound, you'll see a division into a series of databases, with a number of tables within each of them.

Did you notice the file names /etc/my.cnf and ~/.my.cnf also on the board? MySQL is a database product and keeps the majority of its configuration information internally within its tables (if it didn't could well make a comment about having a dog and barking yourself). However, a handful of parameters are needed before the daemon and its client programs can actually reach the data - and those parameters go into a file called /etc/my.cnf (system wide) or .my.cnf in each user's home directory for each parameter that's set on a peruser basis.

Want to learn more from me on this subject? - see here
Looking for more articles and examples? - see here

Are these diagrams useful? They're the second (and final) instalment of a set - and youcan find the first instalment here
(written 2008-08-24)

Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
S154 - MySQL - Designing an SQL Database System
  [59] MySQL - Pivot tables - (2004-09-22)
  [361] Binary Large Objects or bars - (2005-06-27)
  [375] Oops - I got my initial database design wrong - (2005-07-12)
  [494] MySQL - a score of things to remember - (2005-11-12)
  [515] MySQL - an FAQ - (2005-12-03)
  [666] Database design - get it right from first principles - (2006-04-02)
  [918] Databases needn't be frightening, hard or expensive - (2006-11-08)
  [937] Display an image from a MySQL database in a web page via PHP - (2006-11-22)
  [945] Code quality counts - (2006-11-26)
  [1423] MySQL - table design and initial testing example - (2007-11-06)
  [1575] Database design for a shopping application (MySQL) - (2008-03-15)
  [2053] What a difference a MySQL Index made - (2009-02-25)
  [2085] MySQL - licensing issues, even with using the name - (2009-03-16)
  [2204] Images in a database? How big is a database? (MySQL) - (2009-05-28)
  [2749] Delegate Question - defining MySQL table relationships as you create the tables - (2010-05-02)
  [3270] SQL - Data v Metadata, and the various stages of data selection - (2011-04-29)
  [3361] Blowing our own trumpet - MySQL resources - (2011-07-18)
  [3494] Databases - when to treat the rules as guidelines - (2011-10-23)
  [4426] FileMaker Day to Unix Time conversion - (2015-02-15)

S153 - Sourcing, Running and Configuring MySQL
  [192] Current MySQL and PHP paths and upgrades - (2005-01-28)
  [334] Symbolic links and hard links - (2005-06-02)
  [489] Which MySQL server am I using? - (2005-11-07)
  [535] MySQL permissions and privileges - (2005-12-20)
  [591] Key facts - SQL and MySQL - (2006-02-04)
  [907] Browser -> httpd -> Tomcat -> MySQL. Restarting. - (2006-10-28)
  [1095] Apache httpd , browser, MySQL and MySQL client downloads - (2007-02-28)
  [1123] mysqldump and mysqlrestore - (2007-03-30)
  [1131] MySQL - Password security (authentication protocol) - (2007-04-02)
  [1689] Some sideways thoughts on the news - (2008-06-27)
  [1731] Apache httpd, MySQL, PHP - installation procedure - (2008-08-01)
  [1935] Summary of MySQL installation on a Linux system - (2008-12-11)
  [2209] Monitoring and Tuning your MySQL installation - (2009-05-31)
  [2426] Which version of MySQL am I running? - (2009-09-26)
  [2444] Potted MySQL installation - (2009-10-09)
  [2445] Securing MySQL on a production server - (2009-10-09)
  [2458] Cant connect to local MySQL server through socket /tmp/mysql.sock - (2009-10-17)
  [4390] Checking MySQL database backups have worked (not failed) - (2015-01-10)
  [4406] Fixing damaged MySQL tables - Error 1712 and Error 2013 - (2015-01-25)
  [4487] Starting MySQL. ERROR! The server quit without updating PID file - how we fixed it. - (2015-05-06)

A690 - Web Application Deployment - Clustering and load balancing
  [934] Clustering, load balancing, mod_rewrite and mod_proxy - (2006-11-21)
  [1121] Sharing the load with Apache httpd and perhaps Tomcat - (2007-03-29)
  [1993] Load Balancing - Hardware or Software? - (2009-01-15)
  [1995] Automated server heartbeat and health check - (2009-01-16)
  [2059] Sharing the load between servers - httpd and Tomcat - (2009-02-28)
  [2482] Load balancing with sticky sessions (httpd / Tomcat) - (2009-10-29)
  [2483] Clustering on Tomcat - (2009-10-30)
  [3293] Distributing the server load - yet ensuring that each user return to the same system (Apache httpd and Tomcat) - (2011-05-18)
  [3339] Simplest ever proxy configuration? - (2011-06-28)
  [3892] Distributed, Balanced and Clustered Load Sharing - the difference - (2012-10-13)
  [4432] Java web application for teaching - now with sessions and clustering / load balancing demonstrations - (2015-02-20)

A655 - Web Application Deployment - Using Tomcat and Apache httpd Together
  [436] Linking Apache httpd to Apache Tomcat - (2005-09-05)
  [576] Why run two different web servers - (2006-01-25)
  [631] Apache httpd to Tomcat - jk v proxy - (2006-03-03)
  [1376] Choosing between mod_proxy and mod_rewrite - (2007-10-02)
  [1383] Monitoring mod_jk and how it is load balancing - (2007-10-07)
  [1549] http, https and ajp - comparison and choice - (2008-02-22)
  [1552] Extra public classes in deploying Apache httpd and Tomcat - (2008-02-24)
  [1938] Predictive Load Balancing - PHP and / or Java - (2008-12-13)
  [1940] URL rewriting with front and back servers - (2008-12-14)
  [1944] Forwarding session and cookie requests from httpd to Tomcat - (2008-12-14)
  [3018] Tuning Apache httpd and Tomcat to work well together - (2010-10-27)
  [3999] Handling failures / absences of your backend server nicely - (2013-02-08)

A651 - Web Application Deployment - Tomcat Overview
  [49] Business is the predominant user of Tomcat, Perl and Tcl - (2004-09-15)
  [498] Why is Tomcat called Tomcat? - (2005-11-17)
  [659] Web Application Components - (2006-03-28)
  [1265] Apache, Tomcat, Jakarta, httpd, web server - what are they? - (2007-07-13)
  [1941] Server - Service - Engine - Host, Tomcat - (2008-12-14)
  [2016] Apache httpd and Apache Tomcat miscellany - (2009-01-30)
  [2077] Why put Apache httpd in front of Apache Tomcat - (2009-03-12)
  [2186] An FAQ on the Apache httpd and Apache Tomcat web servers, and on using them together - (2009-05-17)
  [2753] You do not just fly - that is just part of the journey - (2010-05-06)
  [3997] Servlet v JSP (Java Server Page). What is the difference? - (2013-02-06)
  [4434] Public training courses - upcoming dates - (2015-02-21)

A607 - Web Application Deployment - Apache httpd mod_rewrite
  [755] Using different URLs to navigate around a single script - (2006-06-11)
  [1006] Apache httpd and Apache Tomcat together tips - (2006-12-24)
  [1009] Passing GET parameters through Apache mod_rewrite - (2006-12-27)
  [1207] Simple but effective use of mod_rewrite (Apache httpd) - (2007-05-27)
  [1381] Using a MySQL database to control mod_rewrite via PHP - (2007-10-06)
  [1636] What to do if the Home Page is missing - (2008-05-08)
  [1778] Pointing all the web pages in a directory at a database - (2008-08-30)
  [1954] mod_rewrite for newcomers - (2008-12-20)
  [2094] If you have a spelling mistake in your URL / page name - (2009-03-21)
  [2555] Bookkeeping - (2009-12-29)
  [2728] Redirecting a home page using mod_rewrite - (2010-04-17)
  [2768] Carrying a long URL around - looking for memorable shorts - (2010-05-17)
  [2773] Dynamically watching your web site via a PHP wrapper - (2010-05-21)
  [2900] Redirecting a page - silent, temporary or permanent? - (2010-08-03)
  [2981] How to set up short and meaningfull alternative URLs - (2010-10-02)
  [3197] Finding and diverting image requests from rogue domains - (2011-03-08)
  [3568] Telling which ServerAlias your visitor used - useful during merging domains - (2012-01-04)
  [3753] Adding a passcode to a directory - (2012-06-05)
  [3862] Forwarding a whole domain, except for a few directories - Apache http server - (2012-09-17)

A502 - Web Application Deployment - Java - Basic Tools
  [754] tar, jar, war, ear, sar files - (2006-06-10)
  [1082] Straight from the .jar - (2007-02-16)
  [1192] What are WEB-INF and META-INF directories? - (2007-05-18)
  [1562] Java Compiler - needs all classes, compiles them all too - (2008-03-03)
  [1909] javax.servlet cannot be resolved - how to solve - (2008-11-26)
  [2153] Class Loading and Variable Conversion in Java - (2009-05-02)
  [2422] Looking inside Java classes - javap and javadoc - (2009-09-25)
  [2859] Using java, javac, jar, and CLASSPATH - a simple example - (2010-07-07)
  [3151] Disassembling Python and Java - previously compiled code - (2011-01-29)
  [3819] Packing a tar, jar or war file - best practise - (2012-07-26)
  [4412] Java -making sure you have the right versions - (2015-02-02)

Back to
3 hours from Milton Keynes
Previous and next
Horse's mouth home
Forward to
Ken Palm, iTime, and Domain Name Tasting
Some other Articles
What is my real and my effective ID? [Linux]
The Longest Possible Day
Ken Palm, iTime, and Domain Name Tasting
More HowTo diagrams - MySQL, Tomcat and Java
3 hours from Milton Keynes
July child ponders on August children
What is built in to this httpd and PHP?
mod_proxy and mod_proxy_ajp - httpd
Diagrams to show you how - Tomcat, Java, PHP
4759 posts, page by page
Link to page ... 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96 at 50 posts per page

This is a page archived from The Horse's Mouth at http://www.wellho.net/horse/ - the diary and writings of Graham Ellis. Every attempt was made to provide current information at the time the page was written, but things do move forward in our business - new software releases, price changes, new techniques. Please check back via our main site for current courses, prices, versions, etc - any mention of a price in "The Horse's Mouth" cannot be taken as an offer to supply at that price.

Link to Ezine home page (for reading).
Link to Blogging home page (to add comments).

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2021: 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/1771_Mor ... -Java.html • PAGE BUILT: Sun Oct 11 16:07:41 2020 • BUILD SYSTEM: JelliaJamb