I'm trying to run a liquibase diff operation on two tables.
The operation appears to work fine as I can see all the comparisons happening in Command Prompt. The only issue I have is that no file is being output. Here's my code, I've added line breaks to help readability:
java -jar liquibase/liquibase.jar
--driver=com.mysql.jdbc.Driver
--classpath=/liquibase/changelog-generating/mysql-connector-java-5.1.13.jar
--changeLogFile=liquibase/local.table.changelog.xml
--url="jdbc:mysql://localhost/table1"
--username=root
--password=""
diff
--referenceUrl="jdbc:mysql://localhost/table2"
--referenceUsername=root
--referencePassword=""
When I run the command without the diff and reference variables, I do receive an output file.
Access to the databases work without password (it is only local host after all).
Liquibase is installed in C:/liquibase
I'm using Windows Vista
Sorted. Was missing the...
generateChangeLog
at the end of the command.
Related
I'm trying to use wpcli on xampp on windows, and following this tutorial -> https://lmilosis.wordpress.com/2020/01/26/19/
My issue arises entering this command
wp core config --dbname=wpcli_testing --dbuser=root --dbpass= --dbhost=localhost --dbprefix=wp_
Which results in ->
'"mysql --no-defaults --execute="' is not recognized as an internal or external command,
operable program or batch file.
I have added exactly the following to the end of my system environment variable ;C:\xampp\mysql\bin;C:\xampp\php, but this has not helped the issue.
I'm trying to install SQL script(SSDT) using SQLCMD - as this script contains to many SSDT definitions and cannot be run by the WIX SQL extension.
i want my SQL script file to be binary(as i don't want it to stay on target machine)
how can i set the SQLCMD command to use the binary script (with -i)?
p.s.
i tried this blog:
http://neilsleightholm.blogspot.co.il/2008/08/executing-sqlcmd-from-wix.html##
but this code don't shows the link between the binary SQL file and the SCLCMD command.
can someone help me with the correct code?
this is the code i used, which did not work for me
<Binary Id="CreateSchema.sql" SourceFile="..\SQL\CreateSchema.sql" />
<CustomAction Id="sqlcmd.cmd"
Property="sqlcmd"
Value=""sqlcmd.exe" -S [DATABASE_SERVER]
-i "[#CreateSchema.sql]" -v var=SYSTEM_USER -o [INSTALLDIR]installSql.log" />
<CustomAction Id="sqlcmd"
BinaryKey="WixCA"
DllEntry="CAQuietExec"
Return="check"
Execute="deferred"
Impersonate="yes" />
<InstallExecuteSequence>
<Custom Action="sqlcmd.cmd" After="InstallFiles">NOT Installed</Custom>
<Custom Action="sqlcmd" After="sqlcmd.cmd">NOT Installed</Custom>
</InstallExecuteSequence>
the log file showed that -i parameter did not had any file name value:
MSI (s) (4C:6C) [09:58:15:610]: Executing op: CustomActionSchedule(Action=sqlcmd,ActionType=1025,Source=BinaryData,Target=CAQuietExec,CustomActionData="sqlcmd.exe" -S (local) -i "" -v var=SYSTEM_USER -o C:\installSql.log)
That's not how <Binary> works. The [#FileID] syntax is used to dynamically use the at runtime installation full path of a component's file.
Binaries are used typically as temporary extracted files for custom actions or, in this case, sql files among other things.
Consider looking into the SQL Extension in wix. As a minimal example take a look at this code.
Add the sql namespace xmlns:sql="http://schemas.microsoft.com/wix/SqlExtension"
<Binary Id="CreateSchema" SourceFile="..\SQL\CreateSchema.sql" />
<sql:SqlDatabase Id="MyDB" Database="[DATABASE]" Server="[DATABASE_SERVER]" />
And in a component you can add
<sql:SqlScript Id="CreateSchemaScript" BinaryKey="CreateSchema" ExecuteOnInstall="yes" Sequence="1" SqlDb="MyDB"/>
Here is a link to the SQL Schema definition with all the available elements. I haven't done much with the SQL Extension so you may need to do some reading to get a better idea of what you will need to do to accomplish creating your DB on install.
As i mentioned i wanted to use both SQLCMD - since my SQL script is SSDT format, and binary file(so file will be deleted in end of the install).
After looking for answers i understood that i cannot use the WiX [#filekey], as binary file will not be extracted as long as there is no custom action that is running - using it explicitly.
So in the end i understood that the best way is to extract the binary file by my self.
the steps i used in one single custom action are:
extract binary SQL script from MSI binary table.
save this file locally
run SQLCMD with -i and new file path(the one i save to)
delete the SQL file
I encounter some issues, worth mentioned, if you save the file to INSTALLDIR than the directory may not exist at the tun time of the custom action, so consider save it to temp folder or to create directory beforehand.
I am building an installer for our product which works well. I've managed to build custom actions to install our services including a MySQL server.
The problem I have is executing a sql file to build the schema structures.
I have a custom action which uses mysql.exe and the command line arguments:
--port=### --user=### --password=### < "[INSTALLDIR]db\EmptyStruct.sql"
It tries to execute this ok but the cmd window which pops up, during the install, just runs through the mysql.exe command line options, which says to me that the command line it gets passed is not correct. However if I run the command manually after the install, it works perfectly.
Does anyone has any ideas please.
I'm making a few assumptions here:
You have a Windows Installer exe custom action that specifies mysql.exe and a command line as you showed
You are expecting the contents of [INSTALLDIR]db\EmptyStruct.sql to be redirected to mysql.exe's standard input
This will not happen. Behind the scenes, Windows Installer's exe custom action support uses the CreateProcess API and this API will interpret command lines literally. However the redirect < needs special handling to actually perform redirection.
To get that behavior, you must use a layer of indirection. For example, you could run cmd.exe as the exe, and give it a command line that will make it interpret and run the command line mysql.exe --port= ... < "[INSTALLDIR]...". However, if you didn't already have a command prompt showing, this would cause one to show up. If you want to avoid that, you could write a custom wrapper that performs the redirection for you, either as a C++ DLL or, say, InstallScript action.
Alternately, if there is a parameter that tells mysql.exe to run a script from a file, you could pass that instead of using redirection. I wasn't able to find evidence of such a parameter in a quick web search.
Thanks for your comments Michael and I used cmd.exe /k AddStruct.bat to accomplish the task!
I'm working on a project that require me to use window task scheduler to execute mysql query, this is the batch file content:
mysql -ufoo -pbar -D %1 < %2
when I tested the batch file via cmd:
task_sheduler.bat dbName pathToSqlFile
I get:
mysql -ufoo -pbar -D dbName 0<pathToSqlFile
I just want to say that its working, my question is what is about the extra space and the 0, where did they came from?
The extra space is between the dbName and 0
I'm using Windows 7 Ultimate Service Pack 1 (x64)
I assume your Batch file does NOT have an #echo off command, so you refer to the echo of commands that appear in the screen when a Batch file is executed. The display of these commands frequently include additional characters that cmd.exe inserts to display exactly the executed commands.
In the case of redirections, <input is a short form of Stdin redirection, and the number of Stdin is zero, so the real redirection is 0<input. The same happens with >output, that is echoed as 1>output. cmd.exe also remove multiple spaces from the original code and insert needed ones in order to clearly show the executed commands.
If you want not to see these command expantions, just insert an #echo off command at beginning of your Batch file.
cmd prefixes all redirection commands by the default handle if none is provided. The handles are defined here. 0<file thus means that we want file to be redirected to standard input. The extra space is there to prevent a command like hi.exe<myfile from being wrongly interpreted as hi.exe0 < myfile
Ive got a rather strange issue, ive got an automated build tool that is calling through to the mysql command line to teardown then setup a database from an SQL file.
On one computer it is working fine, and its basically calling:
Mysql -h {Connection::Host} -u {Connection::User} --password={Connection::Password} < {sqlFile}
Ive just checked it out on another computer and tried to build and it keeps giving me the error "The system cannot find the file specified.". The MySQL versions are the same 5.1 and no other files have changed. The only thing that i know is different is where the build files are deployed... at home they are deployed to:
d:/code/projects/xxxxx/
whereas on this computer that doesn't work it is deployed to:
c:\Documents and Settings\xxxxxx\My Documents\Projects\Other\xxxxxx\
The interwebs brought back a few possibilities such as the spaces within the path, however ive tried adding the -i to the command (ignore spaces) and it made no difference.
Anyone have any ideas?
It's most likely the spaces in the path. The part after the space will be passed to the program as a different parameter.
Try surrounding {sqlFile} with double quotes.
Mysql .... < "{sqlFile}"