B4X:
#Region Project Attributes
#MainFormWidth: 600
#MainFormHeight: 400
#AdditionalJar: ucanaccess-4.0.4.jar
#AdditionalJar: hsqldb.jar
#AdditionalJar: jackcess-2.1.11.jar
#AdditionalJar: commons-logging-1.1.3.jar
#AdditionalJar: commons-lang-2.6.jar
#End Region
Sub Process_Globals
Private gSQL As SQL
Private DBFile As String
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("test")
MainForm.Show
'
DBFile = File.DirApp & "\B4JTEST1.MDB"
Try
gSQL.Initialize("net.ucanaccess.jdbc.UcanaccessDriver", "jdbc:ucanaccess://" & DBFile & ";memory=true")
Dim Cursor As ResultSet
Cursor = gSQL.ExecQuery("SELECT * from PLU")
Do While Cursor.NextRow
Log(Cursor.GetString("PLUNO") & "." & Cursor.GetString("PNAME"))
Loop
Catch
Log(LastException.Message)
End Try
End Sub
If there is a table named PLU(only 10 records.) in b4jtest1.mdb.
It only takes 2 seconds to execute the above program.
But. If there is a table named PLU(only 10 records) and HIST table(have 100,000 records) in b4jtest1.mdb
It need takes 40 seconds to execute the above program.
Why do I just read the PLU table, if there are other tables in the database, it will slow down?
Is there a solution?
Thank you!