View Issue Details

IDProjectCategoryView StatusLast Update
0004229mantisbtsqlpublic2004-11-06 06:29
Reporterrwmj Assigned Tograngeway  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version0.19.0a2 
Fixed in Version0.19.1 
Summary0004229: Missing parameter "port" in the ADOConnection implementation
Description

Somehow you forgot the port parameter in the ADOConnection class in core\adodb\drivers\adodb-ado.inc.php

Additional Information

If you run mysql server on a non standard port you cannot use it for mantisbt.

TagsNo tags attached.

Relationships

has duplicate 0004231 closedvboctor Unable to connect to MySQL on a non-standard port 
child of 0004297 closedvboctor Mantis 0.19.1 release 

Activities

rwmj

rwmj

2004-07-31 15:28

reporter   ~0006497

I can work around this issue with the following fix:
In db_connect in the file core\database_api.php change
$t_result = $g_db->Connect($p_hostname, $p_username, $p_password, $g_database_name );
to
$t_result = $g_db->Connect($p_hostname . ':' . $p_port, $p_username, $p_password, $g_database_name );

I call this a work around because I don't know if all current and future database apis will work with this syntax. It does, however, work with mysql. It seems to me that port should be passed to the ADOConnection class so each implementation of the ADOConnection class can handle the port number appropriately for the underlying API.

grangeway

grangeway

2004-07-31 18:58

reporter   ~0006501

gah, /me forgot about the previous existing of $g_port..

Right, victor, question time:

We need to deprecate $p_port or use $p_port only for mysql.

For example if your using mantis with say the odbc_mssql driver, you could specify more a 'connection_string' for $g_hostname of:
"Driver={SQL Server};SERVER=myhost\msde;DATABASE=mantis;UID=sa;PWD=mypass;"

See core/adodb/docs/docs-adodb.htm#adonewconnection

Or for pgsql:
$conn->PConnect('host=localhost port=5432 dbname=mary');
$conn->PConnect('localhost','userid','password','database');
^ two similar but different connections

Personally, i'd be inclined to update config_defaults/documentation to reflect that $p_hostname should be a host:port or host combination and deprecate g_port as this gives us (albeit with a badly named variable), flexibility later on. ADODB also call the first parmeter host, even though it may be a connection string.

my suggestion would be:
modify:
$g_hostname = "localhost";
$g_port = 3306; # 3306 is default
to read
$g_hostname = "localhost:3306"; # For mysql, this should be either hostname or hostname:port if you are running mysql on a non-standard port (note: port 3306 is the default).

vboctor

vboctor

2004-08-01 06:30

manager   ~0006522

I agree that we should drop $g_port given that we do the following:

  1. Add detailed documentation to config_defaults_inc.php and manual.
  2. Documentation should include a couple of examples
  3. Add $g_port to core/obsolete.php
  4. Make sure $g_port is not used anywhere including the admin/ directory.
  5. Add a "config removed" entry to the changelog.
jlatour

jlatour

2004-08-06 11:43

reporter   ~0006720

Sounds good. Paul, are you going to do this?

grangeway

grangeway

2004-09-26 04:49

reporter   ~0007747

Manual, changelog, source now reflect this.