0

I have 2 projects in Eclipse. The first project calls a method from the second project handing it an object the second project shall write into an existing SQLite Database residing in the second project. However, I get the following error:

opening db: 'tomato.db': Zugriff verweigert

Zugriff verweigert is German for access denied.

How can I allow the db access from the first project to the database file tomato.db residing in the second project?

0

1 Answer 1

2

Solution

I use sqlite-jdbc from xerial. In their tutorial they get the database connection with this line:

  connection = DriverManager.getConnection("jdbc:sqlite:yourdatabasefile.db");

However, this doesn't work from another project in Eclipse. The solution is actually pretty trivial:

  connection = DriverManager.getConnection("jdbc:sqlite:C:\\path\\to\\your\\database\\file\\yourdatabasefile.db");

Another solution is to use the in-memory sqlite database like this:

connection = DriverManager.getConnection("jdbc:sqlite::memory:");

Hope this helps.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.