Created
July 13, 2016 21:52
-
-
Save authsec/a048fb1d1ade8004dd55f4ede17c077b to your computer and use it in GitHub Desktop.
Switch Roller from Derby to PostgreSQL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
TARGET=/opt/roller | |
TARGET_TMP=${TARGET}/tmp | |
DBNAME="rollerdb" | |
DBUSER="roller" | |
DBPASSWORD="roller" | |
echo "Switching to postgres ..." | |
echo "I hope you created the rollerdb before ..." | |
cd $TARGET/glassfish/domains/roller/lib | |
wget http://jdbc.postgresql.org/download/postgresql-8.3-604.jdbc3.jar | |
cd $TARGET/glassfish | |
./bin/asadmin delete-jdbc-connection-pool --cascade rollerpool | |
echo "Now wait, have to stop/start the container ..." | |
su - roller -c "cd glassfish; ./bin/asadmin stop-domain roller" | |
su - roller -c "cd glassfish; ./bin/asadmin start-domain roller" | |
./bin/asadmin create-jdbc-connection-pool --datasourceclassname org.postgresql.ds.PGSimpleDataSource --restype javax.sql.DataSource --property portNumber=5432:password=$DBPASSWORD:user=$DBUSER:serverName=localhost:databaseName=$DBNAME rollerpool | |
./bin/asadmin ping-connection-pool rollerpool | |
./bin/asadmin create-jdbc-resource --connectionpoolid=rollerpool jdbc/rollerdb | |
echo "Check for errors in output, if now, you have switched ..." | |
echo "If you receive errors like: Invalid user or password" | |
echo "You might want to try using ./bin/asadmin login in the $TARGET/glassfish dir" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment