在为实体类配置会话 Bean,我可以从 Glassfish v4 中获取一些基本信息在 Ubuntu 上有关从 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 界面获取完整的详细信息和连接的所有参数:
来自 domains/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
答案1
您可以通过以下方式获取详细信息asadmin
:
asadmin get domain.resources.jdbc-connection-pool.NAME_OF_THE_CONNECTION_POOL.*
例如
asadmin get domain.resources.jdbc-connection-pool.PostgresConnectionPool.*
答案2
另外,连接池详细信息存储在哪里?
域/域1/config/域.xml