Home Accessibility Courses Diary The Mouth Facebook Resources Site Map About Us Contact
Checking the database connection manually

For an initial database connectivity test from my own code, I use the mysql client program and 'check out' the commands manually through that. Noting all the parameters, I then check through a piece of code in my target language ... in this brief example from Wednesday, it was Perl:

use DBI;
 
# From my manual test:
# mysql -h192.168.200.84 -utrainee -pabc123
# use wellho
# select agid,locate,sid from sales
 
$db_handle = DBI ->
  connect("DBI:mysql:wellho:192.168.200.84","trainee","abc123")
    or die ("connection failed: $DBI::errstr\n");
 
$qu_handle = $db_handle -> prepare("select agid,locate,sid from sales");
$qu_handle -> execute;
 
while (@row = $qu_handle -> fetchrow()) {
  print "@row\n";
  }

One of the most common questions I get by email from people I have never heard of before relates to getting 3rd Party software running on their own systems. And one of the most common solutions that I suggest is checking out their database connection - changing sample MySQL accounts from user "hello" and password "world" to the name of an account that exists on their system ;-). A short test such as the one above, and done with the knowledge of what each step is doing, can identify these initial connection problems very quickly indeed.
(written 2009-08-28)

 
Associated topics are indexed as below, or enter http://melksh.am/nnnn for individual articles
P308 - Using SQL Databases from Perl
  [3099] Perl - database access - DBD, DBI and DBIx modules - (2010-12-22)
  [2561] The future of MySQL - (2010-01-03)
  [1904] Ruby, Perl, Linux, MySQL - some training notes - (2008-11-23)
  [1885] Hiding a MySQL database behind a web page - (2008-11-15)
  [1224] Object Relation Mapping (ORM) - (2007-06-09)
  [975] Answering ALL the delegate's Perl questions - (2006-12-09)
  [644] Using a MySQL database from Perl - (2006-03-13)
  [515] MySQL - an FAQ - (2005-12-03)

S156 - Interfacing Applications to MySQL Databases
  [3455] MySQL, MySQLi, PDO or something else - how best to talk to databases from PHP - (2011-09-24)
  [3447] Needle in a haystack - finding the web server overload - (2011-09-18)
  [3035] How to display information from a database within a web page - (2010-11-07)
  [2790] Joining a MySQL table from within a Python program - (2010-06-02)
  [2745] Connecting Python to sqlite and MySQL databases - (2010-04-28)
  [2263] Mysqldump fails as a cron job - a work around - (2009-06-30)
  [1561] Uploading to a MySQL database through PHP - examples and common questions - (2008-03-02)
  [1518] Downloading data for use in Excel (from PHP / MySQL) - (2008-01-25)
  [1450] Easy selection of multiple SQL conditions from PHP - (2007-11-30)
  [1381] Using a MySQL database to control mod_rewrite via PHP - (2007-10-06)
  [723] Viewing images held in a MySQL database via PHP - (2006-05-17)
  [663] Python to MySQL - (2006-03-31)
  [104] mysql_connect or mysql_pconnect in PHP? - (2004-10-30)


Back to
Object Oriented programming - a practical design example
Previous and next
or
Horse's mouth home
Forward to
Giving up on user input - keyboard timeout in Perl
Some other Articles
Reading all our recent news from a single source
Looking ahead to the Autumn season of training and accommodation
Lua Regular Expressions
Giving up on user input - keyboard timeout in Perl
Checking the database connection manually
Object Oriented programming - a practical design example
Making variables persistant, pretending a database is a variable and other Perl tricks
Handling XML in Perl - introduction and early examples
Wiltshire / Melksham Weddings - guest accommodation
Long job - progress bar techniques (Perl)
4279 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 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., 2014: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 899360 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho

PAGE: http://www.wellho.net/mouth/2381_.html • PAGE BUILT: Sun Mar 30 15:20:58 2014 • BUILD SYSTEM: WomanWithCat