简体   繁体   中英

Creating Connection Pools in Glassfish

I'm trying to create a connection pool in glassfish. I've done this a million times so the 'how-to' is not the issue.

After I filled out all the info that the form needs to create the connection pool and I hit 'create/finish' then the screen just reloads and takes me back to the home screen without creating the connection pool.

This is super frustrating! (Aaaargh!!!) . I've tried multiple times to restart the application server but it doesn't work. Any tips on what I can do to fix this? Maybe there's a manual way to add a connection pool by editing some XML file or something?

Thanks in advance!

The configuration is stored as a domain.xml file ( .../<yourDomain>/config/domain.xml ) and you can edit this file manually (preferably while app server is down).

Look for:

<jdbc-connection-pool name="yourDS" ...>
  <description>...</description>
  <property name="DatabaseName" value="..."/>
  <property name="Password" value="..."/>
  <property name="User" value="..."/>
  <property name="ServerName" value="localhost"/>
  <property name="PortNumber" value="3306"/>
</jdbc-connection-pool>

Edit the xml as per jeha's answer, or use a command like this

asadmin create-jdbc-connection-pool --datasourceclassname    com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource --restype    javax.sql.ConnectionPoolDataSource --property "User=myUser:Password=myPassword:URL=jdbc\:mysql\://localhost/dbname" myConnPoolName
asadmin create-jdbc-resource --connectionpoolid myConnPoolName jdbc/myConnPoolName

If the admin console crashes, it might be due to the browser's language if it's different from English.

This plays nicely for Oracle and Glassfish 3, just replace your specfic bits as needed

create-jdbc-connection-pool --restype=javax.sql.DataSource --datasourceclassname=oracle.jdbc.pool.OracleDataSource --property=user=<USER>:password=<PWD>:url=<YOUR_SERVER>\\:<PORT>\\:<SID> <DataSourceName>

Note the double slashes to escape the embedded colons.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM