• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SQLite Java Insert Problem

 
Roman Billík
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello guys, i had a problem on Windows after .jar generating. i Cannot insert data to database, update get okey. In netbeans get insert right. JDBC driver seen be good. On linux get all right. Thanks for a help...
 
Roel De Nijs
Sheriff
Posts: 10666
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Roman Billík,

First of all, a warm welcome to CodeRanch!

Roman Billík wrote:i had a problem on Windows after .jar generating. i Cannot insert data to database, update get okey. In netbeans get insert right. JDBC driver seen be good.

If you would like to get some useful advice and maybe even an answer for your problem, you should (always) TellTheDetails. With the current information you have provided (which is almost none), it is impossible to know why you can't insert data into your database.

Kind regards,
Roel
 
Dave Tolls
Ranch Hand
Posts: 2112
16
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cross posted at the Java Forum.
 
Roman Billík
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i dont can see no errors, because in netbeans get all right... database file is on disk od D partition.
 
Roel De Nijs
Sheriff
Posts: 10666
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roman Billík wrote:i dont can see no errors, because in netbeans get all right...

And don't you see any errors if you run it outside NetBeans? That would be very wierd. How do you invoke your application when you run it outside NetBeans? Can you share the appropriate code snippet used to insert into the database?

Kind regards,
Roel

PS. Here at CodeRanch we are fine with cross-posting, however we ask you to disclose this. That way someone doesn't reproduce the effort in answering a question that has already been answered. Thanks for your friendly cooperation!
 
Roman Billík
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Outside i dont see any problems.
I insert into database text, which is extracted from PDF documents. This documents are in folder so i list folder by folder and insert data into database.
Here i list folder by folder:


and this is my insert into database file:


Database contains 12 tables... there all are in insert.. On linux get all rigth...thanks lot for a help
 
Dave Tolls
Ranch Hand
Posts: 2112
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so that's what works.
But what doesn't work?
Do you get errors, exceptions, what?

One thing I will note is that all your catch blocks are empty.
You are simply ignoring any exception you get.
You need to uncomment those printStackTrace lines, otherwise you'll never know if something has gone wrong.
 
Roman Billík
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In netbeans and in linux works all. But in windows nothing after .jar generating... no data are inserted into database. This row a had now commnented...they are realy uncomennted and no errors are there in NetBeans..thanks
 
Roel De Nijs
Sheriff
Posts: 10666
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wonder why all your exception handlers are empty and/or removed Why don't you have any error logging in your code? Are all required libraries on your class path when you are running the application as a JAR file on Windows?


As a side note: You have a lot of duplication in your code. For example, you have a bunch of this logicThis could be easily replaced by creating a method to convert value, something like thisUsing this method the above code snippet can be changed toLess code, less chances you make a copy/paste error, easier to maintain, if you need to change the logic to determine the database value, you only need to change on one place (instead of throughout whole your code),... Less is more!
 
Roman Billík
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For example detailHelper.getCopyrightValue() return string which ich copyrigt in pdf document, this text is extract by ApachePDFBox library,..
 
Dave Tolls
Ranch Hand
Posts: 2112
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roman Billík wrote:In netbeans and in linux works all. But in windows nothing after .jar generating... no data are inserted into database. This row a had now commnented...they are realy uncomennted and no errors are there in NetBeans..thanks


You keep saying that there are no errors in Netbeans, but you don't tell us what you see in Windows.

In Windows, when you run the jar file from the command line (so you can see any output), what do you see?
If you see nothing at all then I suggest adding some debugging so you can trace what your code is actually doing.
 
Roel De Nijs
Sheriff
Posts: 10666
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roman Billík wrote:For example detailHelper.getCopyrightValue() return string which ich copyrigt in pdf document, this text is extract by ApachePDFBox library,..

That doesn't matter at all for the refactor I suggested...
 
Roman Billík
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In CMD see i too nothing...could you help me resolve this problem..i will be very thankful
 
Roel De Nijs
Sheriff
Posts: 10666
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roman Billík wrote:In CMD see i too nothing...could you help me resolve this problem..i will be very thankful

Which command line invocation are you executing to run your JAR file?
 
Dave Tolls
Ranch Hand
Posts: 2112
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roman Billík wrote:In CMD see i too nothing...could you help me resolve this problem..i will be very thankful


But you've got loads of System.out.println() calls in there.
Something must be printing out.
 
Roman Billík
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Problem is solved...thanks a lot guys...
 
Roel De Nijs
Sheriff
Posts: 10666
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roman Billík wrote:Problem is solved...thanks a lot guys...

how did you have solved your problem? Your solution might help other ranchers facing a similar issue...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic