Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Switch Roller from Derby to PostgreSQL
#!/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
You can’t perform that action at this time.