H2 database manual says:
The settings of the H2 Console are stored in a configuration file
called .h2.server.properties in you user home directory.
Is there any way to change the location of the configuration file to some specified directory?
You can use the -properties setting as documented in the Server tool, as follows:
java -jar h2.jar -properties "/directory"
Related
I am trying to use HSQLDB in server mode, but cannot get the ACL to work.
I started a server (creating a fresh database) with this command line:
java -cp $CLASSPATH:/usr/share/java/hsqldb.jar org.hsqldb.server.Server --database.0 file:~/workspaces/foo/db/fooserver --dbname.0 fooserver
I can connect to it with HSQL Database Manager and issue a SHUTDOWN.
Next, I created an ACL file in ~/workspaces/foo/db/fooserver.acl with the following content:
deny 127.0.0.1
I sucessfully tested it with java -cp $CLASSPATH:/usr/share/java/hsqldb.jar org.hsqldb.server.ServerAcl ~/workspaces/foo/db/fooserver.acl, and it tells me 127.0.0.1 is denied access.
Now I created ~/workspaces/foo/db/server.properties (as there was no server.properties file yet) with the following content:
server.acl=traffserver.acl
However, when I now launch the server, I can still connect to the database.
HSQLDB version is 2.4.1, as shipped with Ubuntu 18.04.
Other things I have tried:
This mailing list post suggests using server.acl_filepath instead of server.acl. Behavior is still the same.
I have tried adding either property to fooserver.properties. Still no effect, and the property gets deleted when I stop the server.
What am I missing?
First of all, if you use a server.properties file which is not located in the directory where you execute the java command, you should include the path to that properties file.
In the same scenario, in the server.properties file, you need to use the same path as you successfully tested. So it should be:
server.acl=~/workspaces/foo/db/fooserver.acl
It would be easier to specify the properties and acl files if you issue the java command from the directory that contains both files. In that case you can use a short filename instead of the full path.
See the Guide http://hsqldb.org/doc/2.0/guide/listeners-chapt.html
I have a bash script that connects to a mysql server and pulls information. I have my .my.cnf file in my home directory. I want to change the location of the .cnf file to ~myname/.my.cnf
My question is how do I reference this new location in my script or in my mysql call to the database?
Thanks
Here's the doc reference for how MySQL looks at Options Files:
https://dev.mysql.com/doc/refman/5.7/en/option-files.html
File Name Purpose
/etc/my.cnf Global options
/etc/mysql/my.cnf Global options
SYSCONFDIR/my.cnf Global options
$MYSQL_HOME/my.cnf Server-specific options (server only)
defaults-extra-file The file specified with --defaults-extra-file, if any
~/.my.cnf User-specific options
~/.mylogin.cnf User-specific login path options (clients only)
Note: you want to use defaults-extra-file option when connecting with mysql client. mysql --defaults-extra-file=~/path/to/file/.filename < script
You should consider using --login-path as an alternative. Login path reference. The file is not plain text. You use mysql_config_editor to create your login paths, which stores username, password, host, etc.
I don't know what you mean by "~myname/.my.cnf". This would expand to a directory made of a concatenation of your username and "myname" which doesn't make any sense. I guess you might mean "~/something/.my.cnf"
The '~' expands to $HOME hence simply redefining $HOME before invoking mysql should suffice (although this will confuse further references to '~'.
HOME=$HOME/myname
mysql <somescript.sql
I'm trying to locate data folder of mysql server 5.7
When I run this query
SHOW GLOBAL VARIABLES LIKE 'datadir';
I got my data dir path, but when I actually go there in c drive its not there.
Checked all hidden properties, all are fine.
Any help ?
It could be hidden. Default datadir on Windows 10 is C:\ProgramData which is normally hidden.
This link describes initializing the data directory on Windows or UNIX-like OSs.
For Windows
Because you have problems with finding the data directory I suggest you define it yourself.
First you have to make sure the following lines are in my.ini file:
[mysqld]
basedir=C:\\Program Files\\MySQL\\MySQL Server 5.7
datadir=D:\\MySQLdata # here you could put
The second line points to your MySQL Server installation. The third line to wherever you want your data directory to be. After saving the file. You could call following command:
C:\> bin/mysqld --defaults-file=C:\my.ini --initialize
With C:\my.ini pointing to your my.ini file. Hope this helps you
I am using IBM Integration Bus v.9
I try to read configuration from file, like this tutorial.
Based on the documentation, I've already set up my environment variable in Windows like this :
MQSI_FILENODES_ROOT_DIRECTORY to C:\MQSIFileInput
In the File Read Node properties, i set input directory to "config" (without apos), because the file located in C:\MQSIFileInput\config directories.
When I run, i got error "The directory config is not a valid directory name". What am I missing here?
Do I need to set up another configuration to read the file properly?
Thank you.
The MQSI_FILENODES_ROOT_DIRECTORY variable needs to be visible to the ExecutionGroup process at startup, so first thing to check is how did you set the env var and did you restart the broker?
Due to the way that processes are forked on windows the process for setting env vars is usually something like:
Stop broker
Close Broker Command Prompt
Modify mqsiprofile.cmd to include variable
Open new Broker Command Prompt
Verify env var is set ie/ echo %MQSI_FILENODES_ROOT_DIRECTORY%
Start Broker
The directory also needs to be readable by the Broker's process ID (and writable if you will be deleting the file or moving it to a backout dir etc).
I am trying to adopt Log4j2 to my project. Since my Java Application is packeted in a JAR file. I don't want "log4j2.xml" configuration packaged inside of JAR file. I am trying to learn how configuration file works from "http://logging.apache.org/log4j/2.x/manual/configuration.html"
But seems there is no clear instruction regarding altering the configuration file path of the Log4j2.
After googling about this topic I found something like "Referencing log4j config file within executable JAR" Referencing log4j config file within executable JAR, But this solution is not available any more according to "http://logging.apache.org/log4j/2.x/manual/migration.html" (if I understand it correctly).
So I am wondering if someone have any idea about this issue.
Thanks
You can set the system property to specify the configuration path.
set the
"-Dlog4j.configurationFile="D:\learning\blog\20130115\config\LogConfig.xml"
in VM arguments. replace
"D:\learning\blog\20130115\config\LogConfig.xml"
to your configuration path.
Put the log4j2.xml file in resource directory in your project so that the log4j will locate files under class path automatically.
Loading log4j2.xml file from the customized location-
You can use the System property/ VM arguments- Dlog4j.configurationFile=file:/path/to/file/log4j2.xml
This will work for any web application.
For some legacy applications, you can create a class for loading log4j2.xml/ log4j2.properties from the custom location on the machine like- D:/property/log4j2.xml
Using any of these approach,during application startup, the log4j2.xml file from the src/resources folder will be overridden by the custom location log4j.xml file.
Try using -Dlogging.config=Path_to_your_file