SQLite - file too big??

boten

Active Member
Licensed User
Longtime User
I have a SQLite DB (created on PC, using SQLite manager, tables imported from CSV file).
The size of the DB file is about 8MB.

I'm trying to write an app to use it.
The first thing I'm testing is:

B4X:
Sub Process_Globals
Dim MYDB As String  : MYDB="myfile.db"
Dim MyDir As String
End Sub

Sub Globals
End Sub

Sub Activity_Create(FirstTime As Boolean)
MyDir=File.DirInternal
If Not(File.Exists(MyDir,MYDB)) Then
   Log("about to copy from " & File.DirAssets & " to " & MyDir)
   File.Copy(File.DirAssets,MYDB,MyDir,MYDB)
End If

......
.....
End Sub

The File.Copy fails (creating 0 length file in target directory)
log is:
B4X:
about to copy from AssetsDir to /data/data/boten.db0/files

main_activity_create (java line: 262)
java.io.IOException
   at android.content.res.AssetManager.readAsset(Native Method)
   at android.content.res.AssetManager.access$700(AssetManager.java:36)
   at android.content.res.AssetManager$AssetInputStream.read(AssetManager.java:571)
   at anywheresoftware.b4a.objects.streams.File.Copy2(File.java:336)
   at anywheresoftware.b4a.objects.streams.File.Copy(File.java:325)
   at boten.db0.main._activity_create(main.java:262)
   at java.lang.reflect.Method.invokeNative(Native Method)
   at java.lang.reflect.Method.invoke(Method.java:521)
   at anywheresoftware.b4a.BA.raiseEvent2(BA.java:165)
   at boten.db0.main.afterFirstLayout(main.java:84)
   at boten.db0.main.access$100(main.java:16)
   at boten.db0.main$WaitForLayout.run(main.java:72)
   at android.os.Handler.handleCallback(Handler.java:587)
   at android.os.Handler.dispatchMessage(Handler.java:92)
   at android.os.Looper.loop(Looper.java:123)
   at android.app.ActivityThread.main(ActivityThread.java:4627)
   at java.lang.reflect.Method.invokeNative(Native Method)


   at java.lang.reflect.Method.invoke(Method.java:521)
   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
   at dalvik.system.NativeStart.main(Native Method)
java.io.IOException

Unfiltered log shows:
B4X:
Default buffer size used in BufferedOutputStream constructor. It would be better to be explicit if an 8k buffer is required.
Data exceeds UNCOMPRESS_DATA_MAX (8519680 vs 2097152)
main_activity_create (java line: 262)

So how can I use DB (or for that matter any other file) biggher than about 2MB (2097152)
 

mc73

Well-Known Member
Licensed User
Longtime User
Try changing your db's extension to .jpg and use it there after in your code.
 
Upvote 0

boten

Active Member
Licensed User
Longtime User
Works like charm. Thanks guys. There's something new to learn every day :sign0060:
 
Upvote 0
Top