How to create mysql connection pool using asadmin tool on GlassFish server?

I am trying to use the following command to create a mysql connection pool in GlassFish, but it keeps telling me that the create-jdbc-connection-pool command did not complete. Please help me. 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 assume that the required parameter is missing; so what are the required parameters needed for my assumption?

+6
source share
4 answers

Perhaps this is a typo, but referring to this blog , only the --property should be surrounded by double quotes, for example 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 

Also, note the use of escape characters in this example.

+5
source

Flag this blog post :

  • it uses a federated data source (which IMO needs)
  • check the escape line of the .property line.

Alternatively, to get around the trouble, look here :

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

those. specify a connection without using a JDBC URL.

+4
source

use the following command for mysql connection pool using asadmin utility glassfish

[Glassfish installation directory] / bin / asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlDataSource --restype javax.sql.DataSource --property User = [db_username]: Port = 3306 : Password = [db_password]: Url = "jdbc: mysql: // [localhost or ip]: 3306 / [db_name]" [bunch_name]

db_username is your database username

db_password - password of your database

db_name - database name

pool_name is all you want

Example

./asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlDataSource --restype javax.sql.DataSource --property User = admin: Port = 3306: Password = admin: Url = " jdbc: mysql: //127.0.0.1: 3306 / \ test "test_pool

0
source

The following two things solved the same problem for me. It:

1) use \ only for escape characters in a glass box.

2) try to give a command in one line, for example

 create-jdbc-connection-pool --datasourceclassname=org.apache.derby.jdbc.ClientDataSource --restype=javax.sql.DataSource --property portNumber=1527:password=APP:user=APP:serverName=localhost:databaseName=sun-appserv-samples:connectionAttributes=\;create\\=true SamplePool 
0
source

Source: https://habr.com/ru/post/891968/


All Articles