Other jShell: MySQLDump.exe (does not work) vs. batch file (works)

KMatle

Expert
Licensed User
Longtime User
I'm trying to use jShell to run MySQLDump.exe to dump a database:

B4X:
DumpDB.Initialize("DumpDB","C:/xampp/mysql/bin/mysqldump.exe" , _
           Array As String("-u root","-pxxxxx#","dbname","> ", "C:\xampp\htdocs\enctrans\Dumps\test.sql" ))

It fails with:

Error: mysqldump.exe: Got error: 1045: "Access denied for user ' root'@'localhost' (using password: YES)" when trying to connect

When I start a batch file via jShell, it works:

jShell
B4X:
DumpDB.Initialize("DumpDB","C:\xampp\htdocs\enctrans\SQLDump.bat",Null)

Batch file "SQLDump.bat"
B4X:
C:\xampp\mysql\bin\mysqldump -u root -pxxxxx# dbname > "C:\xampp\htdocs\enctrans\Dumps\test.sql"

I assume the process doesn't need to have admin rights (or has it) because the script DOES run under the same process.

Of course I tried any re-arrangement of the array (values). The format seems to be ok. Any ideas?
 

DonManfred

Expert
Licensed User
Longtime User
if you run a bat file. shouldn´t the process started not be cmd.exe?

Away from that i would directly use mysqldump with the correct parameters.
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
if you run a bat file. shouldn´t the process started not be cmd.exe?

Away from that i would directly use mysqldump with the correct parameters.

Parameters should be ok.

The bat file works without using cmd on WIN10. And yes, the goal is to call mysqldump.exe directly over jShell.

But using cmd is definetly worth a try.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
The bat file works without using cmd on WIN10
Windows has registered the extension and call cmd for you.
This is something other than using jshell.

You can use
B4X:
fx.ShowExternalDocument("file:/C:xampp\htdocs\enctrans\SQLDump.bat")
and let windows decide which app to open (windows will use cmd i guess).
 
Upvote 0

OliverA

Expert
Licensed User
Longtime User
I think each portion of the parameter must be separate.
B4X:
Array As String(“-u”, “root”, “-p”, “xxxxx”, .... and so on )
Note: posting this from phone, so wrong quotes are used. Do not copy and paste this code sample.
 
Upvote 0

KMatle

Expert
Licensed User
Longtime User
I think each portion of the parameter must be separate.
B4X:
Array As String(“-u”, “root”, “-p”, “xxxxx”, .... and so on )
Note: posting this from phone, so wrong quotes are used. Do not copy and paste this code sample.

:D I tried "all" combinations including host name and port. I even started B4J as an administrator. Parameters are fine. Anyway. Now I'm using that bat file from above which works (= start *.bat via jShell)
 
Upvote 0
Top