Practically Agile

Using Agile in less-than-perfect situations since Y2K

Informix on a Mac, Part 2

Yesterday, I posted my technique for installing Informix on a Mac. Well, it turns out I wrote just a bit too soon. What I had was indeed working, but only for the “dbaccess” tool that ships with Informix. Trying to connect from a Java (JDBC) application failed.

Thanks to Eric Herber’s comment on that post, the PDF it mentions, and a bit more research, I was able to make a two significant updates to my installation.

Group Settings

Reading through the PDF, it notes that the informix user and group are required in order for things to work properly. Examining my install, it seems that the IDS installer tried to create the informix group, but somehow assigned it the same group ID as the _lpoperator group. I believe _lpoperator is the group of people who can use the Mac’s printers. Regardless, it wasn’t the informix group that it should have been.

Important! If you don’t understand what is meant by user and group here, my best advice would be to get someone who does to help you. I don’t want to insult anyone, but making changes to the things I am about to mention could render your machine unusable. Here be dragons!

To fix this issue, I had to do two things. First, create the informix group and make it the informix user’s “primary” group. Second, I had to change the group ownership of everything in my Informix install directory from _lpoperator to the new informix group. The PDF talks about using the Workgroup Manager that is available in the OS X Server Admin Tools. I will let you read that for the details except to say that the correct URL for acquiring the tools depends on the version of OS X you have. Regardless, the URL in the PDF is outdated, as is one I found in a search on MacOSXHints. The best means I have found is to go to the Apple Support site’s Advanced Search, enter “server admin tools”, select the radio button to match all keywords, use the drop-down to restrict the document type to “Downloads”, and pick the version you want from the results. I am far from certain, but it would make sense to pick the one closest to your version of OS X.

Once you have the Server Admin Tools download, it is a simple, and typical Mac install. Once installed, you can run the Workgroup Manager tool more or less as stated in the PDF. Do not skip the step that asks you to select “Show All Records” from the “View Menu”. This may be “Show System Records” depending on the version of the tool. If you know a little about Unix user management, the tool is fairly intuitive. If you know a lot about Unix user management, you may prefer the command line tools that can do the same thing. Regardless, I simply had to create the informix group and make it the informix user’s primary group.

It is worth noting that if I had created the informix user and group using this tool before running the installer, I probably would not have had the _lpoperator nonsense nor would I have had to do the next step: changing the group ownership of all the files in my Informix install.

To change the group ownership, I went back to the command line and did the following:

$ cd /Applications/IBM/informix
$ ls -l
total 11656
drwxr-xr-x    3 root      staff         102 Aug 15  2008 CSDK
drwxr-xr-x    5 root      staff         170 Aug 15  2008 DBLD
drwxr-xr-x    3 root      staff         102 Aug 15  2008 ICONNECT
-rw-r--r--    1 root      staff        5904 Aug 14  2008 README.html
drwxr-xr-x    7 root      staff         238 Aug 15  2008 SERVER
drwxrwxr-x    4 informix  _lpoperator      136 Jan 13 15:50 aaodir
drwxr-xr-x  109 informix  _lpoperator     3706 Jan 13 15:54 bin
...
-rwxr-xr-x    1 root      _lpoperator    29713 Aug 14  2008 uninstallserver
$ sudo chgrp -R informix aaodir
...

Note: The “…” on line 11 means there were a lot of other entries. The one at the end means that I repeated that “sudo chgrp” for all of the files and directories that had group ownership of _lpoperator.

The “sqlhosts” File

That group information was annoying and tedious to fix, but it was not really the problem. If you recall from the earlier post, there are some environment settings that need to be loaded. One points to a file that is very important to enabling clients to connect to the server: INFORMIXSQLHOSTS. The whole purpose of the file is to define the mechanisms by which clients can connect, this means whether they must be using shared memory space or can use sockets and what port they use to connect. The one created by the installer for the demo database has a single line that looks like this:

demo_on    onsoctcp    yoda.local    9088

The first is the dbservername and is correct for the demo database. The second is a three-part string that identifies how clients can connect. In short, “on” means a regular database server (short for on-line as in OLTP maybe), “soc” means sockets as opposed to “shm” for shared memory, and “tcp” means the network protocol. So, this seems right as well. The other two entries are the machine hostname and the port. However, although my Mac is named “Yoda” (yes, I’m a Star Wars geek), that is not listed in the /etc/hosts file. I changed this to “localhost” which is in the hosts file. Finally, that last entry is meant to be the service name from the /etc/services file, not the port number. To figure out how to change this, I used the following command:

$ cat /etc/services | grep Informix
sqlexec         9088/tcp    # IBM Informix SQL Interface
sqlexec         9088/udp    # IBM Informix SQL Interface
sqlexec-ssl     9089/tcp    # IBM Informix SQL Interface - Encrypted
sqlexec-ssl     9089/udp    # IBM Informix SQL Interface - Encrypted

My final file still contains one line, which looks like this:

demo_on    onsoctcp    localhost    sqlexec

And now, everything is working smoothly. Whew!

Tags: , , , ,

. 15 Jan 10 | Programming | Comment (1)

Installing Informix on a Mac

Update: I had some problems connecting to Informix via Java. Also, the process below led to an issue with the “informix” user’s group settings. I have created a “part 2″ post to detail what happened and how I managed to fix it. Please read that before using these instructions to perform your own install.

I have recently started a project with a group that uses Informix as the database. To set up my development environment to match production as closely as possible, I have installed IDS for Mac. The instructions that you can find on the web caused me some difficulty. There is a video available from IBM that would be great, but it seems to be outdated slightly. (Viewing it may still give you some benefit, so you can find it here.) To save myself time in the future if other Mac users need to join the project, I have documented what I believe to be the final process here.

Caveats:

  • Do not start this process without a current system backup. System settings are going to be modified.
  • I tried to document this as I went, however I did make some discoveries late and then inserted them where I believe I should have done them. Those have not been retested.
  • It is likely there are better/faster ways to do some of these things.
  • There may well be additional steps needed to add additional databases or if your usage is heavier than mine to date.

If you try this out and find some things that don’t work or ways to make it faster or easier, please let me know in the comments. I will happily incorporate them.

One quick formatting note, when command examples are given, the “$” at the beginning of a line is in place of the command prompt. By default in the Mac Terminal app, this is usually of the form “hostname:current_directory username$”. If you copy and paste the commands, remove the “$” and the space after it.

Installing IDS

  1. Download IDS here
  2. Mount the downloaded IDS disk image (iif.11.50.FC2DE.macosx64.dmg)
  3. Double-click the install package (iif.11.50.FC2DE.macosx64.pkg) and follow the prompts.
  4. Enable root user and log in as root. Note: It might be possible to follow the steps using only sudo, but most on-line instructions say to use the root account method. As such, this is what has been tested. Instructions provided below are for Snow Leopard 10.6.2.
    1. Open System Preferences
    2. Click “Accounts”
    3. Click “Login Options” (just above the lock in the bottom-left)
    4. Click the button next to “Network Account Server:” (near bottom-middle)
    5. Click “Open Directory Utility…”
    6. Click the lock (bottom-left) and enter admin password
    7. In the menu-bar, choose “Edit” then “Enable Root User”
    8. Enter a password for the root user
    9. Quit Directory Utility.
    10. Close System Preferences
    11. Log out
    12. Choose “Other” from the log-in menu and provide the root as the username and the password entered previously.
  5. Kernel options:
    1. Kernel options should be as follows per the IDS README files. (To avoid issues, system settings can be higher, but not lower):
      kern.sysv.shmmax=4398046511104
      kern.sysv.shmmin=1
      kern.sysv.shmmni=512
      kern.sysv.shmseg=512
      kern.sysv.shmall=1073741824
      kern.sysv.semume=10
      kern.sysv.semmsl=87381
      kern.sysv.semmnu=87381
      kern.sysv.semmns=87381
      kern.sysv.semmni=87381
      kern.maxfiles=2147483647
      kern.maxfilesperproc=40000
      kern.maxvnodes=150000
    2. To check them, use the following command:
      $ sysctl kern.sysv.shmmax kern.sysv.shmmin kern.sysv.shmmni kern.sysv.shmseg kern.sysv.shmall kern.sysv.semume kern.sysv.semmsl kern.sysv.semmnu kern.sysv.semmns kern.sysv.semmni kern.maxfiles kern.maxfilesperproc kern.maxvnodes
      
    3. Compare the output to the list above.
    4. To adjust any that need to be changed, use the following command (may not work for kern.sysv.shmmni):
      $ sysctl -w
      

      And copy the key-value from the list above (ex. kern.sysv.shmmax=4398046511104)

    5. Those command-line changes will disappear after a reboot. To make them permanent, edit /etc/sysctl.conf and simply paste the desired key-values. This is an important system file. Make a backup of the file first!
  6. Two options (the first runs a CLI installer, the second may run a GUI installer):
    1. Open a terminal window, navigate to /Applications/IBM/informix and run “ids_install”
    2. Open the finder, navigate to /Applications/IBM/informix and double-click “ids_install”
  7. Follow the installer prompts. Accept defaults as much as is possible except for the demo server installation and terminal emulator. Be sure to select “Yes” for the demo server and do not use the terminal emulator option.
  8. Launch a terminal window.
  9. Execute the following command (assuming a Bash shell):
    $ . /Applications/IBM/informix/demo/server/profile_settings
    
  10. If desired, copy the settings in that profile_settings file to your profile (as well as the profile of root and/or the informix user created by the installation).
  11. Run the following command to load the demo database, which will not be in your path (actual location: /Applications/IBM/informix/bin):
    $ dbaccessdemo
    
  12. Run the following command to connect to the database:
    $ dbaccess
    
  13. The interface is navigable using the arrow keys on the keyboard, go to “Table”
  14. Select the database “storesdemo@demoon”
  15. Select “Info”
  16. Select the “‘root’.stock” table
  17. Select “Columns”
  18. View the information (no more detail will be gone into here on using the tool)
  19. Select “Exit” and repeat until the tool quits.
  20. You can now log out as root and back in as your normal user.
  21. If you want to use the informix user to start/stop your database, continue. Otherwise, you can use the root user. Both will work from a terminal.
  22. Open Terminal and navigate to the /Users directory.
  23. By default, the install creates the informix user’s home directory but leaves it owned by the root user. To change the owner use (enter your password when prompted):
    $ sudo chown informix informix
    
  24. Use “su” command in the Terminal to log in as the informix user (enter the informix user’s password when prompted):
    $ su - informix
    
  25. Use the command below to print the contents of the needed settings to the terminal:
    $ cat /Applications/IBM/informix/demo/server/profile_settings
    
  26. Select the text (using the mouse) and copy it using Command-C.
  27. Edit (or create) a .profile file in the informix user’s home directory:
    $ cd ~
    $ vim .profile
    
  28. Enter VI’s insert mode by pressing “i”, and paste the copied settings using Command-V.
  29. Save and exit VI by pressing Escape, then entering “:wq” (without the quotes).
  30. Log out as informix and setup is complete.

Starting IDS

  1. Open a terminal and use the “su -” command to log in as root or the informix user. The “-” is important, as it ensures the user’s profile is loaded. If the informix user was enabled to start/stop the database according to the optional steps during installation, this loads the appropriate settings and “informix$” will now be the command prompt. Otherwise, the settings in /Applications/IBM/informix/demo/server/profile_settings must be loaded manually using this command:
    $ . /Applications/IBM/informix/demo/server/profile_settings
    
  2. Run the commands below. The output should match:
    $ oninit
    $ onstat -
    
    IBM Informix Dynamic Server Version 11.50.FC2DE — On-Line — Up 00:00:09 — 41756 Kbytes
    

Stopping IDS

  1. Open a terminal and use the “su -” command to log in as root or the informix user. (Note: “informix$” is now the command prompt.)
  2. Make sure the settings in /Applications/IBM/informix/demo/server/profile_settings are part of the environment.
  3. Run the commands below. The output should match.
    $ onmode -ky</blockquote>
    $ onstat -</blockquote>
    
    shared memory not initialized for INFORMIXSERVER ‘demo_on’
    

Tags: , , , ,

. 14 Jan 10 | Programming | Comments (7)

IPhone-Bluetooth Audio Skipping Problem

For Father’s Day this year, my family gave me the gift of a stereo Bluetooth headset. I had been asking for one since the iPhone announced support for A2DP headsets. (Basically, simple stereo headphone support.) The one I got was the Plantronics Voyager 855. I can’t speak highly enough about it. There may be sets with better sound or build quality, but I haven’t had any problems with the set itself. And at just over $30 it is far cheaper than most. Listening to podcasts or music while mowing the lawn or whatever else is fantastic. The combination of in-ear buds that block out external noise and the wireless connection to the phone—I can’t believe I lived without it for so long.

However, the iPhone’s Bluetooth support is not the best. I have an 8GB 3G, and had a lot of trouble with the audio cutting out. Worse, the same was true when I was on a call. I could usually hear just fine, but folks on the other end would tell me that my voice was cutting out. I was starting to blame the headset and was preparing to buy a more expensive model.

Fortunately, I noticed two important things. First, the podcast/music audio cutting out tended to only happen when the screen locked. This was true whether or not I pressed the lock or let the phone auto-lock. Second, I noticed that Apple’s iPhone OS 3.1 update mentioned attempting to fix problems with Bluetooth and wireless (Wi-Fi). In their case, they were trying to improve Wi-Fi performance.

Because of this, I decided to experiment a bit. I disabled the Auto-Lock feature and disabled Wi-Fi. Suddenly, I had no more skipping and cut-out problems. People said calls did not cut out either. I tested this way for about a day. I was able to get the audio to cut out by launching a CPU-intensive app, but only during the launch. Once the app was running, the audio came back with no more problems.

After that, I re-enabled the auto-lock. I locked and unlocked the phone. Still no cut-out problems. I then turned Wi-Fi back on. No cut-out problems. Then I locked the phone. Bingo! Audio started cutting out again. I disabled auto-lock, but the problem was still there when I locked the phone. Finally, I disabled Wi-Fi and turned auto-lock back on. No more skipping or cut-out problems.

It turns out that the iPhone is built such that Wi-Fi and Bluetooth share an antenna (presumably to share space). This causes problems when both are on. Apple seems to have found a way to manage this most of the time and even released updates to improve Wi-Fi performance. However, as has been true of iPhone Bluetooth support all along, they seem to have neglected to do the same for Bluetooth. Specifically, something seems to happen to the Bluetooth power (and possibly the Wi-Fi power) when the phone is locked. The combination of signal degredation from both being on and the phone being locked causes the problem.

The moral of the story? If you want to use a Bluetooth headset, disable Wi-Fi. If you want to use Wi-Fi, disable Bluetooth. That will get you the best performance. Now back to enjoying my wireless music while refactoring.

Tags: , , , ,

. 02 Oct 09 | Gadgets | Comments (2)

Improving Podcasts!

The one or two of you who actually come to the site to read these posts may have noticed that a few weeks ago, I added a link to Improving Podcasts in my sidebar. Allen Hurst, I, and a few other Improving employees have started producing a bi-weekly (every other Tuesday) podcast covering software development topics.

We have three episodes produced, and the latest was posted just this afternoon. (It may take some time for it to show up in iTunes.) The topics to date have centered around Agile projects management and development practices. Head over there, listen, subscribe, and please provide feedback. We really would love some positive feedback in iTunes, but to suggest topics, ask questions, or invite yourself to join us, the best place is the web site itself.

Tags: , ,

Embrace Failure

I just can’t say how much I agree with this. One of my favorite things about Agile methods is their ability to find problems quickly. The problem is that it makes it very difficult to sell to folks who are used to methods with slower feedback loops. I can think of several projects over the last two or three years where the team exposed significant problems very early on in development.

In one case, we were able to pinpoint a major domain modeling problem early on. The customer kept phrasing things as though the application centered on one concept. Through a very early (iteration 2 or 3) demo, we were able to discover that this was due to thinking of how the system being replaced worked. In fact, what the customer’s business really needed was to be able to focus the system on a completely different concept. Because we found it early, we delivered a much better and more valuable system.

That said, the point of the linked post — and this one — is that software projects will fail, Agile or not. While we often sell Agile as a way to get to value quickly, we should also sell the other side — it also is a way to get to failure quickly. And that is a good thing.

It occurs to me that we talk about something similar in Episode 1 of Improving Podasts. What? I haven’t mentioned that yet? Hmm…

. 14 Jul 09 | Uncategorized | Comments (4)