Ubuntu

Glassfish 上的 JDBC 連接池詳細資訊

  • October 16, 2014

為 Entity Classes 配置會話 Beans的上下文中,我可以從Ubuntu 上的Glassfish v4 獲得一些關於從 CLI 的 JDBC 連接池的基本資訊asadmin,但想通過 CLI 獲得更多詳細資訊:

thufir@dur:~$ 
thufir@dur:~$ glassfish-4.1/glassfish/bin/asadmin
Use "exit" to exit and "help" for online help.
asadmin> 
asadmin> list-jdbc-connection-pools
CLI031: Warning: Option "target" is obsolete and will be ignored.
CLI031: Warning: Option "target" is obsolete and will be ignored.
__TimerPool
DerbyPool
SamplePool
connectionPool
legacy_on_glassfish
Command list-jdbc-connection-pools executed successfully.
asadmin> 
asadmin> ping-connection-pool legacy_on_glassfish
Command ping-connection-pool executed successfully.
asadmin> 
asadmin> list-jdbc-resources
jdbc/sample
jdbc/__TimerPool
jdbc/__default
jdbc/local
jdbc/legacy_resource
Command list-jdbc-resources executed successfully.
asadmin> 
asadmin> exit
Command multimode executed successfully.
thufir@dur:~$ 

如何通過 Web 界面獲取完整的詳細資訊和連接的所有參數:

在此處輸入圖像描述

來自 domain/domain1/config/domain.xml 的一些連接池詳細資訊:

<jdbc-connection-pool connection-validation-method="auto-commit" datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource" wrap-jdbc-objects="false" res-type="javax.sql.DataSource" name="connectionPool">
 <property name="URL" value="jdbc:mysql://<HOST>:<PORT>/<DB>?relaxAutoCommit="true""></property>
 <property name="Password" value="password"></property>
 <property name="User" value="jdbc"></property>
</jdbc-connection-pool>
<jdbc-resource pool-name="connectionPool" jndi-name="jdbc/local"></jdbc-resource>
<jdbc-connection-pool datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource" res-type="javax.sql.ConnectionPoolDataSource" name="legacy_on_glassfish">
 <property name="User" value="jdbc"></property>
 <property name="AutoReconnectForPools" value="false"></property>
 <property name="LoggerClassName" value="com.mysql.jdbc.log.StandardLogger"></property>
 <property name="RetriesAllDown" value="120"></property>
 <property name="IgnoreNonTxTables" value="false"></property>
 <property name="ProfilerEventHandler" value="com.mysql.jdbc.profiler.LoggingProfilerEventHandler"></property>

也可以看看:

https://glassfish.java.net/nonav/v3/admin/planning/j109/admin-cli.html#latestversion

https://glassfish.java.net/docs/4.0/administration-guide.pdf

您可以通過以下方式獲取詳細資訊asadmin

asadmin get domain.resources.jdbc-connection-pool.NAME_OF_THE_CONNECTION_POOL.*

例如

asadmin get domain.resources.jdbc-connection-pool.PostgresConnectionPool.*

另外,連接池詳細資訊儲存在哪裡?

域/domain1/config/domain.xml

引用自:https://serverfault.com/questions/637424