Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

connecting to mysql 1

Status
Not open for further replies.

ken212

Programmer
Dec 14, 2005
2
GB
This will be elementary most people, but i try to connect to a mysql database through a perl code as below but get the message not connected. What am i doing wrong please?

use DBI;
$db='edogan_ff';
$host='mysql7.opentransfer.com';
$u='edogan_egemen';
$p='edogan212';
$db_handle = DBI->connect("dbi:mysql:database=mysql;host=mysql7.opentransfer.com:port 3306;user=$u;


-------------------------
and the error messages i get.

Unquoted string "dbi" may clash with future reserved word at mcl.cgi line 41 (#1)
(W reserved) You used a bareword that might someday be claimed as a
reserved word. It's best to put such a word in quotes, or capitalize it
somehow, or insert an underbar into it. You might also declare it as a
subroutine.

Unquoted string "mysql" may clash with future reserved word at mcl.cgi line 41 (#1)
Unquoted string "database" may clash with future reserved word at mcl.cgi line
41 (#1)
Unquoted string "host" may clash with future reserved word at mcl.cgi line 41 (#1)
Unquoted string "port" may clash with future reserved word at mcl.cgi line 41 (#1)

Number found where operator expected at mcl.cgi line 41, near "port 3306" (#2)
(S) The Perl lexer knows whether to expect a term or an operator. If it
sees what it knows to be a term when it was expecting to see an
operator, it gives you this warning. Usually it indicates that an
operator or delimiter was omitted, such as a semicolon.

(Do you need to predeclare port?)
Unquoted string "user" may clash with future reserved word at mcl.cgi line 41 (#1)
Unquoted string "password" may clash with future reserved word at mcl.cgi line
42 (#1)

"my" variable $sth masks earlier declaration in same scope at mcl.cgi line 54 (#3)
(W misc) A "my" or "our" variable has been redeclared in the current
scope or statement, effectively eliminating all access to the previous
instance. This is almost always a typographical error. Note that the
earlier variable will still exist until the end of the scope or until
all closure referents to it are destroyed.

syntax error at mcl.cgi line 41, near "dbi:"
syntax error at mcl.cgi line 41, near "$host:"
syntax error at mcl.cgi line 42, near "$p) "
Execution of mcl.cgi aborted due to compilation errors (#4)
Uncaught exception from user code:
syntax error at mcl.cgi line 41, near "dbi:"
syntax error at mcl.cgi line 41, near "$host:"
syntax error at mcl.cgi line 42, near "$p) "
Execution of mcl.cgi aborted due to compilation errors.
 
$db_handle = DBI->connect("dbi:mysql:database=mysql;host=mysql7.opentransfer.com:port 3306;user=$u;

You haven't closed your brackets, or quotes

Change your usernames and passwords tout suite ;-)

Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top