B4J Question Database Server Processing

Jmu5667

Well-Known Member
Licensed User
Hello

I currently have a VB6 application that process's record from an SQL database. As VB6 can only do process one record at a time I want to convert it to B4J and process multiple records simultaneously.

From reading other post about multi threading in B4J everything will run on the main thread unless you use JServer and create a background worker thread which could poll the DB and process a record, but I am still only able to process one record at a time.

I would like a separate thread to process each record.

Is there a method of achieving what I want to do ?

Regards

John.
 

inakigarm

Well-Known Member
Licensed User
Hello

I currently have a VB6 application that process's record from an SQL database. As VB6 can only do process one record at a time I want to convert it to B4J and process multiple records simultaneously.

From reading other post about multi threading in B4J everything will run on the main thread unless you use JServer and create a background worker thread which could poll the DB and process a record, but I am still only able to process one record at a time.

I would like a separate thread to process each record.

Is there a method of achieving what I want to do ?

Regards

John.
For better understanding...
1) what is process record, update or insert multiple records in a DB ? (maybe begin - End Transaction is what you need)
2) Are there many clients- apps that can update-insert records simultaneusly on DB or there is only one client-app? (jRDC2 environement)
 

Jmu5667

Well-Known Member
Licensed User
For better understanding...
1) what is process record, update or insert multiple records in a DB ? (maybe begin - End Transaction is what you need)
2) Are there many clients- apps that can update-insert records simultaneusly on DB or there is only one client-app? (jRDC2 environement)
There are no client connections, the app polls the database for records to process. I just want to know if there is a method in B4J where I can have a class running in it own thread to process the record, this would allow me process multiple records instead of processing one at a time. This is about converting an existing system from vb6 to b4j.
 

OliverA

Expert
Licensed User
For SELECT statements, use ExecQueryAsync (https://www.b4x.com/b4j/help/jsql.html#sql_execqueryasync) and for everything else use ExecNonQueryBatch (https://www.b4x.com/b4j/help/jsql.html#sql_execnonquerybatch). Combined with wait for, this should give you good performance. If the DB is located on another machine, you can now use connection pooling without the usage of jServer (see https://www.b4x.com/android/forum/threads/jconnectionpool-connectionpool-extracted-from-jserver.107776/). For pool size, I would stay under 10, but testing should determine optimal pool size (https://www.b4x.com/android/forum/threads/database-connection-pool-question.39816/).

Update: Additional link: https://www.b4x.com/android/forum/threads/b4x-sql-with-wait-for.79532/#content
 
Top