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!)
When 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.
Get more stuff like this
Subscribe to my mailing list to receive similar updates about programming.
Thank you for subscribing. Please check your email to confirm your subscription.
Something went wrong.
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.
Absolutely, David. Perl and PHP developers are in no way left out of the party. ๐
Antonio,
You have just made my day. Thank you, thank you, thank you. (And Leon as well).
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?
@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. ๐
> 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.
So what are the chances for a native Mac WebSphere MQ? At least the clients.
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
That would be very good news. I hope this comes true.
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.
You know I am a big fan of yours!!! I too am very excited about this. Keep up the great work my friend.
Thank you very much Anant. That means a lot coming from you. ๐
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!!!!
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. ๐
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.
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.
This is great. At the office I’ve been using Parallels for a while, I hope to go native as soon as possible.
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.
Are there any news about the availability of a beta version?
So, what’s the word? Where is this beast?
@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.
Please say this is coming soon. My new client is using DB2, and the lack of OS X DB2 support is driving me crazy.
Thanks for filling us in, Antonio. Here’s another developer awaiting your announcement. Currently on a gig at OCP (http://www.ocp.org/).
–p
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
Chad:
Change conn_string as it suits you.
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.
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.
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 ?
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.
@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.
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?
At the moment Todd, that’s a good plan.
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?
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!
Hello Antonio,
is there something new with DB2 on OS X? What is the current state? Can we expect something this year?
OK, I’ve upgraded to Leopard.
Tapping fingers… Staring out window…
Lay it on us.
Woo-Hoo!!! I’d be happy to beta test. (Look me up on BluePages!!)
Really? REALLY? R E A L L Y ?
Well, that is a nice christmas present!
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?