Android Tutorial Remote Database Connector (RDC) - Connect to any remote DB

Status
Not open for further replies.

slydog43

Member
Licensed User
Longtime User
The local one. Seems only to happen when I add records to a table in a loop. I have also tried a batch nonquery, but similar results. I must be missing something simple. Any samples with many batches operations?

Im trying to fill many tables locally from a remote database. it seems to fill the first table, maybe the second one, but then corrupts the db after I add more tables to be filled.

I also can't seem to populate a single table with a few thousand records from a MS-SQL database to sqlite on the phone. It gets corrupt everytime.

When I say corrupt I mean I can't copy the db file off the phone onto my PC and open with
the program SQLite Expert Personal 3.4.76.2306 which I can without populating it will many records. I can still seem to work with the database on the phone though. Very strange.
 
Last edited:

slydog43

Member
Licensed User
Longtime User
I can get my program to populate 10 tables (with only 10-100 records) without any issues, but when I try to populate a table with over 1000 records, I get a corrupt db. I have tried with MSSql and SQLite as the backend without changes. Can anyone successfully populate a sqlite db file on a phone from a remote database with more than 1000 records (with about 10 fields, text and numeric). Very frustrating, I'm so close I know, but I think I found a problem here.
 

slydog43

Member
Licensed User
Longtime User
I'm on to something I think, I can add 780 records, but when I get to 781 it corrupts the DB.

using this code

B4X:
Sub btnAddRecs_Click
  
    Dim iTempID As Int
    Dim iTempSEQ As Int
    Dim sTempDesc As String
    Dim sTempAbbrev As String
  
    mySQL1.BeginTransaction
    Try
        For i = 1 To 781 '500, 600, 750, 760, 770, 780  works, but 5000, 1000, 900, 800, 790, 785, 783, 781 does NOT  these number are from a blank body table
            iTempID = i
            iTempSEQ = i
            sTempDesc = "test" & i
            sTempAbbrev = i
            mySQL1.ExecNonQuery("INSERT INTO Body (BodyID, BodySEQ, BodyDesc, BodyAbbrev) VALUES (" & iTempID & ", " & iTempSEQ & ", '" & sTempDesc & "', '" & sTempAbbrev & "'" & ")")
        Next
        mySQL1.TransactionSuccessful
    Catch
        Log(LastException.Message)
    End Try
    mySQL1.EndTransaction
    Msgbox("Done","")
End Sub


erel, Did I find a bug?? I also tried without using transactions, but same trouble at the exact same number.
 
Last edited:

Endomi

Member
Licensed User
Longtime User
I don't understand how to return a query result.
After this line, how do I get the result of this query:
B4X:
reqManager.ExecuteQuery(cmd, 0, "cat 1")


Or is a result returned in this code?


B4X:
Sub JobDone(Job As HttpJob)
  If Job.Success = False Then
    Log("Error: " & Job.ErrorMessage)
  Else
    If Job.JobName = "DBRequest" Then
      Dim result As DBResult = reqManager.HandleJob(Job)
      If result.Tag = "cat 1" Then 'query tag
        For Each records() As Object In result.Rows
          Dim name As String = records(0) 'or records(result.Columns.Get("name"))
          Log(name)
        Next
      End If
    End If
  End If
  Job.Release
End Sub

If so, must I create a Job parameter, or does it exist in some other module so I can pass it as a parameter?
Thanks
 

Endomi

Member
Licensed User
Longtime User
I really struggle with this, but anyway.
Here is the code in my Log-In button, for the sake of being as simple as possible, I just query whether the user-name entered
already exists or not.

The "selectuserpwd" query just returns a count of records that match the entered user name.
Do you know how/where I can read the returned count of the query?

B4X:
Sub btnLogIn_Click
    Dim cmd As DBCommand
    cmd.Initialize
    cmd.Name = "selectuserpwd"
    cmd.Parameters = Array As Object(txtUser.Text)
    Dim sResult As String
    reqManager.ExecuteQuery(cmd, 1,txtUser.Text  )
End Sub
 

Endomi

Member
Licensed User
Longtime User
Thanks my problem is solved, I now see that the JobDone gets called implicitly.
 

somed3v3loper

Well-Known Member
Licensed User
Longtime User
I can not find the folder jdbc_driver .
Do free web host providers hide such folder?
Or should I create it?
I want to test it online not on my PC.
Thanks in advance
 

Carlos Bernardino

Member
Licensed User
Longtime User
Hi there!

Is it possible to use INNER JOINS on the SQL Commands included in the config.properties file?

Thanks in advance!
 

bashka_abdyli

Member
Licensed User
Longtime User
Is RDC possible to install on Goddady hosting site? If yes is there any tutorial ?

Thanks in advance,
 

Reviewnow

Active Member
Licensed User
Longtime User
Few questions.
Once RDC is started on server, How to stop? just close command window?

I have multiple databases for a single application, is there a way to set the database name dynamically? or can multiple instances of RDC run under different ports?

Restarting RDC on server reboot, automatically? Schedule Task?

Can RDC be restarted with a Remote Command

Please advise

Thanks so much...
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…