Gossamer Forum
Home : General : Perl Programming :

"MySQL Server has gone away" error... driving me mad!

(Page 2 of 2)
> >
Quote Reply
Re: [Andy] "MySQL Server has gone away" error... driving me mad! In reply to
I'm stumped. I think we need help from a pro now :)

This is a shot in the dark but try this:

Code:
# first, we need to enter our values into lsql_Links
my $article = $DB->table('Articles')->select( ['Content'], { LinkID => $link_id } )->fetchrow;

my $sql = qq~INSERT INTO lsql_Links (ID, Title, LinkOwner,
Add_Date, Mod_Date, Description,
upload_id, isPremium,PremiumDescription)
VALUES ('', ?, 'new_admin', CURDATE(), CURDATE(), ? , ?, ?, ?)~;
my $sth = $dbh->prepare($sql);
$sth->bind_param(1, $hit->{Title});
$sth->bind_param(2, $article);
$sth->bind_param(3, $hit->{ID});
$sth->bind_param(4, $hit->{isPremium});
$sth->bind_param(5, $hit->{PremiumDescription});

$sth->execute() or die $DBI::errstr;
$sth->finish();
$dbh->disconnect();

There's got to be something in one of those error messages that you posted to tell you what's wrong. I just don't know enough about MySQL to tell you what it is :/

~Charlie
Quote Reply
Re: [Chaz] "MySQL Server has gone away" error... driving me mad! In reply to
Hi,

Thanks ... didn't work though :( (same error). Thanks for your help though.. at least its got me on the right line now (I didn't even have an error message being reported before :().

Alex? <G>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] "MySQL Server has gone away" error... driving me mad! In reply to
This bit from the MySQL docs[1] looks interesting:

Quote:
You can also get these errors if you send a query to the server that is incorrect or too large. If mysqld receives a packet that is too large or out of order, it assumes that something has gone wrong with the client and closes the connection. If you need big queries (for example, if you are working with big BLOB columns), you can increase the query limit by setting the server's max_allowed_packet variable, which has a default value of 1MB. You may also need to increase the maximum packet size on the client end. More information on setting the packet size is given in Section A.2.9, “Packet too large”[2].

Try increasing your max_allowed_packet variable and see what happens.

~Charlie

[1] http://dev.mysql.com/...ql/en/gone-away.html
[2] http://dev.mysql.com/...acket-too-large.html
> >