1

I am making a simple example Java Swing application but when I run it on another PC it shows data fine but cannot save any data and it gives this exception:

java.sql.SQLException: attempt to write on read-only database

How should I do to make it writeable. I am using the NetBeans IDE for a Java Swing app.

rghome
  • 8,529
  • 8
  • 43
  • 62
Hamza Zahid
  • 19
  • 1
  • 1
  • 7
  • 2
    How do you access the database? Usually this will be some sort of url looking string like jdbc:sqlite:/path/to/db. According to [this post](http://stackoverflow.com/questions/4574303/java-sqlite-how-to-open-database-as-read-only) you've got to work to make it read only - unless you don't write permission to the database file. – stdunbar Aug 23 '16 at 21:54
  • Welcome to StackOverflow! For us to help out with your question, we'll need more context: check out the guidelines on [How to Ask a Good Question](http://stackoverflow.com/help/how-to-ask), and include more steps on the code needed to reproduce the problem, the system you're working on, and what you've tried so far (including links to related questions). We'd like to help, but need you to help make this clearer! – emunsing Aug 23 '16 at 22:20
  • Where is the database located? Show some code including the JDBC url. If I had to guess you are trying to open a database that is inside your application jar, which means it will be readonly. – Mark Rotteveel Aug 26 '16 at 14:58
  • Yes Mark Rotteveel Sir the database if located in the same folder where my jar file is placed....but when i removed that file from the folder and place it in other folder its work on only my PC but it give error on client PC – Hamza Zahid Aug 30 '16 at 17:42

2 Answers2

1

Just right click on your application &

Run as administrator

Nirmitha
  • 11
  • 2
-2

It is not advised to use SQLLite as a remote database.

Please see this article on appropriate uses for SQLite: http://www.sqlite.org/whentouse.html

It is recommended that you use a traditional RDBMS for this type of situation.

If you must connect remotely you'd have to use SSH or something similar. I'm not sure that this is achievable through Java.

Darren
  • 1,774
  • 4
  • 21
  • 32
  • The OP asked about SQLLite, not MySQL. SQLLite is embedded only. – stdunbar Aug 23 '16 at 21:51
  • Oh I didn't even think to notice because he said he was attempting to connect remotely. I'll edit my answer. – Darren Aug 23 '16 at 21:55
  • I still don't think this is correct. The question appears to want to use a SQLite database locally in the app. And the app is running on various computers. The database isn't remote, and SQLite isn't a server, so that doesn't make sense – OneCricketeer Aug 24 '16 at 02:58