Problem conecting to DB2 using the database library

759 views
Skip to first unread message

michael...@gmail.com

unread,
Apr 6, 2016, 12:50:46 PM4/6/16
to robotframework-users
Hi.

I am using the database library (the Python one). I have been able to connect successfully to Postgres.

However, I am now trying to connect to db2 and I can't seem to make it work.

I have found some info (of/from people having similar problems) on the web, but no real solutions.

I tried two Python odbc driver modules: pyodbc as well as ibm_db.

Using the first, I receive an error "Data source name not found and no default driver specified".

Using the second, I get an error "FAIL : TypeError: function takes at least 3 arguments (0 given)."

My connection statement:

Connect To Database    dbapiModuleName=ibm_db    dbName=SAMPLE    dbUsername=db2admin    dbPassword=robotframework    dbHost=localhost    dbPort=50000

I have defined a data source using the Windows data source manager

Config: Win7Pro; Python 2.7.10 *32b; RF 2.9.x, latest database library; DB2Express-C (also 32b).

(So the stack is 32 bit. Therefore, I have also used the 32b Windows data source manager of course.)

Tnx in advance for any tips on how to deal with this.

Michael

Jerry Schneider

unread,
Apr 6, 2016, 1:05:59 PM4/6/16
to robotframe...@googlegroups.com
Looks like there might be a problem with the Connect to Database keyword.  Can you try the following:

Connect to Database    ibm_db    dbName    dbHost    dbPort    dbUsername    dbPassword
Something like:
Connect to Database    ibm_db    SAMPLE    localhost    5000    db2admin    robotframework

hopefully that will resolve the issue for you.

If not, trying the Connect to Database Using Custom Params might be a better resolution for the moment.

jer
--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-u...@googlegroups.com.
To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

-- 
Linux registered user #475536
Ubuntu registered user #28583

michael...@gmail.com

unread,
Apr 6, 2016, 2:00:42 PM4/6/16
to robotframework-users, jer...@gmail.com
Hi Jerry,

Thnaks a lot for your tips.

Unfortunately, they didn't solve my troubles. :-)

The first tip resulted in: "FAIL : Keyword 'DatabaseLibrary.Connect To Database Using Custom Params' expected 0 to 2 arguments, got 6."

The second tip resulted in: "FAIL : TypeError: function takes at least 3 arguments (0 given)."

Thnaks again anyqay!

Regards,

Michael


Op woensdag 6 april 2016 19:05:59 UTC+2 schreef Jerry S.:
Looks like there might be a problem with the Connect to Database keyword.  Can you try the following:

Connect to Database    ibm_db    dbName    dbHost    dbPort    dbUsername    dbPassword
Something like:
Connect to Database    ibm_db    SAMPLE    localhost    5000    db2admin    robotframework

hopefully that will resolve the issue for you.

If not, trying the Connect to Database Using Custom Params might be a better resolution for the moment.

jer

On 4/6/16 9:50 AM, michael...@gmail.com wrote:
Hi.

I am using the database library (the Python one). I have been able to connect successfully to Postgres.

However, I am now trying to connect to db2 and I can't seem to make it work.

I have found some info (of/from people having similar problems) on the web, but no real solutions.

I tried two Python odbc driver modules: pyodbc as well as ibm_db.

Using the first, I receive an error "Data source name not found and no default driver specified".

Using the second, I get an error "FAIL : TypeError: function takes at least 3 arguments (0 given)."

My connection statement:

Connect To Database    dbapiModuleName=ibm_db    dbName=SAMPLE    dbUsername=db2admin    dbPassword=robotframework    dbHost=localhost    dbPort=50000

I have defined a data source using the Windows data source manager

Config: Win7Pro; Python 2.7.10 *32b; RF 2.9.x, latest database library; DB2Express-C (also 32b).

(So the stack is 32 bit. Therefore, I have also used the 32b Windows data source manager of course.)

Tnx in advance for any tips on how to deal with this.

Michael
--
You received this message because you are subscribed to the Google Groups "robotframework-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotframework-users+unsub...@googlegroups.com.

To post to this group, send email to robotframe...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotframework-users.
For more options, visit https://groups.google.com/d/optout.

Jerry Schneider

unread,
Apr 6, 2016, 2:04:42 PM4/6/16
to michael...@gmail.com, robotframework-users
Unfortunately I do not have access to a DB2 database here, so not positive where to go in troubleshooting it.  Can you give me access to your database somehow and I might be able to help further in troubleshooting this?  Also, can you send a copy of your testssuite?

Thx,
jer

michael...@gmail.com

unread,
Apr 6, 2016, 2:19:24 PM4/6/16
to robotframework-users, michael...@gmail.com, jer...@gmail.com
Hi Jerry,

 First of all, sorry for all of the typo's in my reply. I was in a hurry. :-)

Regarding the db: it's on my local machine. I am using DB2Express-C, which is the (free) Community Edition of DB2.

It contains a sample database. That is the one I am using for my little proof of concept with the database library.

If you wanted to, you could download DB2Express-C (I use the 32bit one) for free from:


As to my test suite: well, I simply have one test suite containing only one test case, which in turn contains one statement (namely the 'Connect' statement). The only other thing is an 'Import' statement (pertaining to the database lib) at the test suite level.

Thanks again,

Michael

michael...@gmail.com

unread,
Apr 6, 2016, 4:19:35 PM4/6/16
to robotframework-users, michael...@gmail.com, jer...@gmail.com
Hi Jerry,

I tjust made a connection to DB2 from within RF, using the Java database library: https://github.com/ThomasJaspers/robotframework-dblibrary/.

Moreover, I used the remote library interface implementation of that test library, so I am still able to run using pybot.

For now, I'll stop troubleshooting the Python db library. But I have send the author of that lib a mail, since I still want to get it to work or at least figure out what's wrong. :-)

For now, thanks a lot for your support!

Regards,

Michael

Jerry Schneider

unread,
Apr 6, 2016, 4:24:15 PM4/6/16
to michael...@gmail.com, robotframework-users
No problemo.  I work on that project as well, just don't have access to all the different databases yet :)

Glad to hear you are at least up and running for now.

jer

michael...@gmail.com

unread,
Apr 6, 2016, 4:33:03 PM4/6/16
to robotframework-users, michael...@gmail.com, jer...@gmail.com
Hi Jerry,

Ah, I see. :-)

Well, as I just also wrote on RF Slack: I really hate it when I do not get things to work or at least figure out what's wrong.

So, if you have the time and  motivation to install that DB2 Express-C edition and figure out what is wrong (or what I did wrong), I'd be very interested in the outcome of your investigations. :-)

Thanks again!

Michael

Jerry Schneider

unread,
Apr 6, 2016, 5:18:56 PM4/6/16
to michael...@gmail.com, robotframework-users
Will keep that in mind.  Sorry couldn't get it going faster for you.

jer
Reply all
Reply to author
Forward
0 new messages