#5 ✓invalid

ARMySQLConnection ignores 'port' key

Reported by jabo | August 15th, 2008 @ 01:39 AM

when creating a connection, the 'port' key value is not utilized even though it is required.

to confirm, just modify the port variable to use anything other than the default port of 3306.

perhaps the mySQLConnection object is defaulting to using the socket and not the port.

while digging into the headers, I was unable to find which define needs to change to force mySQL to use the port and not the socket.

Comments and changes to this ticket

  • fjolnir (at gmail)

    fjolnir (at gmail) August 15th, 2008 @ 10:32 AM

    • Tag changed from connection, ignored, key, port to connection, database, ignored, key, port

    Thanks a lot for reporting, I'll fix this asap

  • fjolnir (at gmail)

    fjolnir (at gmail) August 17th, 2008 @ 06:39 PM

    • Tag changed from connection, database, ignored, key, port to connection ignored, database, key, port

    Hm, I took a look at the code and I don't see why this would happen, Here's the line that creates the mysql connection, are you sure you're using 'port' as the key for a NSNumber containing the desired port number when executingopenConnectionWithInfo:error: ? If so, let me know and I'll try to dig in deeper (although if that's the case it looks like a libmysqlclient bug which is unlikely)

      res = mysql_real_connect(mySQLConnection,
                               [host UTF8String],
                               [username UTF8String],
                               [password UTF8String],
                               [database UTF8String],
                               port, NULL, 0);
  • jabo

    jabo August 17th, 2008 @ 07:47 PM

    You are correct, I did some further testing and found that mysql_real_connect will not use the port setting value if your host key equals 'localhost' it will use the default socket instead.

    This does not affect your code at all, just a gotcha for others, probably one I should have known about.

    Thanks for taking a look.

  • Fjölnir Ásgeirsson

    Fjölnir Ásgeirsson August 17th, 2008 @ 11:59 PM

    • State changed from “new” to “invalid”

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

ActiveRecord is an insanely easy to use database framework written in objective-c It's obviously "inspired" by (copying) the infamous ActiveRecord that comes with Rails(http://rubyonrails.org) But it tries to be more versatile when it comes to working with multiple connections.