#7 Cannot specify 'port' in connection string

open
nobody
None
5
2007-02-08
2007-02-08
Nate Reid
No

Since the MySQL API requires that 'port' be an integer, and pdo doesn't do string->int conversions on its connection string parameters, overriding the MySQL port results in an error.

Steps to reproduce (in an interpretor)
> import pdo
> pdo.connect("module=MySQLdb;user=user;passwd=passwd;db=db;port=3304") # notice the non-standard port specification.
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/lib/python2.4/site-packages/pdo.py", line 179, in __init__
raise pdo_connection_error, "Unable to connect to the Database: Database specific Error:" + str(sys.exc_type) + "\n" + str(sys.exc_value)
pdo.pdo_connection_error: 'Unable to connect to the Database: Database specific Error:exceptions.TypeError\nan integer is required'

I have supplied a patch for this bug in the patches section.

Discussion


Log in to post a comment.