Android Question I need to open and use an existing SQL database file which is established by a tool like DB Browser

AndyChang

Member
Licensed User
I am new here

I'm going to ask a very junior question

I need to open and use an existing SQL database file which is established by a tool like DB Browser for SQLite.

The file nail.db is in my PC and is created by using DB Browser for SQLite.

1. According to SQLITE Tutorial, I execute step by step and finish the JDBC Driver installation.

1) Download SQLite JDBC Driver sqlite-jdbc-3.8.11.2.jar (success)

2) Download NetBean and create a new project then add SQLite JDBC Driver JAR file to a Java project. (success in every step) (I don’t know the reason to process these steps)

3) Copy sqlite-jdbc-3.8.11.2.jar to C:\Program Files (x86)\Java

4) Add Library SQL through windows - Libraries manager

2. I write a test program to check the very first step whether the file nail.db can be initialized well. But I am not luck. It failed in the compile stage.

The B4A source file, SQLite Database file, my PC's system info and the error message are as attached.

3. This is the first step I have to walk over. Please give me a hand. Thanks a lot.
 

Attachments

  • source.txt
    803 bytes · Views: 273
  • My PC's system info.png
    My PC's system info.png
    31 KB · Views: 228
  • Error msg.png
    Error msg.png
    38 KB · Views: 289
  • data structure.png
    data structure.png
    43.7 KB · Views: 282
  • data.png
    data.png
    35 KB · Views: 246

DonManfred

Expert
Licensed User
Longtime User
The B4A source file
From the IDE use File-Export as zip and upload this zip.
3) Copy sqlite-jdbc-3.8.11.2.jar to C:\Program Files (x86)\Java
most probably not correct.
Librarys or jar you want to use in B4A should be copied to the Additional Libraries folder.
 
Upvote 0

lemonisdead

Well-Known Member
Licensed User
Longtime User
I would like to add that the SQL library would handle the file, I guess
 
Upvote 0

Emme Developer

Well-Known Member
Licensed User
Longtime User
if is it a SQLite database, why you can't put it simpy on files and open it using SQL library?
Another advice, when you initialize a Sql, sql variable should be place in process globals
 
Upvote 0

afields

Member
Licensed User
hello! i think that you are a little confused. So:
the data you want to access can be in 2 diferent places: in a androd (1) or in pc (2).
if it's the first case then you nedd to read al least those post:
https://www.b4x.com/android/forum/threads/6736/#content ( this one to show how you can work in android with sql)
https://www.b4x.com/android/forum/threads/31540/#content (this one to show how you can work with another way to store data in android)
if what you want is access data from the pc then this post will help you:
https://www.b4x.com/android/forum/threads/31540/#content ( this one to show how you can remotly access a datasbase such as mariadd ou sql server or...)
on the other hand, if you want to make a pc program to access those data then .....b4j is the correct way
but if you want to make a program to access data in android then b4a is inidcated. In such case, you only need to check the correct library you need to work in the b4a ide.
 
Upvote 0
Top