Engine Yard

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 our RSS Feed.

Comments

42 Responses to “DB2 on Mac”

  1. David Cesarano on September 19th, 2007 4:43 pm

    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. Antonio Cangiano on September 19th, 2007 4:47 pm

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

  3. Ian Bjorhovde on September 19th, 2007 9:06 pm

    Antonio,

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

  4. Jake on September 20th, 2007 10:41 am

    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 on September 20th, 2007 2:33 pm

    @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 on September 20th, 2007 3:48 pm

    > 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. James Governor’s Monkchips » links for 2007-09-20 on September 20th, 2007 7:27 pm

    [...] 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 on September 21st, 2007 1:05 pm

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

  9. Vitor Rodrigues » Blog Archive » DB2 on Mac on September 24th, 2007 3:59 pm

    [...] 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. ekkehard gentz on September 24th, 2007 4:07 pm

    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 on September 25th, 2007 9:19 am

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

  12. Nuno Job on September 25th, 2007 5:58 pm

    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. Anant Jhingran on September 26th, 2007 1:41 am

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

  14. Antonio Cangiano on September 26th, 2007 2:13 am

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

  15. Jeff Self on September 27th, 2007 2:03 pm

    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 on October 19th, 2007 9:08 am

    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 on October 25th, 2007 11:44 am

    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 on October 29th, 2007 11:07 am

    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 on November 21st, 2007 5:47 pm

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

  20. John C. Welch on December 19th, 2007 6:11 pm

    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 on January 2nd, 2008 7:04 am

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

  22. Tim Hughes on January 9th, 2008 10:50 am

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

  23. Antonio Cangiano on January 14th, 2008 1:34 am

    @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. David Anderson on January 16th, 2008 3:29 pm

    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. Patrick Curtain on January 22nd, 2008 6:28 pm

    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 on January 25th, 2008 3:09 am

    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. Antonio Cangiano on January 25th, 2008 12:47 pm

    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. Stephan Meinl on February 15th, 2008 7:23 am

    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 on March 3rd, 2008 4:05 pm

    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 on April 1st, 2008 3:37 am

    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 on April 13th, 2008 6:30 am

    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. Antonio Cangiano on April 13th, 2008 4:14 pm

    @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 on April 13th, 2008 11:56 pm

    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. Antonio Cangiano on April 14th, 2008 12:25 am

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

  35. Sven on April 15th, 2008 2:56 pm

    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 on May 30th, 2008 11:31 pm

    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 on July 31st, 2008 6:29 am

    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 on October 16th, 2008 3:54 pm

    OK, I’ve upgraded to Leopard.

    Tapping fingers… Staring out window…

    Lay it on us.

  39. DB2 on Mac to ship before Christmas | Zen and the Art of Programming on December 12th, 2008 7:09 pm

    [...] 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 on December 13th, 2008 4:46 pm

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

  41. Clemens Benden on December 17th, 2008 6:55 am

    Really? REALLY? R E A L L Y ?

    Well, that is a nice christmas present!

  42. Timo Ruohomaki on June 6th, 2009 2:19 pm

    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