RE : DBI-connect does not work in crontab but works interactively
Thank you very much. That solves my problem -Message d'origine- De : Dan Nelson [mailto:[EMAIL PROTECTED] Envoyé : 13 décembre 2004 12:03 À : Duhaime Johanne Cc : [EMAIL PROTECTED] Objet : Re: DBI-connect does not work in crontab but works interactively In the last episode (Dec 13), Dan Nelson said: In the last episode (Dec 13), Duhaime Johanne said: I have a script that check the status of all innodb tables. It works fine interactively. But not from the crontab tab. Here is the error message and also a list of the environment variables from the crontab The message is about libz.so that does not exit: but: l /usr/local/lib/libz.so lrwxrwxrwx 1 root other 13 Nov 23 16:26 /usr/local/lib/libz.so - libz.so.1.2.1* Actually libz.so should be in /usr/lib as well on Solaris 9 (it's part of the SUNWzlib package). You can use the 'crle' command as root to add /usr/local/lib to the ld.so searchpath. This will add 3 common library paths: crle -l -u /usr/local/lib:/usr/local/ssl/lib:/usr/sfw/lib Oops. Swap the -l and -u :) crle -u -l /usr/local/lib:/usr/local/ssl/lib:/usr/sfw/lib -- Dan Nelson [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
DBI-connect does not work in crontab but works interactively
hello, i have a shell script with 6 programs. if i run it directly as : sh first.sh all progrms with get executd and everything works fine. but if i give this script in crontab using 0 10 * * * /two/three/name.sh Only progs without database connection will get executed . but database tables will be empty . nothing will come to database. i m using mysql database with linux. can anybody help me? why is that so . before i used to run it using crontab only it was working fine. but now it is not working. Kavitha -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
DBI-connect does not work in crontab but works interactively
Hello I have a script that check the status of all innodb tables. It works fine interactively. But not from the crontab tab. Here is the error message and also a list of the environment variables from the crontab The message is about libz.so that does not exit: but: l /usr/local/lib/libz.so lrwxrwxrwx 1 root other 13 Nov 23 16:26 /usr/local/lib/libz.so - libz.so.1.2.1* Please if you have any idea of what is the problem, could you share it with me? Solaris 6, mysql-4.1.7 Johanne Duhaime --- Your cron job on mercure perl /seqweb/mysql/myscripts/check_innodb.pl produced the following output: install_driver(mysql) failed: Can't load '/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/auto/DBD/mysql/mysql. so' for module DBD::mysql: ld.so.1: perl: fatal: libz.so: open failed: No such file or directory at /usr/local/lib/perl5/5.6.1/sun4-solaris/DynaLoader.pm line 206, DBLIST line 1. at (eval 4) line 3 Compilation failed in require at (eval 4) line 3, DBLIST line 1. Perhaps a required shared library or dll isn't installed where expected at /seqweb/mysql/myscripts/check_innodb.pl line 53 HOME = /seqweb/mysql LD_LIBRARY_PATH = /usr/openwin/lib:/usr/lib:/opt/lib:/usr/local/lib/perl5/site_perl/5.6.1/ sun4-solaris/auto/DBD/mysql LOGNAME = mysql PATH = /seqweb/mysql:/usr/openwin/bin/xview:/usr/openwin/bin:/opt/IXImotif/bin: /opt/bin:/usr/bin:/etc:/usr/ucb:/usr/local/lib/perl5/site_perl/5.6.1/sun 4-solaris/auto/DBD/mysql SHELL = /usr/bin/sh TZ = Canada/Eastern script part use Env; use Env qw(PATH HOME TERM); use Env qw($SHELL @LD_LIBRARY_PATH); $ENV{'LD_LIBRARY_PATH'} ='/usr/openwin/lib:/usr/lib:/opt/lib:/usr/local/lib/perl 5/site_perl/5.6.1/sun4-solaris/auto/DBD/mysql'; $ENV{'PATH'}='/seqweb/mysql:/usr/openwin/bin/xview:/usr/openwin/bin:/opt /IXImoti f/bin:/opt/bin:/usr/bin:/etc:/usr/ucb:/usr/local/lib/perl5/site_perl/5.6 .1/sun4- solaris/auto/DBD/mysql'; # added just to check environment foreach (sort keys %ENV) { print $_ = $ENV{$_}\n; } # in bold the instruction that cause the message (line 53) open (DBLIST, $DB_LIST); #list of all db we have while (DBLIST) { my $db_name=$_; chomp($db_name); my $dsn = DBI:mysql:$db_name:localhost; # data source name my $dbh = DBI-connect ($dsn,$DBUSER, $DBPASS, { RaiseError = 1, PrintError = 0 }) or die Could not connect to server: $DBI::err ($DBI::errstr)\n;
Re: DBI-connect does not work in crontab but works interactively
In the last episode (Dec 13), Duhaime Johanne said: I have a script that check the status of all innodb tables. It works fine interactively. But not from the crontab tab. Here is the error message and also a list of the environment variables from the crontab The message is about libz.so that does not exit: but: l /usr/local/lib/libz.so lrwxrwxrwx 1 root other 13 Nov 23 16:26 /usr/local/lib/libz.so - libz.so.1.2.1* Actually libz.so should be in /usr/lib as well on Solaris 9 (it's part of the SUNWzlib package). You can use the 'crle' command as root to add /usr/local/lib to the ld.so searchpath. This will add 3 common library paths: crle -l -u /usr/local/lib:/usr/local/ssl/lib:/usr/sfw/lib -- Dan Nelson [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: DBI-connect does not work in crontab but works interactively
In the last episode (Dec 13), Dan Nelson said: In the last episode (Dec 13), Duhaime Johanne said: I have a script that check the status of all innodb tables. It works fine interactively. But not from the crontab tab. Here is the error message and also a list of the environment variables from the crontab The message is about libz.so that does not exit: but: l /usr/local/lib/libz.so lrwxrwxrwx 1 root other 13 Nov 23 16:26 /usr/local/lib/libz.so - libz.so.1.2.1* Actually libz.so should be in /usr/lib as well on Solaris 9 (it's part of the SUNWzlib package). You can use the 'crle' command as root to add /usr/local/lib to the ld.so searchpath. This will add 3 common library paths: crle -l -u /usr/local/lib:/usr/local/ssl/lib:/usr/sfw/lib Oops. Swap the -l and -u :) crle -u -l /usr/local/lib:/usr/local/ssl/lib:/usr/sfw/lib -- Dan Nelson [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
DBI Connect Fails after 20,000 record inserts/updates
I am trying to parse an email log database with about 900,000 records for records older than 2 days (ie 600,000 records). I make a dbi connection and select all records older than 2 days. It returns the rows. Now I step through each row with a while loop, and if the entry is a virus, i open a new dbi connect and store it in the virus table (update if it's already there). Then I disconnect that dbi call. Continuing on, I take each entry and update the overall_stats table, based on the date the email was received.. So if I receive 100,00 emails on 10-24-2002, then instead of having 100,000 log entries I condense it down to 1 entry in the stats table. Each entry in the overall_stats would be a single day, so that would mean I would have no more than 365 records there a year... month,day,year,total_emails,total_spam,total_virus,total_bytes After updating or inserting into the stats table, I close the dbi call, and process the next email log record. This goes on fine for about 19,000-21,000 records... then all of a sudden it dies.. Output of the perl script is here Updating Record 19700 in stats table Update _W32/Klez.H@mm to 1767 Virus table Update _W32/Klez.H@mm to 1768 Virus table Update _W32/Klez.H@mm to 1769 Virus table DBI-connect(logs:mail1:3306) failed: Can't connect to MySQL server on 'mail1' (99) at ./parse_sql line 123 Can't call method prepare on an undefined value at ./parse_sql line 124. Cannot connect to database Running this script over and over will produce different results on the record is stops on. line 122 creates the dbi connect, line 123 calls the prepare function on the query, which obviously fails because dbi thinks the database has gone away?? That's what I assume, but I cant figure out how to fix it. As soon as the script dies saying cant connect, I type mysql and get right into the db. I am sth-finish() and dbh-disconnect() on all my queries, except for the first one that pulls all 600,000 rows that i step through, so I dont see that would be a problem. Box is a dual p3, 2gig ram, 72gig SCSI RAID 5. Lookin for ideas here! Thanks for any help. Dallas Engelken NMGI - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: DBI Connect Fails after 20,000 record inserts/updates
It looks like you are using a network connection. Perhaps you are running out of connections, as closed sessions may take a while to be freed. Try keeping the second connection open until you are done. Dallas Engelken wrote: I am trying to parse an email log database with about 900,000 records for records older than 2 days (ie 600,000 records). I make a dbi connection and select all records older than 2 days. It returns the rows. Now I step through each row with a while loop, and if the entry is a virus, i open a new dbi connect and store it in the virus table (update if it's already there). Then I disconnect that dbi call. Continuing on, I take each entry and update the overall_stats table, based on the date the email was received.. So if I receive 100,00 emails on 10-24-2002, then instead of having 100,000 log entries I condense it down to 1 entry in the stats table. Each entry in the overall_stats would be a single day, so that would mean I would have no more than 365 records there a year... month,day,year,total_emails,total_spam,total_virus,total_bytes After updating or inserting into the stats table, I close the dbi call, and process the next email log record. This goes on fine for about 19,000-21,000 records... then all of a sudden it dies.. Output of the perl script is here Updating Record 19700 in stats table Update _W32/Klez.H@mm to 1767 Virus table Update _W32/Klez.H@mm to 1768 Virus table Update _W32/Klez.H@mm to 1769 Virus table DBI-connect(logs:mail1:3306) failed: Can't connect to MySQL server on 'mail1' (99) at ./parse_sql line 123 Can't call method prepare on an undefined value at ./parse_sql line 124. Cannot connect to database Running this script over and over will produce different results on the record is stops on. line 122 creates the dbi connect, line 123 calls the prepare function on the query, which obviously fails because dbi thinks the database has gone away?? That's what I assume, but I cant figure out how to fix it. As soon as the script dies saying cant connect, I type mysql and get right into the db. I am sth-finish() and dbh-disconnect() on all my queries, except for the first one that pulls all 600,000 rows that i step through, so I dont see that would be a problem. Box is a dual p3, 2gig ram, 72gig SCSI RAID 5. Lookin for ideas here! Thanks for any help. Dallas Engelken NMGI - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: DBI Connect Fails after 20,000 record inserts/updates
Yes, removing those disconnects on the second dbi call has fixed it. Looks like I was running out of ports due to the TIME_WAIT on all the previously established ports. Thanks, Dallas -Original Message- From: Artem Koltsov [mailto:Artem.Koltsov;wfinet.com] Sent: Thursday, October 24, 2002 10:32 AM To: [EMAIL PROTECTED] Subject: RE: DBI Connect Fails after 20,000 record inserts/updates Do you connect/disconnect before/after every insert? -Original Message- From: Dallas Engelken [mailto:dallase;nmgi.com] Sent: Thursday, October 24, 2002 9:52 AM To: [EMAIL PROTECTED] Subject: DBI Connect Fails after 20,000 record inserts/updates I am trying to parse an email log database with about 900,000 records for records older than 2 days (ie 600,000 records). I make a dbi connection and select all records older than 2 days. It returns the rows. Now I step through each row with a while loop, and if the entry is a virus, i open a new dbi connect and store it in the virus table (update if it's already there). Then I disconnect that dbi call. Continuing on, I take each entry and update the overall_stats table, based on the date the email was received.. So if I receive 100,00 emails on 10-24-2002, then instead of having 100,000 log entries I condense it down to 1 entry in the stats table. Each entry in the overall_stats would be a single day, so that would mean I would have no more than 365 records there a year... month,day,year,total_emails,total_spam,total_virus,total_bytes After updating or inserting into the stats table, I close the dbi call, and process the next email log record. This goes on fine for about 19,000-21,000 records... then all of a sudden it dies.. Output of the perl script is here Updating Record 19700 in stats table Update _W32/Klez.H@mm to 1767 Virus table Update _W32/Klez.H@mm to 1768 Virus table Update _W32/Klez.H@mm to 1769 Virus table DBI-connect(logs:mail1:3306) failed: Can't connect to MySQL server on 'mail1' (99) at ./parse_sql line 123 Can't call method prepare on an undefined value at ./parse_sql line 124. Cannot connect to database Running this script over and over will produce different results on the record is stops on. line 122 creates the dbi connect, line 123 calls the prepare function on the query, which obviously fails because dbi thinks the database has gone away?? That's what I assume, but I cant figure out how to fix it. As soon as the script dies saying cant connect, I type mysql and get right into the db. I am sth-finish() and dbh-disconnect() on all my queries, except for the first one that pulls all 600,000 rows that i step through, so I dont see that would be a problem. Box is a dual p3, 2gig ram, 72gig SCSI RAID 5. Lookin for ideas here! Thanks for any help. Dallas Engelken NMGI - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php Attention: Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity. The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any system and destroy any copies. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: DBI Connect Fails after 20,000 record inserts/updates
Do you connect/disconnect before/after every insert? -Original Message- From: Dallas Engelken [mailto:dallase;nmgi.com] Sent: Thursday, October 24, 2002 9:52 AM To: [EMAIL PROTECTED] Subject: DBI Connect Fails after 20,000 record inserts/updates I am trying to parse an email log database with about 900,000 records for records older than 2 days (ie 600,000 records). I make a dbi connection and select all records older than 2 days. It returns the rows. Now I step through each row with a while loop, and if the entry is a virus, i open a new dbi connect and store it in the virus table (update if it's already there). Then I disconnect that dbi call. Continuing on, I take each entry and update the overall_stats table, based on the date the email was received.. So if I receive 100,00 emails on 10-24-2002, then instead of having 100,000 log entries I condense it down to 1 entry in the stats table. Each entry in the overall_stats would be a single day, so that would mean I would have no more than 365 records there a year... month,day,year,total_emails,total_spam,total_virus,total_bytes After updating or inserting into the stats table, I close the dbi call, and process the next email log record. This goes on fine for about 19,000-21,000 records... then all of a sudden it dies.. Output of the perl script is here Updating Record 19700 in stats table Update _W32/Klez.H@mm to 1767 Virus table Update _W32/Klez.H@mm to 1768 Virus table Update _W32/Klez.H@mm to 1769 Virus table DBI-connect(logs:mail1:3306) failed: Can't connect to MySQL server on 'mail1' (99) at ./parse_sql line 123 Can't call method prepare on an undefined value at ./parse_sql line 124. Cannot connect to database Running this script over and over will produce different results on the record is stops on. line 122 creates the dbi connect, line 123 calls the prepare function on the query, which obviously fails because dbi thinks the database has gone away?? That's what I assume, but I cant figure out how to fix it. As soon as the script dies saying cant connect, I type mysql and get right into the db. I am sth-finish() and dbh-disconnect() on all my queries, except for the first one that pulls all 600,000 rows that i step through, so I dont see that would be a problem. Box is a dual p3, 2gig ram, 72gig SCSI RAID 5. Lookin for ideas here! Thanks for any help. Dallas Engelken NMGI - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php Attention: Any views expressed in this message are those of the individual sender, except where the message states otherwise and the sender is authorized to state them to be the views of any such entity. The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any system and destroy any copies. - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
DBI connect (help)
Hi all, I am trying to connect to my mysql database with a perl script... I can connect from commnad line both passing a password or at password prompt... I can connect successfully with the following line in my script.. my $dbh = DBI-connect(DBI:mysql:database=mysql;host=localhost, root, password, {'RaiseError' =1}); But the following line fails.. with a Memory fault but no core dump my $dbh = DBI-connect(DBI:mysql:database=mysql;host=localhost . ;mysql_read_default_file=$ENV{HOME}/.my.cnf, $user, $password); DBI-trace(9); outputs the following imp_dbh-mysql_dr_connect: host = localhost, port =0, uid = NULL, pwd = NULL .my.cnf file looks like... [client] user=root password=passwd Any ideas or anything blatenly obvious as to what is wrong? Thanks, Taylor Taylor Lewick Unix System Administrator Fortis Benefits 816 881 6073 Help Wanted. Seeking Telepath... You Know where to apply. Please Note The information in this E-mail message is legally privileged and confidential information intended only for the use of the individual(s) named above. If you, the reader of this message, are not the intended recipient, you are hereby notified that you should not further disseminate, distribute, or forward this E-mail message. If you have received this E-mail in error, please notify the sender. Thank you * - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
mysql dbi connect
I am having a problem with MySQL. I am seeking some advice on either what is wrong or how to pursue the cause of this bug. I am using Perl DBI to interface with MySQL and when i execute the following statement: $dbh = DBI-connect('DBI:mysql:database=dbmysql2', undef, undef, {PrintError =0}) || die $ DBI::errstr; it causes the error: [Fri Aug 17 09:59:50 2001] productioncontent14.pl: Access denied for user: '@localhost' to database 'dbmysql2' at productioncontent14.pl line 29, STDIN line 1 the dbi connect is being invoked by a perl program which is run from the command line. when i execute the above DBI-connect statement with my MySQL userid and password it works fine. i have MySQL (not unix) root level privileges. for performance and security reasons i prefer to execute the version of the connect which is failing. i am running MySQL as described below: Server version 3.23.36 Protocol version 10 Connection Localhost via UNIX socket UNIX socket /var/lib/mysql/mysql.sock i am running Perl 5.6 and Red Hat 7.1 Linux 2.4.3-12 i checked that i have access to mysql.sock in addition to a my local host with my user name which is fully privileged, i currently show local host with no user name and no password in the mysql user table and with no privileges. i tried, as mysql root, to grant all privileges to localhost, which has no user name, via the sql command: grant all privileges on * to %@localhost; this resulted in a user table entry of no host name, a user name of %@localhost and no privileges. this didn't seem useful so i deleted the new user name, %localhost from all of the mysql security tables.
dbi-connect
I am using Perl DBI to interface with MySQL and when i execute the following statement: $dbh = DBI-connect('DBI:mysql:database=dbmysql2', undef, undef, {PrintError =0}) || die $ DBI::errstr; it causes the error: [Fri Aug 17 09:59:50 2001] productioncontent14.pl: Access denied for user: '@localhost' to database 'dbmysql2' at productioncontent14.pl line 29, STDIN line 1 the dbi connect is being invoked by a perl program which is run from the command line. when i execute the above DBI-connect statement with my MySQL userid and password it works fine. i have MySQL (not unix) root level privileges. for performance and security reasons i prefer to execute the version of the connect which is failing. i am running MySQL as described below: Server version 3.23.36 Protocol version 10 Connection Localhost via UNIX socket UNIX socket /var/lib/mysql/mysql.sock i am running Perl 5.6 and Red Hat 7.1 Linux 2.4.3-12 i checked that i have access to mysql.sock in addition to a my local host with my user name which is fully privileged, i currently show local host with no user name and no password in the mysql user table and with no privileges. i tried, as mysql root, to grant all privileges to localhost, which has no user name, via the sql command: grant all privileges on * to %@localhost; this resulted in a user table entry of no host name, a user name of %@localhost and no privileges. this didn't seem useful so i deleted the new user name, %localhost from all of the mysql security tables. thankyou steve
Re: dbi-connect
Umm, you didn't specify a username or password...you instead passed 'undef'. This is the connect string I use: $dbh = DBI-connect( DBI:mysql:database=$pb_db; host=$pb_server; port=$pb_port, $pb_user, $pb_password, {RaiseError = 1}); Regards, Rich At 03:20 PM 8/18/01, you wrote: I am using Perl DBI to interface with MySQL and when i execute the following statement: $dbh = DBI-connect('DBI:mysql:database=dbmysql2', undef, undef, {PrintError =0}) || die $ DBI::errstr; it causes the error: [Fri Aug 17 09:59:50 2001] productioncontent14.pl: Access denied for user: '@localhost' to database 'dbmysql2' at productioncontent14.pl line 29, STDIN line 1 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
MySQL DBI connect
I am having a problem with MySQL. I am seeking some advice on either what is wrong or how to pursue the cause of this bug. I am using Perl DBI to interface with MySQL and when i execute the following statement: $dbh = DBI-connect('DBI:mysql:database=dbmysql2', undef, undef, {PrintError =0}) || die $ DBI::errstr; it causes the error: [Fri Aug 17 09:59:50 2001] productioncontent14.pl: Access denied for user: '@localhost' to database 'dbmysql2' at productioncontent14.pl line 29, STDIN line 1 the dbi connect is being invoked by a perl program which is run from the command line. when i execute the above DBI-connect statement with my MySQL userid and password it works fine. i have MySQL (not unix) root level privileges. for performance and security reasons i prefer to execute the version of the connect which is failing. i am running MySQL as described below: Server version 3.23.36 Protocol version 10 Connection Localhost via UNIX socket UNIX socket /var/lib/mysql/mysql.sock i am running Perl 5.6 and Red Hat 7.1 Linux 2.4.3-12 i checked that i have access to mysql.sock in addition to a my local host with my user name which is fully privileged, i currently show local host with no user name and no password in the mysql user table and with no privileges. i tried, as mysql root, to grant all privileges to localhost, which has no user name, via the sql command: grant all privileges on * to %@localhost; this resulted in a user table entry of no host name, a user name of %@localhost and no privileges. this didn't seem useful so i deleted the new user name, %localhost from all of the mysql security tables.
mysql dbi connect
I am having a problem with MySQL. I am seeking some advice on either what is wrong or how to pursue the cause of this bug. I am using Perl DBI to interface with MySQL and when i execute the following statement: $dbh = DBI-connect('DBI:mysql:database=dbmysql2', undef, undef, {PrintError =0}) || die $ DBI::errstr; it causes the error: [Fri Aug 17 09:59:50 2001] productioncontent14.pl: Access denied for user: '@localhost' to database 'dbmysql2' at productioncontent14.pl line 29, line 1 the dbi connect is being invoked by a perl program which is run from the command line. when i execute the above DBI-connect statement with my MySQL userid and password it works fine. i have MySQL (not unix) root level privileges. for performance and security reasons i prefer to execute the version of the connect which is failing. i am running MySQL as described below: Server version 3.23.36 Protocol version 10 Connection Localhost via UNIX socket UNIX socket /var/lib/mysql/mysql.sock i am running Perl 5.6 and Red Hat 7.1 Linux 2.4.3-12 i checked that i have access to mysql.sock in addition to a my local host with my user name which is fully privileged, i currently show local host with no user name and no password in the mysql user table and with no privileges. i tried, as mysql root, to grant all privileges to localhost, which has no user name, via the sql command: grant all privileges on * to %@localhost; this resulted in a user table entry of no host name, a user name of %@localhost and no privileges. this didn't seem useful so i deleted the new user name, %localhost from all of the mysql security tables.
DBI-connect
how can I test DBI-connect ? I'm geting this error: Software error: Execution of /var/www/cgi-bin/mySQL.pl aborted due to compilation errors. Yann carlier +351-21-4527104/5 www.inteliware.net [EMAIL PROTECTED]
Re: DBI-connect
Looks like a perl script, so you can use 'or' (||) to evaluate your 'connect' string, i.e. To stop the script if connect fails use $dbh = DBI-connect(dbi:mysql:database:localhost,'user','password') || die No connection to database; To issue a warning only $dbh = DBI-connect(dbi:mysql:database:localhost,'user','password') || print Database connect failed; Regards, Sebastiaan J.A. Kamp - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, June 26, 2001 1:34 PM Subject: DBI-connect how can I test DBI-connect ? I'm geting this error: Software error: Execution of /var/www/cgi-bin/mySQL.pl aborted due to compilation errors. Yann carlier +351-21-4527104/5 www.inteliware.net [EMAIL PROTECTED] - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
[Q] DBI connect with MySQL
Hi,gurus, I am a novice at MySQL. When I try to run a sample program in the book of "MySQL mSQL" I get a error message from my apache server as follows, * Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [EMAIL PROTECTED] and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. * The sample program is #!/usr/bin/perl -w use strict; use CGI qw(:standard); use CGI::Carp; use DBI; CGI::use_named_parameters(1); my ($db); my $output = new CGI; $db = param('test') or die("Could not find database!"); my $dbh = DBI-connect("DBI:mysql:$db:$server",root,passward ); if (not $dbh) { print header, start_html('title'="Information on $host = $db", 'BGCOLOR'='white'); print END_OF_HTML; H1$host/h1 H2$db/h2 For the following reasons the connection failed.BR $DBI::errstr /body/html END_OF_HTML exit(0); } print header, start_html('title'="Information on $host = $db", 'BGCOLOR'='white'); print END_OF_HTML; H1$host/h1 H2$db/h2 p Tablesbr UL END_OF_HTML my @tables = $dbh-func( '_ListTables' ); foreach (@tables) { print "LI$_\n"; } print END_OF_HTML; /ul /body/html END_OF_HTML exit(0); Could someone tell me what is wrong? Thanks a lot. Regards, --Wen [EMAIL PROTECTED] - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: [Q] DBI connect with MySQL
You will get errors like these if your script does not print out a header before spitting out other information. It is usually best to print the header in the very beginning of the script so you do not have to worry about it. You dont have to wait until you are about to print out some html. $output-header(); Also, if your script has parse errors or something similar you will get that error. Hope this helps. ryan Hi,gurus, I am a novice at MySQL. When I try to run a sample program in the book of "MySQL mSQL" I get a error message from my apache server as follows, * Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [EMAIL PROTECTED] and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. * The sample program is #!/usr/bin/perl -w use strict; use CGI qw(:standard); use CGI::Carp; use DBI; CGI::use_named_parameters(1); my ($db); my $output = new CGI; $db = param('test') or die("Could not find database!"); my $dbh = DBI-connect("DBI:mysql:$db:$server",root,passward ); if (not $dbh) { print header, start_html('title'="Information on $host = $db", 'BGCOLOR'='white'); print END_OF_HTML; H1$host/h1 H2$db/h2 For the following reasons the connection failed.BR $DBI::errstr /body/html END_OF_HTML exit(0); } print header, start_html('title'="Information on $host = $db", 'BGCOLOR'='white'); print END_OF_HTML; H1$host/h1 H2$db/h2 p Tablesbr UL END_OF_HTML my @tables = $dbh-func( '_ListTables' ); foreach (@tables) { print "LI$_\n"; } print END_OF_HTML; /ul /body/html END_OF_HTML exit(0); Could someone tell me what is wrong? Thanks a lot. Regards, --Wen [EMAIL PROTECTED] - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: [Q] DBI connect with MySQL
iii You will get errors like these if your script does not print out a header iii before spitting out other information. It is usually best to print the iii header in the very beginning of the script so you do not have to worry about iii it. You dont have to wait until you are about to print out some html. iii iii $output-header(); I add "$output-header();" just behind "my $output = new CGI;", but the result does not change. Maybe still there are other factors as you said. Thanks so much for your information. Regards, --Wen [EMAIL PROTECTED] - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: [Q] DBI connect with MySQL(SOLVED)
Okay, I get it. The problem comes from the statement below, wen $db = param('test') or die("Could not find database!"); After I revised it to "my $db = "test" or die("Could not find database!");" I get expected result. Thanks for your consideration. Regards, --Wen [EMAIL PROTECTED] - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Re: [Q] DBI connect with MySQL
Your Apache must be configured to support perl cgi scripts. Is it? What is in the Apache error log? [EMAIL PROTECTED] wrote: Hi,gurus, I am a novice at MySQL. When I try to run a sample program in the book of "MySQL mSQL" I get a error message from my apache server as follows, * Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator, [EMAIL PROTECTED] and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. * The sample program is #!/usr/bin/perl -w use strict; use CGI qw(:standard); use CGI::Carp; use DBI; CGI::use_named_parameters(1); my ($db); my $output = new CGI; $db = param('test') or die("Could not find database!"); my $dbh = DBI-connect("DBI:mysql:$db:$server",root,passward ); if (not $dbh) { print header, start_html('title'="Information on $host = $db", 'BGCOLOR'='white'); print END_OF_HTML; H1$host/h1 H2$db/h2 For the following reasons the connection failed.BR $DBI::errstr /body/html END_OF_HTML exit(0); } print header, start_html('title'="Information on $host = $db", 'BGCOLOR'='white'); print END_OF_HTML; H1$host/h1 H2$db/h2 p Tablesbr UL END_OF_HTML my @tables = $dbh-func( '_ListTables' ); foreach (@tables) { print "LI$_\n"; } print END_OF_HTML; /ul /body/html END_OF_HTML exit(0); Could someone tell me what is wrong? Thanks a lot. Regards, --Wen [EMAIL PROTECTED] - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php