Kevin McLaughlin
Member
Hello,
This site has been great as an information source for every problem I've run into so far, right up to where I am. Please assist if you can.
I've used B4J to create a mysqldump of the database using the shell. Now I'm trying to use the shell to restore the database. I've been getting intermittent results, so I'm not sure where I'm going wrong, but here is the code that I'm using so far:
Operating on Win10 OS
(Code is snipped to involve anything related to the shell.
Log output
(ArrayList) [--user=DBUserName, -pDBUserPassword, tabdb_schema < g:\kevin\coding\tdb\data\tabs\20160917.sql]
Restore Result: (true)
In the same function, but further up, is another shell command to uncompress the .zip which contains the .sql that I'm trying to execute. I've put in a 5 second delay just in case concurrency was an issue. The restore file is small (for now), so it shouldn't take any time.
I can run the command manually when going through cmd.exe and it does restore the database, so I'm pretty sure syntax is good.
When the command is run in B4J, the code continues without errors, but the database does not change. (I've removed one row from a table, before doing the restore in B4J. It doesn't get re-added when I run the line in B4J jshell, but it does get readded from the cmd shell)
The only time I got something which tells me it might not be running, is when I run it with restoreDBShell2.runwithoutputevents(-1) one time. I've recieved some output from std_out that contains the same output as though I've got a syntax error
Can anybody see / advise what I'm missing?
Thank you,
This site has been great as an information source for every problem I've run into so far, right up to where I am. Please assist if you can.
I've used B4J to create a mysqldump of the database using the shell. Now I'm trying to use the shell to restore the database. I've been getting intermittent results, so I'm not sure where I'm going wrong, but here is the code that I'm using so far:
Operating on Win10 OS
(Code is snipped to involve anything related to the shell.
B4X:
Dim args_Zip, args_SQL As List
Dim rs As ResultSet
Dim RestoreDBShell, RestoreDBShell2 As Shell
Dim ShellResult As ShellSyncResult
args_SQL.Initialize
args_SQL.Add("--user=" & DBUserName) ' Assign username
args_SQL.Add("-p" & DBUserPassword) ' Assign Password (Insecure methodology)
args_SQL.Add("tabdb_schema < "& TabDirectory & RestoreSQLfile) ' Database to restore to
Log(args_SQL)
RestoreDBShell2.Initialize("RestoreDBShell2", MySQL_Path, args_SQL)
RestoreDBShell2.WorkingDirectory = TabDirectory
ShellResult = RestoreDBShell2.RunSynchronous(-1)
Log(" Restore Result: (" & ShellResult.Success & ") " & ShellResult.StdOut)
Log output
(ArrayList) [--user=DBUserName, -pDBUserPassword, tabdb_schema < g:\kevin\coding\tdb\data\tabs\20160917.sql]
Restore Result: (true)
In the same function, but further up, is another shell command to uncompress the .zip which contains the .sql that I'm trying to execute. I've put in a 5 second delay just in case concurrency was an issue. The restore file is small (for now), so it shouldn't take any time.
I can run the command manually when going through cmd.exe and it does restore the database, so I'm pretty sure syntax is good.
When the command is run in B4J, the code continues without errors, but the database does not change. (I've removed one row from a table, before doing the restore in B4J. It doesn't get re-added when I run the line in B4J jshell, but it does get readded from the cmd shell)
The only time I got something which tells me it might not be running, is when I run it with restoreDBShell2.runwithoutputevents(-1) one time. I've recieved some output from std_out that contains the same output as though I've got a syntax error
Can anybody see / advise what I'm missing?
Thank you,