With Glassfish v2/v3 you can create a connection pool and data sources manually, by:
- Copying the JDBC-driver jar into [GLASSFISH_HOME]/domains/(domain1)/lib
- Setting up a connection pool and data source using the asadmin, web console, RESTful interface (v3) or editing the domain.xml file.
In Netbeans (6.7/6.8) the connection pools and datasources can directly deployed from the IDE. You can just "reuse" existing connection from the "services" tab, or create new one:
- Click on Databases -> Drivers and choose "New Driver".
- Point to an existing JDBC driver jar.
- Click on Databases -> New Connection and select your freshly created driver
After this step you will be able to connect the database, browse the tables and execute SQL-statements. Its convenient for development.
If you want to deploy a JDBC connection with your app, then:
- Click on your project (WAR, EJB) and choose New -> Other -> Glassfish -> Connection Pool
- Select your existing or freshly created connection - all the data will be extracted.
- Repeat Step 1. choosing a DataSource
- DataSource and ConnectionPools should appear in Tab "Services" -> Servers -> Glassfish -> Resources -> JDBC -> JDBC Resources
airhacks.fm the podcast:
Stay in touch: airhacks.news.