Bug 54730

Summary: LibreOffice Base crashes when Test connection is executed against JDBC connection
Product: LibreOffice Reporter: grofaty <grofaty>
Component: BaseAssignee: Not Assigned <libreoffice-bugs>
Status: RESOLVED WORKSFORME    
Severity: normal CC: dr, iplaw67, lionel, robert, serval2412
Priority: medium    
Version: 3.6.1.2 release   
Hardware: x86 (IA32)   
OS: Windows (All)   
Whiteboard:
Crash report or crash signature: Regression By:
Attachments: jdbc_test_crash

Description grofaty 2012-09-10 12:32:42 UTC
Created attachment 66924 [details]
jdbc_test_crash

After testing LibreOffice Base ODBC connection to DB2 and crash appears I reported bug: https://bugs.freedesktop.org/show_bug.cgi?id=45675

Now (this bug) I have tried to establish JDBC connection to DB2 and also crash appears, but in this case way way sooner:
1. Open LibreOffice Base.
2. In "1. Select database" window select "Connect to an Existing database" and select JDBC from drop down menu, click Next button:
3. In "2. Set up JDBC connection" window in "Database URL" field I have entered URL: db2://192.168.5.74:50000/SAMPLE
General syntax: db2://<server>:<port>/<database_name>
4. In JDBC driver class I entered:
com.ibm.db2.jcc.DB2Driver
5. In the same window click on "Test class" button. LibreOffice Base program crashes - see attachment (jdbc_test_crash.png).

Note: I have done several tests, but I see what ever is entered into above input fields and "Test class" is clicked LibreOffice Base ALWAYS crashes.
Comment 1 Jochen 2012-09-10 19:45:59 UTC
@Robert,
do you have a possibility to reproduce the bugreport?
Comment 2 Julien Nabet 2012-09-11 19:56:45 UTC
grofaty: In addition of your machine on Windows, would you have another machine with a Linux distribution?
The goal would be to install LO on this other machine with symbols package and retrieve an useful backtrace (see http://wiki.documentfoundation.org/BugReport#How_to_get_backtrace_.28on_Linux.29).
Comment 3 grofaty 2012-09-12 07:21:49 UTC
It looks to me this is not just DB2 specific, because as noted in my previous post what ever I enter into JDBC window dialogs (steps 3 and 4 and press Test in step 5) LibreOffice crashes. In my humble opinion it has to be some general crash problem. Can someone else test JDBC connection with some other database beside DB2? To confirm if this is really DB2 specific.
Comment 4 Alex Thurgood 2012-09-12 10:31:54 UTC
(In reply to comment #3)
> It looks to me this is not just DB2 specific, because as noted in my previous
> post what ever I enter into JDBC window dialogs (steps 3 and 4 and press Test
> in step 5) LibreOffice crashes. In my humble opinion it has to be some general
> crash problem. Can someone else test JDBC connection with some other database
> beside DB2? To confirm if this is really DB2 specific.



Can not confirm crash with an existing JDBC connection configured ODB file to a mysql server instance on Mac OSX with LO daily build Version 3.6.2.0+ (Build ID: c303961)


Alex
Comment 5 Alex Thurgood 2012-09-12 10:36:34 UTC
However, if I try and create a new ODB file that uses the mysql JDBC connector, using the DB creation wizard, then I get an ODB container which does not show any tables...no error message, no crash, nothing, but certainly no tables. I don't even get access to the Advanced Properties of the database connection.


Hmm, fishy that...
Comment 6 Alex Thurgood 2012-09-12 10:38:50 UTC
(In reply to comment #5)
> However, if I try and create a new ODB file that uses the mysql JDBC connector,
> using the DB creation wizard, then I get an ODB container which does not show
> any tables...no error message, no crash, nothing, but certainly no tables. I
> don't even get access to the Advanced Properties of the database connection.
> 
> 
> Hmm, fishy that...

Hmm, my Mac OSX version of LO has gone into some sort of limbo, I can see it in the OSX Dock, but clicking on it does nothing...forced kill coming up !
Comment 7 Alex Thurgood 2012-09-12 10:42:21 UTC
OK, so restarted my LOdev, and the previously created file asks for my password to connect to the server, and then shows...nothing, no tables, no access to Advanced Database connection properties, ho hum :-(

So no crash here, but certainly, a non-operational ODB file.


Alex
Comment 8 Alex Thurgood 2012-09-12 10:43:26 UTC
Since I can open a similar ODB file that I made in a previous version of LO, that uses the same connection parameters, there is something wrong with the ODB filed that the wizard creates.

Alex
Comment 9 Alex Thurgood 2012-09-12 10:49:01 UTC
Adding Lionel on CC
Comment 10 Alex Thurgood 2012-09-12 10:58:30 UTC
Will have to come back to this after I've compared the two ODB files, i.e. the one that I created in an earlier version and which works, and the one created in the daily build. This could be a different problem altogether or I suppose it could also be the reason for the crash on Windows...
Comment 11 Robert Großkopf 2013-01-23 21:13:30 UTC
I have just tested to connect PostgreSQL and MySQL with JDBC (directly JDBC - not with the dialog for MySQL). No problems with a crash or something else. Only the problem I have confirmed in https://bugs.freedesktop.org/show_bug.cgi?id=50747
Comment 12 QA Administrators 2013-09-24 01:54:43 UTC Comment hidden (obsolete)
Comment 13 QA Administrators 2013-10-25 15:13:25 UTC Comment hidden (obsolete)
Comment 14 grofaty 2017-01-04 11:24:27 UTC
Hi,
after several years I desperately needed functionality to get access to DB2 database from LibreOffice Base and now I see it is working fine for me. It looks like crash bug was intentionally/unintentionally fixed.

I did the following (just in case if someone else having the same problem):

SOFTWARE INSTALLATION
1. I Installed LibreOffice 5.2.4.2 on my Windows 7 SP1 computer so LibreOffice executable is in path: C:\Programs\LibreOffice\program\sbase.exe
2. I Installed latest Java JRE from www.java.com into so Java executable is in path: C:\Programs\Java\jre1.8.0_111\bin\java.exe
3. I have installed "IBM Data Server Runtime Client" (this is only DB2 client, DB2 server is installed on another machine) and JDBC driver is in path: C:\Programs\IBM\SQLLIB\java\db2jcc4.jar
Note: I have installed whole db2 runtime-client, because I need it for other tasks, but in theory it is enough to only have db2jcc4.jar (JDBC driver) and db2jcc_license_cu.jar (DB2 license file) files in one of the paths.

DB2 JDBC SETTINGS
4. I have opened LibreOffice main program (not Base yet) from path: C:\Programs\LibreOffice4\program\soffice.exe
5. From menu Tools | Options click on + in front of LibreOffice and click on Advanced option. Wait for few seconds and inside table Vendor="Oracle Corporation" and "Version=1.8.0_111" is displayed (this is the Java installed in step 2).
6. Inside table click on found Java and then click on "Class Path" button.
7. New dialog opens. Click on "Add Archive" button.
8. Point path to the DB2 JDBC driver in my case: C:\Programs\IBM\SQLLIB\java\db2jcc4.jar
Note: Above setting must be set! If not, then later in the process when connection userid/password is tested the error is displayed:
The driver class 'com.ibm.db2.jcc.DB2Driver' could not be loaded.
9. Click OK button and again OK button to accept changes and close down dialogs.

CONNECTION TO DB2 DATABASE
10. Start LibreOffice Base.
11. Database Wizard dialog opens. Select "Connect to an existing database", select JDBC from drop-down box and Next button.
12. In field where jdbc: is already hard coded type in: db2://192.168.5.74:50000/SAMPLE
    General syntax: db2://<server>:<port>/<database_name>
13. In JDBC driver class type in: com.ibm.db2.jcc.DB2Driver and click on Test Class button. Successful. Next button.
14. User name: <username> and check "Password required" box. Click on Test Connection button and type in password. Successful. Next button.
15. Accept default ("yes, register the database for me" and "Open the database for editing" and click Finish button.
16. Save As dialog appears. Select desired path and file name and click on Save button. Wait few seconds and database tables appear in the Tables list.

EDIT THE DATA
17. Inside Tables window double click on table you would like to edit.
18. Table opens up. Now you can edit existing data in one of the fields (or multiple fields in the same row). When you click on another cell inside the same row the DB2 database does not get yet updated. But when clicked on previous or next row or at the bottom at the last new row that triggers update into DB2 database table. I have checked with DB2 database monitoring tool and I see update SQL was executed running update on fields that I have changed and where condition is primary key of the row in table. Excellent exactly like it should be working.
19. In the last empty row type in some new values in all of the fields and then click on some other row. This click on other row triggers insert statement in table. Excellent, works exactly like it should.
20. In front of the table click on specific row (Shift key or Control key can be used to mark several rows) and right click and select "Delete Rows". Confirmation dialog appears. I have check with monitoring tool and for each selected row delete statement is executed with where condition pointing to primary key. Excellent exactly like it should be working.

DEBUGGING
21. For example in character(2) field try to type in three characters and click on another row. Error is expected and it is displayed "Error updating the current record" and SQLCODE=-302 is displayed. Looking into DB2 error codes it is clear the correct error was displayed by LibreOffice.22. Similar if new record is inserted for example with duplicate primary key "Error inserting the new record" with SQLCODE=-803 is displayed. Also correct error, because this sqlcode is for duplicate primary key. Works as expected. Excellent!

I am really glad LibreOffice Base is finally working perfectly with DB2. Excellent!

P.S. I am marking this status bug from "RESOLVED:INVALID" into "RESOLVED:WORKSFORME".

Thanks.