Skip to content

Instantly share code, notes, and snippets.

@milendyankov
Last active May 29, 2020 17:28
Show Gist options
  • Save milendyankov/57d0891bc8345c75a499674d02ab9fbd to your computer and use it in GitHub Desktop.
Save milendyankov/57d0891bc8345c75a499674d02ab9fbd to your computer and use it in GitHub Desktop.
#!/bin/sh
DIR=`pwd`
URL=`grep -h jdbc.default.url /opt/liferay/*.properties | sed s#.*jdbc.default.url=##`
USER=`grep -h jdbc.default.username /opt/liferay/*.properties | sed s#.*jdbc.default.username=##`
PASS=`grep -h jdbc.default.password /opt/liferay/*.properties | sed s#.*jdbc.default.password=##`
SQLLINE="sqlline.jar"
DB_DRIVER="mysql-connector-java.jar"
mkdir -p /tmp/sqlline
cd /tmp/sqlline
if [ ! -f "$SQLLINE" ]; then
curl https://repo1.maven.org/maven2/sqlline/sqlline/1.9.0/sqlline-1.9.0-jar-with-dependencies.jar --output $SQLLINE
fi
if [ ! -f "$DB_DRIVER" ]; then
curl https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.20/mysql-connector-java-8.0.20.jar --output $DB_DRIVER
fi
java -cp $SQLLINE:$DB_DRIVER sqlline.SqlLine -d com.mysql.jdbc.Driver -u $URL -n $USER -p $PASS
cd $DIR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment