# Why do I keep getting a java.lang.NullPointerException General error in Base? [closed]

I have created over and over a very simple database to catalogue some artefacts for a conservation report. I use a simple form for data entry and everything seems to work for 4 or 5 entries until suddenly I get this message:

Κατάσταση SQL: S1000 Κωδικός σφάλματος: 40 S1000 General error java.lang.NullPointerException in statement [INSERT INTO "Πίνακας_Εγγραφές" ( "Κτήριο","Συνοικία","Τοίχος","Φωτό1","Χώρος") VALUES ( ?,?,?,?,?)]

or this:

Κατάσταση SQL: S1000 Κωδικός σφάλματος: 98 java.io.IOException: java.lang.NullPointerException in statement [INSERT INTO "Πίνακας_Εγγραφή" ( "Κτήριο","Συνοικία","Τοίχος","Υλικά_Κατασκευής","Φωτό1","Χώρος") VALUES ( ?,?,?,?,?,?)]

Form won't save and all the data is lost or tables don't open at all and I get this message:

Κατάσταση SQL: S1000 Κωδικός σφάλματος: 40 S1000 General error java.lang.NullPointerException in statement [SELECT * FROM "Πίνακας_Εγγραφές"]

At first I thought it might have something to do with interconnected tables and form with subform design but I get the same errors even with the simplest single table DB. Is Base temperamental or am I doing something terribly wrong?

Libreoffice 5.2.1.2 (x64) Windows 10 Java RE 1.8.0_102 installed and activated.

edit retag reopen merge delete

### Closed for the following reason the question is answered, right answer was accepted by Alex Kemp close date 2020-09-12 21:48:53.383010

Did you assign a primary key for the table "Πίνακας_Εγγραφές"?

( 2016-09-27 11:57:44 +0200 )edit

Yes, I did assign a primary key.

( 2016-09-28 23:00:08 +0200 )edit

Sort by » oldest newest most voted

It appears you are trying to save images in an embedded database. If so, you should either change to a split database or save links to the images instead of the a blob. Please see this post (click here) for further information.

more

Thank you for your answer. I'm going to give the split database a go although it's a bit complicated for a noob like myself. Not being able to change field properties after I save a table and having to use sql I find a bit daunting. If I go for the links to images scenario will I be able to copy the finished db and distribute it? Will I need to relink to new paths?

( 2016-09-28 23:10:05 +0200 )edit

Either approach you take will require more than one file for distribution. In the case of split database it is a folder with about a half dozen files and a couple of sub-folders. With the linked files, the linked images must go with and if set up correctly within a folder with the .odb may not need to be re-linked. I believe the split DB should always be used instead of the embedded DB regardless of whether saving images, links or any important data.

( 2016-09-29 01:24:19 +0200 )edit

I used the split database template you suggested and rebuilt my db linking my image files with a text field. I also used a connected image control to make image entry simpler. Everything is working great so far so thank you for your help. Have placed all image files inside an image folder which is in the same folder as frontend and backend db files. Judging from the path I see in the image text field, I'm guessing my final db will be distributable. Any other suggestions for proper folder setup?

( 2016-10-03 12:47:35 +0200 )edit

First of all, I'm glad all is working now. One thing to keep in mind, when saving, save the entire folder where the Split DB resides. All parts are necessary. However, now you are less likely to have any lost data problems which can (and does) occur with the embedded database. SQL is just another piece you need sooner or later anyway. Lots of on-line sites to assist there.