hi.
Which method of connecting to the database is optimal?
My focus is on memory usage.
1-Persistent connection
Connects to the database from the start of the program and does not close until the end of the program.
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
2- Intermittent connection
Connect when needed and disconnect immediately after operation
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
			
			Which method of connecting to the database is optimal?
My focus is on memory usage.
1-Persistent connection
Connects to the database from the start of the program and does not close until the end of the program.
			
				B4X:
			
		
		
		'mainform
public SQL1 as SQL
sub start
    SQL1.InitializeSQLite("", DBFullPath , False)
end sub
sub mainform_closed
  SQL1.close
end sub
--------------------------------------------
'use in other classes and modules
   main.SQL1.ExecNonQuery(......)2- Intermittent connection
Connect when needed and disconnect immediately after operation
			
				B4X:
			
		
		
		'creat class DBManageClass
private SQL1 as SQL
sub Initialize
   SQL1.InitializeSQLite("", DBFullPath , False)
end sub
sub ExQuery()
 ...............
end sub
sub disconnect
   SQL1.close
end sub
--------------------------------------------
'use in other classes and modules
   dim c1 as DBManageClass
   c1.Initialize
   c1.ExQuery(......)
   c1.disconnect
  
   dim c2 as DBManageClass
   c2.Initialize
   c2.ExQuery(......)
   c2.disconnect 
				 
 
		 
 
		 
 
		 
 
		