Hi,

I've a perl script which fails sometimes with the Unknown MySQL server host 'hostname' (1).

The issue is intermittent and happens once in a month or so. However I am not able to find the exact reason.

The connection is achieved using the below line:

my $mysql_keys_dsn = "DBI:mysql:mysql_read_default_group=keys; mysql_read_default_file=/usr/local/import/perlDB.cfg";

perlDB.cfg contains the below entry

[keys] user='xxxxx' password='xxxxx' host='hostname'

Below is the exact error incurred: FAILED: DBI connect('mysql_read_default_group=keys;mysql_read_default_file=/usr/local/import/perlDB.cfg;database=hosted','',...) failed: Unknown MySQL server host 'hostname' (1) at ./key_data.ora.pl line 358 Can't call method "prepare" on an undefined value at ./key_data.ora.pl line 190.


In reply to Failed DBI:failed: Unknown MySQL server host 'hostname' (1) by sverma

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.