g_speran has asked for the wisdom of the Perl Monks concerning the following question:

The below code works just fine when I execute it from one of my UNIX servers. Rows in the MySQL DB are added as expected. However when I execute the code from a windows servers no rows in the MySQL DB are added. The MySQL DB host is a Windows XP server. Can you PLEASE lend you assistance in helping me see what I am not seeing as to why this code will not work on windows.

Thanks for your assistance in advance

use Net::MySQL; my $dbh = Net::MySQL->new( hostname => $MySQLserver, # Default use UNIX socket database => 'nb_reports', user => $user, password => $password, debug => 1 ); foreach $f (<\"${tlogs}\"/daily_data_gather_*.dat>) { while(<IN>){ $Line = $_; chomp $Line; ($Client_Name, $NBU_Type, $IP_Addr, $Platform, $Policy_Name, $ +Media_Server, $Total_Incr_Files, $Total_Incr_Kbytes, $Total_Full_File +s, $Total_Full_Kbytes, $Avg_Incr_Files, $Avg_Incr_Kbytes, $Avg_Full_F +iles, $Avg_Full_Kbytes, $Total_Incr_Time, $Avg_Incr_Time, $Total_Full +_Time, $Avg_Full_Time, $Incr_Count, $Full_Count, $Incr_Thru, $Full_Th +ru) = split(/,/, $Line); next unless ($Client_Name !~ /Client_Name/i); print "About to Add to DB - $Client_Name, $NBU_Type, $IP_Addr, + $Platform, $Policy_Name, $Media_Server, $Total_Incr_Files, $Total_In +cr_Kbytes, $Total_Full_Files, $Total_Full_Kbytes, $Avg_Incr_Files, $A +vg_Incr_Kbytes, $Avg_Full_Files, $Avg_Full_Kbytes, $Total_Incr_Time, +$Avg_Incr_Time, $Total_Full_Time, $Avg_Full_Time, $Incr_Count, $Full_ +Count, $Incr_Thru, $Full_Thru, $f\n"; $dbh->query("INSERT INTO policybyclient VALUES \(\'$Client_Nam +e\', \'$NBU_Type\', \'$IP_Addr\', \'$Platform\', \'$Policy_Name\', \' +$Media_Server\', \'$Total_Incr_Files\', \'$Total_Incr_Kbytes\', \'$To +tal_Full_Files\', \'$Total_Full_Kbytes\', \'$Avg_Incr_Files\', \'$Avg +_Incr_Kbytes\', \'$Avg_Full_Files\', \'$Avg_Full_Kbytes\', \'$Total_I +ncr_Time\', \'$Avg_Incr_Time\', \'$Total_Full_Time\', \'$Avg_Full_Tim +e\', \'$Incr_Count\', \'$Full_Count\', \'$Incr_Thru\', \'$Full_Thru\' +, \'$f\'\)"); print "Query Result: " . $dbh->get_error_message . "\n"; } #unlink $filename; #} }
Results:

with out the parameter "debug" in place (set to 0):
with the parameter "Debug" in place (set to 1):

Results with Debug in place (set to 1):

====================================================================== +=============: Use INET Socket: atl-perl-dev 3306/tcp Net::MySQL::_get_server_information(): 3B 00 00 00 0A 34 2E 31 2E 31 32 2D 6E 74 2D 6C ;....4.1.12-nt-l 6F 67 00 3B 2F 00 00 58 39 50 67 35 73 63 78 00 og.;...X9Pg5scx. 2C A2 08 02 00 00 00 00 00 00 00 00 00 00 00 00 ,............... 00 00 53 72 66 2B 3D 35 2F 2E 38 6B 37 6B 00 ..Srf.=5..8k7k. Protocol Version: 10 Server Version: 4.1.12-nt-log Salt: X9Pg5scxSrf+=5/.8k7k Net::MySQL::_send_login_message(): 47 00 00 01 0D A6 03 00 00 00 00 01 21 00 00 00 G............... 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ 00 00 00 00 73 63 72 69 70 74 00 14 3F CA 23 9D ....script..?... DD 54 E4 0D 36 F6 C7 85 90 11 8C 99 FF 26 4E D2 .T..6.........N. 6E 62 5F 72 65 70 6F 72 74 73 00 nb_reports. Net::MySQL::_request_authentication(): 01 00 00 02 FE ..... connect database File Name is: C:/WINNT/Profiles/#netbackup/my documents/logs/daily_dat +a_gather_20060824.dat date is: 20060824 About to Add to DB - sjc-clear, M, 172.16.224.56, blank, ca_sjc-clear_ +core, SJC-Main, 2555, 1013368, 0, 0, 2555.00, 1013 368.00, 0.00, 0.00, 402, 402.00, 0, 0.00, 3, 0, 2520.82, 0.00, 2006082 +4 Net::MySQL::_execute_command(): FD 00 00 00 03 49 4E 53 45 52 54 20 49 4E 54 4F .....INSERT.INTO 20 70 6F 6C 69 63 79 62 79 63 6C 69 65 6E 74 20 .policybyclient. 56 41 4C 55 45 53 20 28 27 73 6A 63 2D 63 6C 65 VALUES.('sjc-cle 61 72 27 2C 20 27 4D 27 2C 20 27 31 37 32 2E 31 ar',.'M',.'172.1 36 2E 32 32 34 2E 35 36 27 2C 20 27 62 6C 61 6E 6.224.56',.'blan 6B 27 2C 20 27 63 61 5F 73 6A 63 2D 63 6C 65 61 k',.'ca_sjc-clea 72 5F 63 6F 72 65 27 2C 20 27 53 4A 43 2D 4D 61 r_core',.'SJC-Ma 69 6E 27 2C 20 27 32 35 35 35 27 2C 20 27 31 30 in',.'2555',.'10 31 33 33 36 38 27 2C 20 27 30 27 2C 20 27 30 27 13368',.'0',.'0' 2C 20 27 32 35 35 35 2E 30 30 27 2C 20 27 31 30 ,.'2555.00',.'10 31 33 33 36 38 2E 30 30 27 2C 20 27 30 2E 30 30 13368.00',.'0.00 27 2C 20 27 30 2E 30 30 27 2C 20 27 34 30 32 27 ',.'0.00',.'402' 2C 20 27 34 30 32 2E 30 30 27 2C 20 27 30 27 2C ,.'402.00',.'0', 20 27 30 2E 30 30 27 2C 20 27 33 27 2C 20 27 30 .'0.00',.'3',.'0 27 2C 20 27 32 35 32 30 2E 38 32 27 2C 20 27 30 ',.'2520.82',.'0 2E 30 30 27 2C 20 27 32 30 30 36 30 38 32 34 27 .00',.'20060824' 29 ) Net::MySQL::_execute_command(): Query Result: About to Add to DB - sjc-palus, , , , ca_sjc-palus_core, SJC-Main, 221 +1, 392725, 0, 0, 2211.00, 392725.00, 0.00, 0.00, 1 60, 160.00, 0, 0.00, 3, 0, 2454.53, 0.00, 20060824 Net::MySQL::_execute_command(): E8 00 00 00 03 49 4E 53 45 52 54 20 49 4E 54 4F .....INSERT.INTO 20 70 6F 6C 69 63 79 62 79 63 6C 69 65 6E 74 20 .policybyclient. 56 41 4C 55 45 53 20 28 27 73 6A 63 2D 70 61 6C VALUES.('sjc-pal 75 73 27 2C 20 27 27 2C 20 27 27 2C 20 27 27 2C us',.'',.'',.'', 20 27 63 61 5F 73 6A 63 2D 70 61 6C 75 73 5F 63 .'ca_sjc-palus_c 6F 72 65 27 2C 20 27 53 4A 43 2D 4D 61 69 6E 27 ore',.'SJC-Main' 2C 20 27 32 32 31 31 27 2C 20 27 33 39 32 37 32 ,.'2211',.'39272 35 27 2C 20 27 30 27 2C 20 27 30 27 2C 20 27 32 5',.'0',.'0',.'2 32 31 31 2E 30 30 27 2C 20 27 33 39 32 37 32 35 211.00',.'392725 2E 30 30 27 2C 20 27 30 2E 30 30 27 2C 20 27 30 .00',.'0.00',.'0 2E 30 30 27 2C 20 27 31 36 30 27 2C 20 27 31 36 .00',.'160',.'16 30 2E 30 30 27 2C 20 27 30 27 2C 20 27 30 2E 30 0.00',.'0',.'0.0 30 27 2C 20 27 33 27 2C 20 27 30 27 2C 20 27 32 0',.'3',.'0',.'2 34 35 34 2E 35 33 27 2C 20 27 30 2E 30 30 27 2C 454.53',.'0.00', 20 27 32 30 30 36 30 38 32 34 27 29 .'20060824') Net::MySQL::_execute_command(): Query Result: <p> With Debug level set to 0 ============================================================ C:\WINNT\Profiles\#netbackup\My Documents\scripts>perl policybyclient_ +ODBC.pl File Name is: C:/WINNT/Profiles/#netbackup/my documents/logs/daily_dat +a_gather_20060824.dat date is: 20060824 About to Add to DB - sjc-clear, M, 172.16.224.56, blank, ca_sjc-clear_ +core, SJC-Main, 2555, 1013368, 0, 0, 2555.00, 1013 368.00, 0.00, 0.00, 402, 402.00, 0, 0.00, 3, 0, 2520.82, 0.00, 2006082 +4 Query Result: #08S01Bad handshake About to Add to DB - sjc-palus, , , , ca_sjc-palus_core, SJC-Main, 221 +1, 392725, 0, 0, 2211.00, 392725.00, 0.00, 0.00, 1 60, 160.00, 0, 0.00, 3, 0, 2454.53, 0.00, 20060824 Query Result: C:\WINNT\Profiles\#netbackup\My Documents\scripts>

Replies are listed 'Best First'.
Re: Net-MySQL on Windows
by jdtoronto (Prior) on Aug 29, 2006 at 20:22 UTC
    Query Result: #08S01Bad handshake
    The only time I have seen this (and it is a while since we used any ODBC in this office) is when the client cannot connect to the server. Have you checked that the client box has firewall settings that will permit a connection?

    jdtoronto

      I have. Actually after I declared the new connection, I put a "sleep 60;" statement there. I went to the MySQL DB server and opened the connections. It showed the server name that the connection was coming from and the port number. So I am assuming all is well.

      Gary S.

Re: Net-MySQL on Windows
by Anonymous Monk on Aug 31, 2006 at 07:20 UTC
    increase debug value?
      Its either on or off. I have tried increasing from 1 to 5 with no difference in the output