943,917 Members | Top Members by Rank

Ad:
  • Perl Discussion Thread
  • Marked Solved
  • Views: 1119
  • Perl RSS
Apr 4th, 2009
0

Warning message: 'old-style' syntax

Expand Post »
I am trying to connect Mysql5.1 from Perl 5.8.8 on RHEL5 as follows:
Perl Syntax (Toggle Plain Text)
  1. $dsn="DBI:mysql:database=mysql";
  2. $dbh=DBI->connect($dsn, 'root', 'root', 'mysql',{RaiseError => 1});
When I try to run perl containing above connection, it gets connected to Mysql and fetches data but displays following warning.
Quote ...
DBI->connect using 'old-style' syntax is deprecated and will be an error in future versions
What can be done to remove this warning?

Thanks and Regards
Similar Threads
Reputation Points: 12
Solved Threads: 3
Light Poster
punitdam is offline Offline
32 posts
since May 2008
Apr 4th, 2009
0

Re: Warning message: 'old-style' syntax

I don't know, you can try www.perlmonks.com or ask on the dbi modules mailing list (see the DBI module for details)
Reputation Points: 246
Solved Threads: 67
Practically a Posting Shark
KevinADC is offline Offline
898 posts
since Mar 2006
Apr 4th, 2009
0

Re: Warning message: 'old-style' syntax

You need to remove the 'mysql' parameter from connect. Should look something like this:
perl Syntax (Toggle Plain Text)
  1. use DBI;
  2.  
  3. $dsn="DBI:mysql:database=mysql";
  4. $dbh=DBI->connect($dsn, 'root', 'root', {RaiseError => 1});
Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004
Apr 5th, 2009
0

Re: Warning message: 'old-style' syntax

You can do this:

no warnings ;
no warnings 'all' ;
Reputation Points: 72
Solved Threads: 26
Posting Whiz in Training
GDICommander is offline Offline
209 posts
since Jun 2008
Apr 6th, 2009
0

Re: Warning message: 'old-style' syntax

Click to Expand / Collapse  Quote originally posted by Comatose ...
You need to remove the 'mysql' parameter from connect. Should look something like this:
perl Syntax (Toggle Plain Text)
  1. use DBI;
  2.  
  3. $dsn="DBI:mysql:database=mysql";
  4. $dbh=DBI->connect($dsn, 'root', 'root', {RaiseError => 1});
Thanks it is working fine now.
Reputation Points: 12
Solved Threads: 3
Light Poster
punitdam is offline Offline
32 posts
since May 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Perl Forum Timeline: 500 Internal Error, But script runs on shell!
Next Thread in Perl Forum Timeline: Perl script





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC