Meditations on programming, startups, and technology
New Relic

DB2 on Mac

Python and DB2

We now have a working Python driver for DB2 which is currently undergoing internal testing. The driver is similar to the Ruby and PHP ones, which means that you get an advanced and very easy to use API. It also means that if you are confident with the Ruby driver, you will be able to use the Python one in no time.

Ruby:

require 'ibm_db'

conn = IBM_DB::connect(database, user, password)

if conn
  puts "Connection succeded."
  IBM_DB::close(conn)
else
  puts "Connection failed."
  puts IBM_DB::conn_errormsg
end



Python:

import ibm_db

conn = ibm_db.connect(database, user, password)

if conn:
    print "Connection succeeded."
    ibm_db.close(conn)
else:
    print "Connection failed."
    print ibm_db.conn_errormsg


We made it so that if you know one, you already know the other. These drivers are CLI wrappers that provide you with performance and stability. Also they don’t limit you to user data and are able to retrieve a good deal of metadata about your database. We’ll also provide a thin wrapper for those of you who intend to use a PEP 249 API. The next step, working on SQLAlchemy, has already started.

DB2 on Mac (no, really!)

macpro.pngWhen I first posted about our interest in Python/Django and DB2, the comment thread got hijacked by many people who asked for a Mac client in order to develop on Mac and deploy on Linux. Ask and you shall receive. I’ve promoted the idea of Django/SQLAlchemy/Python in IBM for a while now, and we are finally close to delivering the driver (with the adapter progressing at the same time too). Well, don’t take this as an official announcement, but Python wasn’t the only thing that I’ve been promoting for months within IBM. With the ever growing community of Ruby/Python hackers adopting Mac as their development platform of choice, I strongly believe that an investment in porting the great free version of DB2 to Mac is a very valid one.

I couldn’t talk about this for weeks, and it must be viewed as a rumor until IBM makes an official announcement, but we have been working on porting DB2 to Intel Mac. Not just the client, the whole package. This makes me a happy panda, no longer will a virtual machine be required to develop with DB2 on Rails on my Mac Book Pro. It’s a joy to see DB2 Express-C run on a Mac Pro (shown in picture) next to the other black boxes in the lab. Work is still in progress, but we should have a beta out there relatively soon (before winter kicks in). DB2 Express-C on Mac is intended for development purposes rather than production, this means that we expect you to develop on your shiny Mac but deploy on Linux or Windows. DB2 on Mac will be a beta product, but again it won’t just be a client runtime, it will be the full product and there is no reason why it shouldn’t be just as stable and efficient as the Linux and Windows versions.

Time to employee some of the newly acquired Cocoa-fu. I’m starting to feel that I could even learn Wasabi and IBM would still be able to let me use that skill in my day job. Awesome.


If you enjoyed this post, then make sure you subscribe to my Newsletter and/or Feed.

receive my posts by email

39 Responses to “DB2 on Mac”

  1. David Cesarano says:

    Finally… I even asked about this during the IBM round table at the last DB2 Tech conference I went too. You talk primarily about Django/SQLAlchemy/Python, but we should also be able to use other languages like Perl, correct? The good news is we are keeping up with Oracle. This is great it gives me an excuse to go buy a new MacBook Pro.

  2. Absolutely, David. Perl and PHP developers are in no way left out of the party. :)

  3. Ian Bjorhovde says:

    Antonio,

    You have just made my day. Thank you, thank you, thank you. (And Leon as well).

  4. Jake says:

    I primarily use mysql for development with Ruby, Python, and Rails. I’m not a database expert, can you explain why you are so happy about this?

  5. Ian Bjorhovde says:

    @Jake:

    I am a DB2 consultant, but I use a Mac. VMware let me switch to a Mac full time, but a full fledged engine (and client) is even better. :-)

  6. Matt says:

    > David: “The good news is we are keeping up with Oracle.”

    Actually, does not this put IBM ahead of Oracle wrt OSX? Oracle is behind a few releases.

  7. […] DB2 on Mac | Zen and the Art of Ruby Programming DB2 on the Mac? First thought why, second thought developers, developers, developers, developers. Good move IBM shadow org – now formally announce support. (tags: DB2 Mac Ruby) […]

  8. Richard Cook says:

    So what are the chances for a native Mac WebSphere MQ? At least the clients.

  9. […] neighbor’ Antonio Cangiano just made public IBM’s intention of releasing a DB2 Express-C port to Intel Mac. This is one more big step from DB2 Express-C towards the community, after very open licensing […]

  10. DB2 on a Mac ? that would be really great. at the moment I’m running DB2 on my MacBookPro and my MacPro using Parallels VM

    ekke

  11. Clemens Benden says:

    That would be very good news. I hope this comes true.

  12. Nuno Job says:

    Sorry, this is a comment on the Haskell article that I just couldn’t post there for some reason!?

    At my University we are taught the functional paradigm (Haskell). The later we have 2 discrete mathematics disciplines, and later a functional and pointfree program calculation method.

    I found your article really on the spot, it’s great to learn new things and to see that there’s more than imperative programming in the world. You an see my views on my blog if you like, just click Haskell on the categories :)

    Nice blog, congrats.

  13. You know I am a big fan of yours!!! I too am very excited about this. Keep up the great work my friend.

  14. Thank you very much Anant. That means a lot coming from you. :)

  15. Jeff Self says:

    This could be the final piece in the puzzle to get my work to let me use a Mac. This is the best news I’ve heard in a long time!!!!

  16. Norman Heino says:

    Hello Antonio,

    any chance of getting the beta version anytime soon? I’m a CS student and have to do a database course w/ DB2 this semester. I’d love to do that natively on my Mac.

    I’m very excited, seeing enterprise software beeing ported to my platform of choice. :)

  17. Gareth says:

    This is great news, i can’t wait to have the full IBM stack on mac os x, i use vmware fusion to use SLES, websphere and db2 on my mac book.

  18. Peter says:

    This is indeed great news. One thing though; please make sure DB2 is not just Leopard-compatible. A lot of people I know are not upgrading to Leopard; so please (at least) support Panther and Tiger.

  19. angelo says:

    This is great. At the office I’ve been using Parallels for a while, I hope to go native as soon as possible.

  20. Based on the “death via being nibbled to death by baby ducks” that has been DB2 UDB on Windows for me over the last year and a half, I have two suggestions for DB2 on the Mac:

    1) If the UI IBM would ship is based on the same UI used for Windows, make it command line only. It is far better to have a command-line only UI that actually *works* consistently, than a badly done GUI with “wizards” and functionality that don’t work at all or inconsistently.

    2) Create a functional, well-designed GUI for the DB2 administrator tools, then back-port them to DB2’s other platforms.

    Honestly, if given the chance, I’d drop DB2 in a heartbeat for any other DBM, based on the hell that are DB2 tools on Windows. Here’s a hint…error messages need meaning, and defaults need to be safe and functional.

  21. Tomas says:

    Are there any news about the availability of a beta version?

  22. Tim Hughes says:

    So, what’s the word? Where is this beast?

  23. @John: I’m sorry to hear about your misadventures with the Windows tools. DB2 on Mac won’t be shipping Control Center.

    @Thomas, @Tim Hughes: Progress have been made and the port is actively being worked on, but the beta is still not out there. I’ll announce in this blog when it becomes available.

  24. Please say this is coming soon. My new client is using DB2, and the lack of OS X DB2 support is driving me crazy.

  25. Thanks for filling us in, Antonio. Here’s another developer awaiting your announcement. Currently on a gig at OCP (http://www.ocp.org/).

    –p

  26. Chad Oliver says:

    I can see by your example, which I pasted below. How to connect to a local database. Can you also use an IP address in the connect method to connect to a remote machine? Also, is ibm_db thread safe?

    require ‘ibm_db’

    conn = IBM_DB::connect(database, user, password)

    if conn
    puts “Connection succeded.”
    IBM_DB::close(conn)
    else
    puts “Connection failed.”
    puts IBM_DB::conn_errormsg
    end

  27. Chad:

    require 'ibm_db'
    
    conn_string = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=sample; \
      HOSTNAME=localhost;PORT=60000;PROTOCOL=TCPIP;UID=db2inst1;PWD=db2password;"
      
    conn = IBM_DB::connect(conn_string, '', '')
    
    if conn
      puts "Connection succeded."
      IBM_DB::close(conn)
    else
      puts "Connection failed."
      puts IBM_DB::conn_errormsg
    end
    

    Change conn_string as it suits you.

  28. This is the best news this year and like a late christmas present. We are developing a knowledge management solution with ruby on rails. To kick the virtual machine and run db2 on native os x would be a pleasure. Can’t await the beta. Thank you, thank you, thank you.

  29. Matt G says:

    This is great! Please, please, please IBM….add support for WebSphere studio (or RSA) on OS X! Having to develop JEE on paralells (running windows) is blasphemous.

  30. Badrul says:

    I have RoR and db2 express-c installed in Ubuntu 7.10 and Windows machine. In Leopard, I’ve been successful in installing RoR using MacPorts up until the point of doing a ‘sudo gem install ibm_db’ . Since I can’t install DB2 in Mac yet, I can’t do export IBM_DB etc yet in Leopard. Anyone know of a workaround for this yet ?

  31. Sven says:

    Good that it was not said which winter. And, now with global warming which means we are entering constant summer, does that mean……;-) Really, is this anywhere near public beta? We are now 7 months from where the first news appeared, or has IBM ditched this project.

  32. @Badrul: Unfortunately, there is no workaround at the moment.

    @Sven: I inquired with the team working on the project. It appears that there have been a few technical difficulties specific to OS X that made that “soon” further away than I initially thought at the time of my DB2 on Mac post. They are working on these issues in order to make DB2 work on Leopard. If I get any updates that I can disclose, I’ll make sure to post about them in my blog.

  33. Todd Burch says:

    So, it’s sounding like if I’m going to be on Tiger a while, I might as well go ahead with VMware, pick another OS, and get Express-C?

  34. At the moment Todd, that’s a good plan.

  35. Sven says:

    Antonio, so they are still working on it, that’s good news. I hate to ruin my Mac by installing windows on it. I have enough of that crap at work. You had a post earlier in this thread where you said that CC will not ship for the Mac. I suppose there will be a GUI, what will it be, any info? Data Studio maybe?

  36. Todd Burch says:

    So, Leon mentioned at IDUG in Dallas last week that we’re looking at this for later this fall, on Leopard only?

    I can deal with that!

  37. Chris says:

    Hello Antonio,
    is there something new with DB2 on OS X? What is the current state? Can we expect something this year?

  38. Todd Burch says:

    OK, I’ve upgraded to Leopard.

    Tapping fingers… Staring out window…

    Lay it on us.

  39. […] in all likelihood it could be as soon as early next week. You may recall how more than a year ago I blogged about how the work on porting DB2 to the Mac had started. It took admittedly longer than expected […]

  40. Todd Burch says:

    Woo-Hoo!!! I’d be happy to beta test. (Look me up on BluePages!!)

  41. Clemens Benden says:

    Really? REALLY? R E A L L Y ?

    Well, that is a nice christmas present!

  42. Timo Ruohomaki says:

    Hi Antonio,

    It seems that the version of Express-C for OSX is still beta..is there any official feed where the release will be announced or should I just occasionally check this? We would like to start using DB2 instead of MySQL in our offerings but we really need a cross-platform database.

    Now the major problem with the current DB2 for OSX is that it is only 64 bit. I guess the reason of that is the Java version since only 64 bit Macs support Java SE 1.6. Anyway this means it cannot be used on normal desktops, MacBook Pros or MacBooks and that is a bit of bugger. Is there any plans to release also a 32-bit version?

Leave a Reply

I sincerely welcome and appreciate your comments, whether in agreement or dissenting with my article. However, trolling will not be tolerated. Comments are automatically closed 15 days after the publication of each article.

Copyright © 2005-2014 Antonio Cangiano. All rights reserved.