could someone please point me to good example on how to make a JDBC connection to an IBM DB2 database?


1 Answer 1


Here's how I did it:




driver = "com.ibm.db2.jcc.DB2Driver";
connStr = "jdbc:db2://localhost:50000/TEST";

username = "db2inst1";
password = "password";

conn = OpenSQLConnection[JDBC[driver, connStr], 
  "Username" -> username, "Password" -> password];

This is with a more or less plain installation of DB2 Express-C on Lubuntu 14.04.

After installation and before evaluating the above WL, my command line prep was roughly this (db2inst1 is the instance owner user account configured by the DB2 installation):

$ su db2inst1
$ cd
$ sqllib/db2profile
$ db2start
$ db2
db2 => create database test
  • $\begingroup$ it's ok, thanks your help. $\endgroup$
    – Rick QI
    Aug 8, 2014 at 6:45
  • $\begingroup$ @RickQI, glad to be able to help! If this post answered your question to your satisfaction, feel free to click the check mark next to the post to mark it as "accepted". If it didn't, definitely feel free to (a) comment on things specific to this answer here or (b) clarify your question further by editing it with clearly marked updates. (It's important to the good functioning of this site that all posts are accurately marked up to represent their actual status.) Thanks, and hope you're enjoying the community! $\endgroup$
    – William
    Aug 8, 2014 at 14:15
  • $\begingroup$ Sorry , i forget post "accepted". Now it's accepted this queston . it's very useful and clear. $\endgroup$
    – Rick QI
    Aug 11, 2014 at 6:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.