Android Question [Solved] Converting csv file to db file

Shelby

Active Member
Licensed User
Hi All,
I've wasted lot of time trying to find a workable tool to covert a larger than the original database edited Excel worksheet csv file into a db file for my SQLite project. I've tried Klaus's tool at https://www.b4x.com/android/forum/threads/csv-to-sqlite-program.87061/ but it's too advanced for me to use. I've tried the fishcode tool suggested by Rboeck at https://fishcodelib.com/DBMigration.htm and I didn't succeed there either. I've tried the google solution from sqlitetutorial.net. I simply want to convert my edited Excel csv file>.db by renaming the existing db file and replacing it in my project files folder. What can I do? Thanks
P.S. my project compiles fine and here it is.

Help me Obie One Klausnobie (Star Warrior)
 

Attachments

  • SS2021 - Copy.zip
    1.8 KB · Views: 72
Last edited:

Mahares

Expert
Licensed User
It's true that I used my project instead of yours but the result is the same.
I have cleaned up all the comments to make it easier for you to navigate. Please download this project, unzip and compile. You should see the data displaying in the table like that screenshot I had in post#73. The Samsung S9 is a good phone. Please do not send anymore videos, I do not need them., but please run the attached project. The database is called: dbirc.db, the table in the database is called: TableList221. The 4 columns names and their aliases in the table are: DescriptionSubjectLookup, TableNumber as
, PageIRC As [IRC Page], PgPDF As [PDF Page]
 

Attachments

  • Shelby020621.zip
    100 KB · Views: 47
Upvote 0

Shelby

Active Member
Licensed User
It didn't display. After touching Install Window, the window displays App not installed.
My project goes one step farther to "Open" button
 
Upvote 0

Shelby

Active Member
Licensed User
Great, thanks MJ.
Will do
Unfortunately, after finding and uninstalling B4A Example, my phone still won't display my app, as it did a few days ago.
 
Last edited:
Upvote 0

Shelby

Active Member
Licensed User
I see that in my phone's Apps (in settings), I have 4 instances of "IRC Example" files. Is there a possibility that they could be causing problems for me? Well, I uninstalled all but the largest one. Still same no display of app on phone.
 
Last edited:
Upvote 0

Mahares

Expert
Licensed User
I see that in my phone's Apps (in settings), I have 4 instances of "IRC Example" files
Do you have in the settings an app showing you a label: B4A Example. If you do, that is the one you need to uninstall. . Then reinstall my app. My app has a label: B4A Example. Usually programmers have more than one device, if you do, try to install it on another Android phone or tablet
 
Upvote 0

Shelby

Active Member
Licensed User
Yes, MangoJack had that same idea yesterday (post # 83). Consequently, I uninstalled it and tried my two published app projects which displayed fine; the present problem projects do not display. Now the "B4A Example" app does not reappear in the apps list on the phone after I run the project.
Thank you for the idea of running the project on another phone. My S9 is my first android device. Unfortunately, I'm in an iPhone family but I'll keep that in mind. I'll try my emulator again.
On my emulator, I used your first project sent to me and here's the error message:

Installing file to device. Error
adb: failed to install SS2021_RAPID_DEBUG.apk: Failure [INSTALL_FAILED_VERSION_DOWNGRADE]

Now I'll try the second project you gave me with my emulator.
Nope: error message:
Installing file to device. Error
adb: failed to install SS2021_RAPID_DEBUG.apk: Failure [INSTALL_FAILED_VERSION_DOWNGRADE]
 
Last edited:
Upvote 0

Mahares

Expert
Licensed User
Now the "B4A Example" app does not reappear
Did you get my app to work or not. It should have installed on your phone without any problems. I have a Samsung phone and tablets and all work fine with that app. MangoJack was able to install my app ok also. If you go it to work, did you see the table like in post 48.
If it still does not work for you, please answer:
Does it install but it does not display the table or does it not install on the phone. Which of the two?
 
Last edited:
Upvote 0

Shelby

Active Member
Licensed User
The projects install but disappear after that.
I think you must be referring to your image in post 73. Remember, I have had my table displaying for a few weeks (since Jan 8th or so). I know exactly what it looks like with the light blue and grey record backgrounds. Neither of your edited gift projects has displayed so far. Your second project goes through one less step than the first one did. All my projects of this table now will not display since Thursday, after post # 48 when Klaus first had me add and, or edit out lines. That's not a blaming comment, I can't find anything I accidentally removed or added so far.
 
Last edited:
Upvote 0

Mahares

Expert
Licensed User
The projects install but disappear after that.
I don't know what you mean by: 'The projects install but disappear after that.'. Maybe someone more knowledgeable can help you. All I can say is the project I posted for you worked for me using your data that klaus helped you convert to a table on 2 tablets and a Samsung phone, It also worked for Mangojack and possibly some others that downloaded it. Your problem does not seem insurmountable. It is a very common type of app that should be seamless all around.
 
Upvote 0

Shelby

Active Member
Licensed User
Thanks Mahare,
On my API I click run with my b4a bridge active.
A box appears on my phone, I click install.
A new box appears saying open.
I click open and within a second, the box disappears and only the b4A bridge box is left.
Usually, at the click of open, the table appears.
Thanks for all your energy, generous messages and the zipped projects.
It appears to me as though something in the phone is not allowing the previously successful display to return.
 
Upvote 0

klaus

Expert
Licensed User
Some questions and remarks:
1. You get this message :
adb: failed to install SS2021_RAPID_DEBUG.apk: Failure [INSTALL_FAILED_VERSION_DOWNGRADE]
This message means that you still have the same application installed on the device with a newer version !!!
2. When you open the program on the device you say that it crashes directly.
Then, there must be an error message in the Logs, why don't give us this message.
This would guide us to the problem !
3. Why did you add the ScrollView2D.jar and the table.jar files to your project?
4. Where did you save the ScrollView2D.jar and ScrollView2D.xml files?
These must be in the Additional Libraries folder you defined in the Path Configuration window.
5. The Table class in your project is version 2.19.
The latest version in the forum is 3.26 !?

Now, please test the attached project following the steps below:
1. Download the zip file.
2. Save it in a new folder.
3. Unzip it.
4. Run the B4A IDE.
5. Load the program file SS2021V11.b4a
6. Do NOT make any modification !
7. Run it in Debug mode.
8. What happens ?
9. What do you get in the Logs ?

The screenshot of the attached project on my Samsung Galaxy S10.

1612772366859.png


PS:
I use USB debugging.
You might also migrate to USB debugging instead of B4A-Bridge.
It is simpler, no need to confirm each time the installation.
 

Attachments

  • SS2021V11.zip
    42.2 KB · Views: 50
Upvote 0

Shelby

Active Member
Licensed User
Thanks for all those ideas. I'll start to understand and attempt all those directions when I wake up fully. I'm not sure how to run usb debugging but I'll try. If it's debugging with wire connecting phone to computer, I already do that half the time; I vacillate between wifi and wire.

1. You get this message :
adb: failed to install SS2021_RAPID_DEBUG.apk: Failure [INSTALL_FAILED_VERSION_DOWNGRADE]
This message means that you still have the same application installed on the device with a newer version !!!
***The changing of the apk I will attempt
2. When you open the program on the device you say that it crashes directly. **Yes, after I click install, then click open.

Then, there must be an error message in the Logs, why don't give us this message? *** I have given the first 3 lines several times here. I don't seem to be able to copy the entire message. I have to copy one line at a time but I'll keep trying.
This would guide us to the problem ! *** Great

3. Why did you add the ScrollView2D.jar and the table.jar files to your project? *** The code uses the ScrollView2D word in the Table Module, and the error message said "where is the ScrollView2D file or library (I forgot the exact message, it was a month ago) so I added it. I dont know why I even have the Table.jar file. It was an experiment when I trying to convert the CSV to a db file with DB Browser or some other program.

4. Where did you save the ScrollView2D.jar and ScrollView2D.xml files? *** I put them in the project's 'Files' folder.
These must be in the Additional Libraries folder you defined in the Path Configuration window. ***I didn't know they should be in the additional libraries folder. I didn't know they were libraries.

5. The Table class in your project is version 2.19.
The latest version in the forum is 3.26 !? ***I don't know anything about a Table class. I would have to research it and find that different version. I'll start by seeing what info I can get in the libraries manager.
 
Upvote 0

Shelby

Active Member
Licensed User
Here's the error you said would help, but this is from my present project, not the new one you sent in post 92; I'll set up your new project now. Still, I don't know how to upgrade the apk. I'll check the original tutorial on B4A setup. Also, I'll click your link above about changing my table class version.


Error:

PackageAdded: package:b4a.IRC
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Error occurred on line: 1989 (Table)
android.database.sqlite.SQLiteException: near "tblIRC": syntax error (code 1 SQLITE_ERROR[1]): , while compiling: SELECT DocNo as Doc, Description, TableNo as
, IRCPage As [IRC Page], PDFPage As [PDF Page] tblIRC
at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:1372)
at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:811)
at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:590)
at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:62)
at android.database.sqlite.SQLiteQuery.<init>(SQLiteQuery.java:37)
at android.database.sqlite.SQLiteDirectCursorDriver.query(SQLiteDirectCursorDriver.java:46)
at android.database.sqlite.SQLiteDatabase.rawQueryWithFactory(SQLiteDatabase.java:1967)
at android.database.sqlite.SQLiteDatabase.rawQuery(SQLiteDatabase.java:1906)
at anywheresoftware.b4a.sql.SQL.ExecQuery2(SQL.java:223)
at anywheresoftware.b4a.sql.SQL.ExecQuery(SQL.java:211)
at b4a.IRC.table._loadsqlitedb(table.java:280)
at b4a.IRC.main._activity_create(main.java:429)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:732)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:351)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:255)
at java.lang.reflect.Method.invoke(Native Method)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:144)
at b4a.IRC.main.afterFirstLayout(main.java:105)
at b4a.IRC.main.access$000(main.java:17)
at b4a.IRC.main$WaitForLayout.run(main.java:83)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:8167)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:496)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1100)
** Activity (main) Resume **
 
Upvote 0

klaus

Expert
Licensed User
First points !
1. Setup a folder for the additional libraries and save the two files for the ScrollView2D library there.
The update of the Table class can be done afterwards if needed.

2. Then test the project in post #92.
 
Upvote 0

Shelby

Active Member
Licensed User
I created the additional libraries folder in the project folder>files. I copied the ScrollView2D xml file and the ScrollView2D Executable Jar File and placed them into that new addtl libs folder. I'll wait to see if you object and then run the project. Those 2 files were created in 2016. Sounds surprising but again, I'll run the project in a couple of minutes.
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
When you open the IDE and load the project from post #92, you should see the ScrollView2D library in the Libraries Manager.

1612800144789.png
 
Upvote 0

Shelby

Active Member
Licensed User
The table immediately appeared with the full 219 records for the first time. Thank you.

I know this has been frustrating for you to straighten out the mismanagement of my project. Thanks for not just abandoning me. You have shown that you have a lot of class (integrity) to stick with me.
 
Last edited:
Upvote 0

klaus

Expert
Licensed User
I was sure that this project would work.
Because I changed almost all names, Application Label, Package name, DB file name etc. to be sure that there are no older files nor projects coming in conflict on your device !

I know this has been frustrating for you ...
Oh yes !
Almost 100 posts to get something easy being solved is abnormal !
Why ?
I suggest you to answer yourself these questions:
1. Do I understand what I am doing ?
2. Did I explain in detail my problem ?
3. Did I give all information the helpers need ?
4. Do I really read carefully and follow all the advises I were given ?

A good reading might be this chapter 2.4 Ask a question in the forum in the B4X Help tools Booklet.
 
Upvote 0
Top