GlassFish MySql connection pool with empty password

The default mysql database server password is empty, which is convenient in development mode, but turns out to be trouble when creating a jdbc connection pool in GlassFish. There seems to be no way to specify an empty password either in admingui or asadmin.

One workaround is to use a temporary password (say, "xxx") when creating the connection pool, stop the domain, open $GLASSFISH_HOME/domains/domain1/config/domain.xml, and replace "xxx" with ""

This should work with all versions of GlassFish (v1, v2, and v3). To do it with script:

$GLASSFISH_HOME/bin/asadmin start-domain

$GLASSFISH_HOME/bin/asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlXADataSource --property user=root:password=xxx:DatabaseName=test:ServerName=localhost:port=3306 mysql-pool
$GLASSFISH_HOME/bin/asadmin create-jdbc-resource --connectionpoolid mysql-pool jdbc/test

$GLASSFISH_HOME/bin/asadmin stop-domain

cd $GLASSFISH_HOME/domains/domain1/config
cat domain.xml | sed "s/xxx//" > domain.xml.replaced
mv domain.xml domain.xml.original
mv domain.xml.replaced domain.xml

$GLASSFISH_HOME/bin/asadmin start-domain
vi/vim is also well suited for this type of search-replace:
vim domain.xml


vitamine k said...

Setting an empty value for the connection pool. While creating the pool in GUI, I do not face a trouble creating the pool with an empty password. But while pinging or setting a password with empty string, i get the "No Password Credential found" and "Property password cannot be removed" errors respectively. The access denied is got as there are no privileges for the user. You should try to grant privileges using

Unknown said...

Great and Useful Article.

Online Java Training

Java Online Training India

Java Online Course

Java EE course

Java EE training

Best Recommended books for Spring framework

Java Interview Questions

Java Course in Chennai

Java Online Training India

Unknown said...

I enjoyed on reading your blog post. Very interesting to read this article.I would like to thank you for the efforts you had made for writing this awesome article. Please visit my website, Friv 4000 Games is where all the free friv games.
Friv 4000

Oliver Maurice said...

You need to examine this post https://philosophyessay.org/my-philosophy-in-life-essay-example-topics-suggestions/ for some interesting ideas and suggestions for essay topics. This info could save you int he future

fuel digital vignesh said...

Hii, This is Great Post !
Thanks for sharing with us!!!!
I would highly appreciate if you guide me through this.
Thanks for the article…
Best Digital Marketing Agency in Chennai
Best SEO Services in Chennai
seo specialist companies in chennai
Brand makers in chennai
Expert logo designers of chennai
Best seo analytics in chennai
leading digital marketing agencies in chennai
Best SEO Services in Chennai