如何在 GlassFish 服务器中使用 asadmin 工具创建 mysql 连接池?
我正在尝试使用以下命令在 GlassFish 中创建 mysql 连接池,但它一直告诉我命令 create-jdbc-connection-pool
失败。 请帮我。 命令:
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 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
也许这是一个拼写错误,但仅引用 此博客
的 URL 部分--property
必须用双引号括起来,例如:此外请注意此示例中转义字符的使用。
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:Furthermore notice the use of escape characters in this example.
查看这篇博客文章:
或者,为了避免逃避困境,请查看 这里:
即,不使用 JDBC URL 指定连接。
Check out this blog post:
Alternatively, to circumvent escaping woes have a look here:
ie, specify the connection without using a JDBC URL.
使用 asadmin 实用程序 glassfish
[glassfish 安装目录]/bin/asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.optional.MysqlDataSource --restype javax.sql 对 mysql 连接池使用以下命令.DataSource --property 用户=[db_username]:端口=3306:密码=[db_password]:Url="jdbc:mysql://[localhost 或ip]:3306/[db_name]" [pool_name]
db_username 是您的数据库用户名
db_password 是您的数据库密码
db_name 是数据库名称
pool_name 是您想要的任何内容
例如
./asadmin create-jdbc-connection-pool --datasourceclassname com.mysql.jdbc.jdbc2.可选.MysqlDataSource --restype javax.sql.DataSource --property用户=admin:端口=3306:密码=admin:Url="jdbc:mysql://127.0.0.1:3306/\test" test_pool
use following command for mysql connection pool using asadmin utility glassfish
[glassfish installation dir]/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]" [pool_name]
db_username is your database username
db_password is your database password
db_name is database name
pool_name is anything that 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
以下两件事为我解决了同样的问题。它们是:
1) 仅对 glassfish 转义字符使用 \
2) 尝试在单行中给出命令,例如
Following two things has solved the same issue for me. They are:
1) use \ only for glassfish escape characters
2) try giving the command in a single line, for example