Knowage BI - SQL Server DataSource - mssql-jdbc

I have a question about knowage (opensource BI software - www.knowage-suite.com).
Can anyone tell me how create DataSource with a SQL Server connection?
Regards,
Tomasz

0> put MSSQL JDBC driver into `./<your_knowage_installation_directory>/lib` folder
1> log in (on web-UI) as administrator
2> data source
3> click on red '+' sign
4> give a label and choose your dialect (SQL-Server)
5> fill your credential (need SQLSErver auth, not active directory)
6> insert into JDBC this: `jdbc:sqlserver://<YOUR_SERVER_IP>`
7> insert `com.microsoft.sqlserver.jdbc.SQLServerDriver` as driver
8> create your dataset as a query (remember `use <your_db_name>` at the beginning of your query)
link to MSSQL jdbc drivers

Below are given steps for installing Knowage and setting up DB.
Install MySQL
1.
sudo apt-get install mysql-server
2.
Modified /etc/mysql/mysql.conf.d/mysqld.cnf and changed
from
bind-address = 127.0.0.1
to
bind-address = *
3.
mysql -u root -p
ALTER USER 'root'#'%' IDENTIFIED BY ''mypswd ';
GRANT ALL PRIVILEGES ON * . * TO 'root'#'%' IDENTIFIED BY ''mypswd';
FLUSH PRIVILEGES;
service mysql restart
Install Java
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
sudo apt-get install oracle-java8-set-default
export JAVA_HOME=/usr/lib/jvm/java-8-oracle
export PATH=$JAVA_HOME/bin:$PATH
Install Knowage
1. Download Knowage
wget http://download.forge.ow2.org/knowage/Knowage-6_2_0-RC-CE-Installer-Unix-20180509.zip
unzip Knowage-6_2_0-RC-CE-Installer-Unix-20180509.zip
2. Create Swap Memory (https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-16-04)
sudo swapon --show
free -h
df -h
sudo fallocate -l 4G /swapfile
ls -lh /swapfile
sudo chmod 600 /swapfile
ls -lh /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
sudo swapon --show
free -h
Setup Knowage
sh Knowage-6_2_0-RC-CE-Installer-Unix-20180509.sh -c
Used existing MySQL DB and it created knowage_ce with following tables.
Add Database Source in conf/server.xml
<Resource name="jdbc/knowage" auth="Container"
type="javax.sql.DataSource"
driverClassName="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost:3306/knowage_ce"
username="root"
password="mypswd"
maxActive="20" maxIdle="10"
maxWait="-1"/>
Download MySQL Connector and copy to lib dir
cp mysql-connector-java-5.1.46.jar /home/babbarkrishan/knowage/Knowage-Server-CE/lib/
start the knowage server in /bin
sh startup.sh
Hope it will resolve your problem.
Regards,
Krishan

Related

Why encryption key is not working in Postgresql TDE during install? "Unknown data received from encryption_key_command"

I'm trying to install the Postgresql TDE from Cybertech (https://www.cybertec-postgresql.com/), specifically version 9.6.12.
I followed the entire guide for default installation:
$ wget https://download.cybertec-postgresql.com/postgresql-9.6.12-tde.tar.gz
$ sudo apt-get install libreadline-dev zlibc zlib1g-dev bison flex libssl-dev openssl libperl-dev python-dev
I've created a shell /opt/pg_key.sh with this content:
#!/bin/sh
echo 882fb7c12e80280fd664c69d2d636913
$ chmod +x /opt/pg_key.sh
$ tar xvfz postgresql-9.6.12-tde.tar.gz
$ cd postgresql-9.6.12-tde/
$ ./configure --prefix /usr/local/pgsql/ --with-openssl --with-perl --with-python
$ sudo make install
$ cd contrib/
$ sudo make install
$ sudo chown user:user /usr/local/pgsql/data/
$ initdb -D /usr/local/pgsql/data/ -K /opt/pg_key.sh
I've got an error in this last command:
The files belonging to this database system will be owned by user
"user". This user must also own the server process.
The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8". The
default text search configuration will be set to "english".
Data page checksums are disabled.
Data encryption is enabled.
fixing permissions on existing directory /usr/local/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
running bootstrap script ... FATAL: Unknown data received from encryption_key_command
child process exited with exit code 1
initdb: removing contents of data directory "/usr/local/pgsql/data"
Thanks in advance

There is no cubedata.h and contrib directory in Postgresql

I has 128-dimensional vectors of float (face recognition issue). To store these vectors I use datatype cube in Postgresql.
This type has limit by default - 100 dim.
In the psql (PostgreSQL) 10.5 (Ubuntu 10.6-0ubuntu0.18.04.1) this limit don't work: I can store my vector without any problems.
But yeasterday one of my machine was updated to PostgreSQL 10.6 and now I receive an error when try to add new cube-vector into my database. Error about too long vector.
To resolve this problem I have to change this limit in the file cubedata.h which is in contrib directory. But I have no this file and such directory at all!
I try install
sudo apt-get install postgresql-contrib
but, I get the message about the newest postgresql-contrib version is already installed.
After I tried to manually download cubedata.h file into the directory of Postgresql (/usr/share/postgresql/10/extension/), but it doesn't help.
My be someone encountered with such problem?
In Ubuntu 18.04.1 cubedata.h included in the postgres-server-dev-10 package from the PostgreSQL official repository. But prebuilt cube.so included in the postgresql-10 package with default limit.
To increase the limit you should recompile cube.so from source. Below the example of code for the Ubuntu.
Add repository:
PG_VER=10.6
source /etc/os-release
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
echo "deb http://apt.postgresql.org/pub/repos/apt/ ${VERSION_CODENAME}-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list
sudo apt-get update
sudo apt-get install -y postgresql-${PG_VER%.*}
Compile cube extension from source:
PG_VER=10.6
sudo apt-get install -y unzip gcc make zlib1g-dev libreadline-dev postgresql-server-dev-${PG_VER%.*} bison flex
wget https://ftp.postgresql.org/pub/source/v${PG_VER}/postgresql-${PG_VER}.tar.bz2 --quiet -O postgresql.tar.bz2
tar xvf postgresql.tar.bz2
cd postgresql-${PG_VER}
./configure
cd contrib/cube
sed -i 's/#define CUBE_MAX_DIM (100)/#define CUBE_MAX_DIM (128)/' cubedata.h
make USE_PGXS=1
sudo make USE_PGXS=1 install
Check result after restart server:
sudo -u postgres psql dbname -c 'CREATE EXTENSION cube'
sudo -u postgres psql dbname -c 'SELECT cube_dim(cube(array(select generate_series(1, 128)))) as dim'

Enable Postgis extension Postgres in Dockerfile

How can i enable the Postgis extension in a Dockerfile? The Postgres installation is already working
this is the command in Ubuntu:
sudo -u postgres psql -c "CREATE EXTENSION postgis;"
My Dockerfile:
# Set the base image to Ubuntu
FROM ubuntu:14.04
# Update the repository sources list
RUN apt-get update -y
################## BEGIN INSTALLATION ######################
# Postgres with Postgis
# Install wget
RUN apt-get install wget -y
# Setup Postgres repository
RUN wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
# Add Postgres repository
RUN sh -c "echo "deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main" >> /etc/apt/sources.list.d/postgresql.list"
# Update repository
RUN apt-get update -y
# Install Postgres with Postgis
RUN apt-get install postgresql-9.3-postgis-2.1 -y
# Change rights for start Postgresql
RUN chmod +x /etc/init.d/postgresql
# Start Postgresql
CMD service postgresql start && tail -F /var/lib/postgresql/data/serverlog
The solution for enable an extension
# Enable Postgis
RUN service postgresql start \
&& sudo -u postgres psql -c "CREATE EXTENSION postgis;"
RUN service postgresql stop
If you see other Dockerfiles using that psql -c command, like apache/marmotta Dockerfile, you will see lines like:
RUN service postgresql start \
&& psql --command "CREATE USER $DB_USER WITH PASSWORD '$DB_PASS';" \
&& psql --command "CREATE DATABASE $DB_NAME WITH OWNER $DB_USER;"
USER root
RUN service postgresql stop
In other words, you need to make sure the postgresql service is running for those commands to succeed.

How to install webacula 7 on centos 7

this is a tutorial to install webacula 7 (after bacula 7 with mysql)
this is the tutorial for centos+bcula that i used (without webmin section)
http://www.backupcentral.com/phpBB2/two-way-mirrors-of-external-mailing-lists-3/bacula-25/howto-install-bacula-7-on-centos-7-fresh-install-126395/
Then to install webacula:
yum install httpd php php-mysql php-gd
wget http://downloads.sourceforge.net/project/webacula/webacula/7.0.0/webacula-7.0.0.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fwebacula%2F%3Fsource%3Dtyp_redirect&ts=1429012567&use_mirror=garr
(download webacula 7.0.0)
yum install httpd php php-mysql
tar -xzvf /root/webacula-7.0.0.tar.gz\?r\=http...
mv webacula-7.0.0 /var/www/
mv /var/www/webacula-7.0.0/ /var/www/webacula
chown -R root.root .
chown apache.apache cache
groupadd bacula
usermod -aG bacula apache
chgrp bacula /usr/sbin/bconsole
/etc/bacula/bconsole.conf
chgrp bacula /etc/bacula/bconsole.conf
cd ../application
nano config.ini
update:
bacula.bconsole = "/usr/sbin/bconsole"
bacula.bconsolecmd = "-n -c /etc/bacula/bconsole.conf"
nano /etc/sudoers
comment:
# Defaults requiretty
nano /etc/bacula/bconsole.conf
update:
Password = "YOUR PASS"
nano /etc/selinux/config
update:
SELINUX=disabled
nano /etc/sudoers.d/apache
add:
apache ALL=NOPASSWD: /usr/sbin/bconsole
reboot (because the selinux)
check with this command:
su -l apache -s /bin/sh -c "/usr/bin/sudo /usr/sbin/bconsole -n -c /etc/bacula/bconsole.conf"
normal respons :
Connecting to Director localhost:9101
1000 OK: 1 bacula-dir Version: 7.0.5 (28 July 2014)
Enter a period to cancel a command.
*quit
cd /var/www/webacula/install/apache/
cp webacula.conf /etc/httpd/conf.d/webacula.conf
nano /etc/httpd/conf.d/webacula.conf
update:
Alias /webacula /usr/share/webacula/html
<Directory /usr/share/webacula/html>
...
Deny from all
to:
Alias /webacula /var/www/webacula/html
<Directory /var/www/webacula/html>
...
Allow from all
nano /var/www/webacula/application/config.ini
update your db pass
nano /etc/bacula/bacula-dir.conf
update :
catalog = all, !skipped, !saved
cd /var/www/webacula/install
./password-to-hash.php your bacula webming pass
take ther respons and put in:
nano db.conf
update:
db_pwd="your root mysql pass"
....
webacula_root_pwd="your res from ./password-to-hash.php"
cd MySql/
./10_make_tables.sh
./20_acl_make_tables.sh
systemctl restart httpd
add Zend to webacula:
cd /var/www/webacula/library
wget https://packages.zendframework.com/releases/ZendFramework-1.12.3/ZendFramework-1.12.3-minimal.tar.gz (download only ver 1.12.3!!!!!!)
tar -xzf ZendFramework-1.12.3-minimal.tar.gz
mkdir Zend
cp -Rf ZendFramework-1.12.3-minimal/library/Zend/* Zend/.
go to website :)
now we finished but for me the root password did not work, so to fix this i did:
mysql -uroot -p
use bacula;
update webacula_users set email='your email here';
go to website and reset password

Postgresql 9.2 pg_dump version mismatch

I am trying to dump a Postgresql database using the pg_dump tool.
$ pg_dump books > books.out
How ever i am getting this error.
pg_dump: server version: 9.2.1; pg_dump version: 9.1.6
pg_dump: aborting because of server version mismatch
The --ignore-version option is now deprecated and really would not be a a solution to my issue even if it had worked.
How can I upgrade pg_dump to resolve this issue?
Check the installed version(s) of pg_dump:
find / -name pg_dump -type f 2>/dev/null
My output was:
/usr/pgsql-9.3/bin/pg_dump
/usr/bin/pg_dump
There are two versions installed. To update pg_dump with the newer version:
sudo ln -s /usr/pgsql-9.3/bin/pg_dump /usr/bin/pg_dump --force
This will create the symlink to the newer version.
I encountered this while using Heroku on Ubuntu, and here's how I fixed it:
Add the PostgreSQL apt repository as described at "Linux downloads (Ubuntu)
". (There are similar pages for other operating systems.)
Upgrade to the latest version (9.3 for me) with:
sudo apt-get install postgresql
Recreate the symbolic link in /usr/bin with:
sudo ln -s /usr/lib/postgresql/9.3/bin/pg_dump /usr/bin/pg_dump --force
The version number in the /usr/lib/postgresql/... path above should match the server version number in the error you received. So if your error says, pg_dump: server version: 9.9, then link to /usr/lib/postgresql/9.9/....
Macs have a builtin /usr/bin/pg_dump command that is used as default.
With the postgresql install you get another binary at /Library/PostgreSQL/<version>/bin/pg_dump
You can just locate pg_dump and use the full path in command
locate pg_dump
/usr/bin/pg_dump
/usr/bin/pg_dumpall
/usr/lib/postgresql/9.3/bin/pg_dump
/usr/lib/postgresql/9.3/bin/pg_dumpall
/usr/lib/postgresql/9.6/bin/pg_dump
/usr/lib/postgresql/9.6/bin/pg_dumpall
Now just use the path of the desired version in the command
/usr/lib/postgresql/9.6/bin/pg_dump books > books.out
You can either install PostgreSQL 9.2.1 in the pg_dump client machine or just copy the $PGHOME from the PostgreSQL server machine to the client machine. Note that there is no need to initdb a new cluster in the client machine.
After you have finished installing the 9.2.1 software, remember to edit some environment variables in your .bash_profile file.
If you're on Ubuntu, you might have an old version of postgresql-client installed. Based on the versions in your error message, the solution would be the following:
sudo apt-get remove postgresql-client-9.1
sudo apt-get install postgresql-client-9.2
If you have docker installed you can do something like:
$ docker run postgres:9.2 pg_dump books > books.out
That will download the Docker container with Postgres 9.2 in it, run pg_dump inside of the container, and write the output.
On Ubuntu you can simply add the most recent Apt repository and then run:
sudo apt-get install postgresql-client-11
Every time you upgrade or re install a new version of PostgreSQL, a latest version of pg_dump is installed.
There must be a PostgreSQL/bin directory somewhere on your system, under the latest version of PostgreSQL that you've installed ( 9.2.1 is latest) and try running the
pg_dump from in there.
For those running Postgres.app:
Add the following code to your .bash_profile:
export PATH=/Applications/Postgres.app/Contents/Versions/latest/bin:$PATH
Restart terminal.
For Macs with Homebrew. I had this problem when fetching the db from Heroku. I've fixed it just running:
brew upgrade postgresql
For mac users
put to the top of .profile file.
export PATH="/Applications/Postgres.app/Contents/MacOS/bin:$PATH"
then run
. ~/.profile
An alternative answer that I don't think anyone else has covered.
If you have multiple PG clusters installed (as I do), then you can view those using pg_lsclusters.
You should be able to see the version and cluster from the list displayed.
From there, you can then do this:
pg_dump --cluster=9.6/main books > books.out
Obviously, replace the version and cluster name with the appropriate one for your circumstances from what is returned by pg_lsclusters separating the version and cluster with a /. This targets the specific cluster you wish to run against.
For me the issue was updating psql apt-get wasn't resolving newer versions, even after update. The following worked.
Ubuntu
Start with the import of the GPG key for PostgreSQL packages.
sudo apt-get install wget ca-certificates
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
Now add the repository to your system.
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
Install PostgreSQL on Ubuntu
sudo apt-get update
sudo apt-get install postgresql postgresql-contrib
https://www.postgresql.org/download/linux/ubuntu/
As explained, this is because your postgresql is in old version -> update it
For Mac via homebrew:
brew tap petere/postgresql,
brew install <formula> (eg: brew install petere/postgresql/postgresql-9.6)
Remove old postgre:
brew unlink postgresql
brew link -f postgresql-9.6
If any error happen, don't forget to read and follow brew instruction in each step.
Check this out for more: https://github.com/petere/homebrew-postgresql
The answer sounds silly but if you get the above error and wanna run the pg_dump for earlier version go to bin directory of postgres and type
./pg_dump servername > out.sql ./ ignores the root and looks for pg_dump in current directory
I had same error and this is how I solved it in my case.
This means your postgresql version is 9.2.1 but you have started postgresql service of 9.1.6.
If you run psql postgres you will see:
psql (9.2.1, server 9.1.6)
What I did to solve this problem is:
brew services stop postgresql#9.1.6
brew services restart postgresql#9.2.1
Now run psql postgres and you should have: psql (9.2.1)
You can also run brew services list to see the status of your postgres.
This worked for me, a collection of solutions from above and other sites. If you specified a version like postgressql-client-11 before then you need to remove that version first.
sudo apt-get remove -y postgresql-client
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo apt-get update
sudo apt-get install -y postgresql-client-12
I was facing the same issue. I used docker instead of upgrading pg_dump.
run following command to create a Docker container of postgres 14.2, or any other version as you like.
sudo docker run --name mac_postgres -p 5444:5432 -e POSTGRES_PASSWORD=password -d postgres:14.2
Then take dump using following command. Note: you should change the host, port, username and password according to your actual database credentials.
sudo docker exec -it mac_postgres pg_dump --host=xxxxx0.b.db.ondigitalocean.com --port=250xx --username=doadmin --dbname=test --password > out.sql
After entering password. Your dump will be ready in out.sql file. Then you can delete the docker-container.
sudo docker stop mac_postgres
sudo docker rm mac_postgres
If you're using Heroku's Postgres.app the pg_dump (along with all the other binaries) is in /Applications/Postgres.app/Contents/MacOS/bin/
so in that case it's
ln -s /Applications/Postgres.app/Contents/MacOS/bin/pg_dump /usr/local/bin/pg_dump
or
ln -s /Applications/Postgres.app/Contents/MacOS/bin/* /usr/local/bin/.
to just grab them all
** after install postgres version is match(9.2)
Create a symbolic link or new shortcut
**- on '/usr/bin'
syntag is = sudo ln -s [path for use] [new shortcut name]
example
sudo ln -s /usr/lib/postgresql/9.2/bin/pg_dump new_pg_dump
-- how to call : new_pg_dump -h 192.168.9.88 -U postgres database
Try that:
export PATH=/usr/local/bin:$PATH
If the database is installed on a different machine it has probably correct version of pg_dump installed. This means that you can execute pg_dump command remotely with SSH:
ssh username#dbserver pg_dump books > books.out
You can also use public key authentication for passwordless execution. Steps to achieve that:
Generate (if not yet done) a pair of keys with ssh-keygen command.
Copy the public key to the database server, usually ~/.ssh/authorized_keys.
Test if the connection works with ssh command.
Well, I had the same issue as I have two postgress versions installed.
Just use the proper pg_dump and you don't need to change anything, in your case:
$> /usr/lib/postgresql/9.2/bin/pg_dump books > books.out
For macs, use find / -name pg_dump -type f 2>/dev/null find the location of pg_dump
For me, I have following results:
Applications/Postgres.app/Contents/Versions/9.5/bin/pg_dump
/usr/local/Cellar/postgresql/9.4.5_2/bin/pg_dump
If you don't want to use sudo ln -s new_pg_dump old_pg_dump --force, just use:
Applications/Postgres.app/Contents/Versions/9.5/bin/pg_dump to replace with pg_dump in your terminal
For example:
Applications/Postgres.app/Contents/Versions/9.5/bin/pg_dump books > books.out
It works for me!
On my scenario the production version was 12, and my development version was 11, upgrading the package postgresql-client-xx was enough to solve my incident.
Reference web page : https://www.postgresql.org/download/linux/ubuntu/
sudo apt-get update && sudo apt-get -y upgrade postgresql-client
One interest thing to point out is that after the upgrade the previous version kept installed :
mlazo#mlazo-pc:~$ dpkg -l |grep -i postgresql-client
ii postgresql-client-11 11.8-1.pgdg18.04+1 amd64 front-end programs for PostgreSQL 11
ii postgresql-client-12 12.4-1.pgdg18.04+1 amd64 front-end programs for PostgreSQL 12
Hope my experience would be helpful to someone.
Greetings,
I had the same message, for me it was that I had to adjust the following:
export LD_LIBRARY_PATH=/usr/pgsql-12/lib:....
export LD_RUN_PATH=/usr/pgsql-12/lib:.....
First step: see if postgres has a repository with prebuilt binaries for the version you want for your OS: https://www.postgresql.org/download/
If that doesn't work (for instance if your distro is there but is no longer supported, so correct binaries aren't provided for it), or if you just want to go straight or the source and not have to worry about adding remote repo's, etc.
What I did is download the raw source of postgres for the desired version.
Untar it, cd into it, build it ./configure && make, then:
postgresql-12.3 $ find . -name pg_dump
./src/bin/pg_dump/pg_dump
$ ./src/bin/pg_dump/pg_dump
unable to load libpg.so.5 # if it says this...
$ find . -name libpg.so.5
$ export LD_LIBRARY_PATH=/your/path/to/the/shared/dir/of/above/file
$ ./src/bin/pg_dump/pg_dump # works now
Now you have access to any version that builds on your box. Which should be any.
Full steps tutorial
Your local version needs to match the one used by AWS on the remote server.
Unfortunately, apt-get install will lag behind the official release.
So you need to proceed the following way:
sudo apt-get remove postgresql
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
Then check your error message should be something like
pg_dump: server version: 12.3; pg_dump version: 10.16 (Ubuntu 10.16-0ubuntu0.18.04.1)
So it means you want version 12 (and not 13), for the install of the matching version by specifying the version number (without minor) during your fresh install:
sudo apt-get -y install postgresql-12
Now it works:
pg_dump -h {{endpoint}} -U {{username}} -f dump.sql {{tablename}}
NB: You get the endpoint in Connectivity & security go to https://us-east-2.console.aws.amazon.com/rds/home?region=us-east-2 and click on your DB instance
For Ubuntu 20.04 with the "official" postgresql repo, moving from pg12 to pg13, I had to do this:
sudo apt purge postgresql-12
This was very hard for me to pinpoint. I had played with a variety of these packages:
postgresql-client
postgresql-client-common
postgresql-##
postgresql-client-##
postgresql-server-dev-##
pgadmin