Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create a mysql connection pool using asadmin tool in GlassFish server?

I am trying to use the following command to create a mysql connection pool in GlassFish but it keeps telling me Command create-jdbc-connection-pool failed. Please help me. The command:

asadmin create-jdbc-connection-pool \
--datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlDataSource \
--restype javax.sql.DataSource \
--property "User=root:Password=...:URL=jdbc\:mysql\:\/\/localhost:3306\/wcms_3" \
connection_pool

I guess that there is a missing required parameter; so what are the required parameters needed if my guess was true?

like image 669
Magdi Saeed Avatar asked Jul 04 '11 14:07

Magdi Saeed


2 Answers

Maybe it's a typo but referring to this blog only the URL-part of the --property has to be surrounded by double quotes, such as:

asadmin create-jdbc-connection-pool
        --datasourceclassname oracle.jdbc.pool.OracleDataSource 
        --restype javax.sql.DataSource 
        --property user=dbuser:password=dbpassword:url="jdbc\\:oracle\\:thin\\:@localhost\\:1521\\:ORCL" oracle-pool

Furthermore notice the use of escape characters in this example.

like image 163
Matt Handy Avatar answered Nov 15 '22 13:11

Matt Handy


Check out this blog post:

  • he uses the pooled datasource (which IMO is necessary)
  • check the escaping of the --property string.

Alternatively, to circumvent escaping woes have a look here:

 --property user=root:password=test:DatabaseName=test:ServerName=localhost:port=3306

ie, specify the connection without using a JDBC URL.

like image 20
fvu Avatar answered Nov 15 '22 11:11

fvu