{"id":41790,"date":"2024-05-21T11:29:52","date_gmt":"2024-05-21T11:29:52","guid":{"rendered":"https:\/\/accuweb.cloud\/resource\/?post_type=faq&#038;p=41790"},"modified":"2026-02-19T05:18:11","modified_gmt":"2026-02-19T05:18:11","slug":"jdbc-connection-glassfish","status":"publish","type":"faq","link":"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish","title":{"rendered":"How to Perform Connection Pooling In JDBC with GlassFish Appllication Server?"},"content":{"rendered":"<h2 class=\"ack-h2\">How to Perform Connection Pooling in JDBC with GlassFish Application Server?<\/h2>\n<p><a class=\"ack-link-color\" href=\"https:\/\/accuweb.cloud\/application\/java-hosting\" target=\"_blank\" rel=\"noopener\">Java<\/a> application servers, such as GlassFish and Payara, use JDBC connection pooling to speed up database access. This means they reuse existing database connections from a pool instead of creating new ones each time.<\/p>\n<p>Setting up a JDBC connection pool on your server helps reduce delays and resource use, which boosts database performance, especially for dynamic applications.<\/p>\n<p>Here are easy steps to set up JDBC for GlassFish with <a class=\"ack-link-color\" href=\"https:\/\/accuweb.cloud\/\" target=\"_blank\" rel=\"noopener\">AccuWeb.cloud.<\/a><\/p>\n<h2 class=\"ack-h2\">Create Environment<\/h2>\n<p><strong>Step 1.<\/strong> Log into your <a class=\"ack-link-color\" href=\"https:\/\/accuweb.cloud\/\" target=\"_blank\" rel=\"noopener\">Accuweb.cloud<\/a> dashboard and click <strong>&#8220;New environment.&#8221;<\/strong><\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-.png\"><img fetchpriority=\"high\" decoding=\"async\" class=\"ack-article-image aligncenter wp-image-41793 size-full\" title=\"New environment.\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-.png\" alt=\"New environment\" width=\"959\" height=\"247\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-.png 959w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish--300x77.png 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish--768x198.png 768w\" sizes=\"(max-width: 959px) 100vw, 959px\" \/><\/a><\/p>\n<p><strong>Step 2.<\/strong> In the topology wizard, go to the <strong>Java<\/strong> tab, select <strong>GlassFish<\/strong> as your application server, and add the required database (like <strong>MySQL<\/strong>). Set the resource limits for your containers and choose an environment name.<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-01.jpg\"><img decoding=\"async\" class=\"ack-article-image aligncenter wp-image-41807 size-full\" title=\"GlassFish as Your Application Server\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-01.jpg\" alt=\"GlassFish as Your Application Server\" width=\"975\" height=\"608\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-01.jpg 975w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-01-300x187.jpg 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-01-768x479.jpg 768w\" sizes=\"(max-width: 975px) 100vw, 975px\" \/><\/a><\/p>\n<p><strong>Step 3.<\/strong> Click <strong>&#8220;Create.&#8221;<\/strong> Wait a few minutes for your new environment to be ready, then proceed to create the JDBC connection pool.<\/p>\n<h2 class=\"ack-h2\">Setting Up Database<\/h2>\n<p><strong>Step 1.<\/strong> Open your MySQL node in the browser by clicking<strong> &#8220;Open in browser.&#8221;<\/strong> Use the email you received with database credentials to log into the phpMyAdmin panel.<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-02.jpg\"><img decoding=\"async\" class=\"ack-article-image aligncenter wp-image-41806 size-full\" title=\"Open in Browser\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-02.jpg\" alt=\"Open in Browser\" width=\"994\" height=\"492\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-02.jpg 994w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-02-300x148.jpg 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-02-768x380.jpg 768w\" sizes=\"(max-width: 994px) 100vw, 994px\" \/><\/a><\/p>\n<p><strong>Step 2.<\/strong> Once logged in, go to the <strong>User Accounts<\/strong> tab and click <strong>&#8220;Add user account.&#8221;<\/strong><\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-03.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"ack-article-image aligncenter wp-image-41795 size-full\" title=\"Add User Account\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-03.jpg\" alt=\"Add User Account\" width=\"996\" height=\"617\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-03.jpg 996w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-03-300x186.jpg 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-03-768x476.jpg 768w\" sizes=\"(max-width: 996px) 100vw, 996px\" \/><\/a><\/p>\n<p><strong>Step 3.<\/strong> Fill in the form, and check <strong>&#8220;Create a database with the same name and grant all privileges.&#8221;<\/strong><\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-04.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"ack-article-image aligncenter wp-image-41805 size-full\" title=\"Fill in the Form\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-04.jpg\" alt=\"Fill in the Form\" width=\"994\" height=\"601\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-04.jpg 994w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-04-300x181.jpg 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-04-768x464.jpg 768w\" sizes=\"(max-width: 994px) 100vw, 994px\" \/><\/a><\/p>\n<p><strong>Step 4.<\/strong> Finally, click <strong>&#8220;Go&#8221;<\/strong> to add the database and user for connection pooling.<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-05.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"ack-article-image aligncenter wp-image-41804 size-full\" title=\"Connection Pooling\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-05.jpg\" alt=\"Connection Pooling\" width=\"746\" height=\"451\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-05.jpg 746w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-05-300x181.jpg 300w\" sizes=\"(max-width: 746px) 100vw, 746px\" \/><\/a><\/p>\n<h2 class=\"ack-h2\">Setting Up Java Application Server<\/h2>\n<p><strong>Step 1.<\/strong> The JDBC MySQL connector is already included in the stack, located in the \/<strong>opt\/glassfish\/glassfish\/domains\/domain1\/lib<\/strong> directory on your GlassFish server.<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-06.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"ack-article-image aligncenter wp-image-41803 size-full\" title=\"SFTP \/ SSH GATE\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-06.jpg\" alt=\"SFTP \/ SSH GATE\" width=\"993\" height=\"464\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-06.jpg 993w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-06-300x140.jpg 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-06-768x359.jpg 768w\" sizes=\"(max-width: 993px) 100vw, 993px\" \/><\/a><\/p>\n<p><strong>Step 2.<\/strong> Log in to the <strong>GlassFish Admin panel<\/strong> using the credentials provided in your email.<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-07.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"ack-article-image aligncenter wp-image-41802 size-full\" title=\"GlassFish Admin panel\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-07.jpg\" alt=\"GlassFish Admin panel\" width=\"994\" height=\"459\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-07.jpg 994w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-07-300x139.jpg 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-07-768x355.jpg 768w\" sizes=\"(max-width: 994px) 100vw, 994px\" \/><\/a><\/p>\n<p><strong>Step 3.<\/strong> Go to <strong>Resources &gt; JDBC &gt; JDBC<\/strong> Connection Pools and click the <strong>&#8220;New&#8221;<\/strong> button.<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-08.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"ack-article-image aligncenter wp-image-41801 size-full\" title=\"JDBC &gt; JDBC Connection Pools\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-08.jpg\" alt=\"JDBC &gt; JDBC Connection Pools\" width=\"998\" height=\"639\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-08.jpg 998w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-08-300x192.jpg 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-08-768x492.jpg 768w\" sizes=\"(max-width: 998px) 100vw, 998px\" \/><\/a><\/p>\n<h3 class=\"ack-h3\">Fill in The Form with These Details<\/h3>\n<ul class=\"ack-ul\">\n<li><strong>Pool Name:<\/strong> Any name you prefer.<\/li>\n<li><strong>Resource Type:<\/strong> Select javax.sql.DataSource.<\/li>\n<li><strong>Database Driver Vendor:<\/strong> Choose MySQL.<\/li>\n<\/ul>\n<p>Click <strong>&#8220;Next&#8221;<\/strong> to continue.<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-09.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"ack-article-image aligncenter wp-image-41800 size-full\" title=\"New JDBC Connection Pool Steps\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-09.jpg\" alt=\"New JDBC Connection Pool Steps\" width=\"992\" height=\"633\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-09.jpg 992w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-09-300x191.jpg 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-09-768x490.jpg 768w\" sizes=\"(max-width: 992px) 100vw, 992px\" \/><\/a><\/p>\n<p><strong>Step 4.<\/strong> Modify these Additional Properties:<\/p>\n<ul class=\"ack-ul\">\n<li><strong>User:<\/strong> Your database login.<\/li>\n<li><strong>ServerName:<\/strong> Your database host (e.g., node5225-glassfish-pooling.us-accuweb.cloud).<\/li>\n<li><strong>Port:<\/strong> 3306.<\/li>\n<li><strong>DatabaseName:<\/strong> Your database name.<\/li>\n<li><strong>Password:<\/strong> Your database user password.<\/li>\n<li><strong>URL or Url:<\/strong> jdbc:mysql:\/\/{db_host}:3306\/. Replace {db_host} with your node hostname or IP address.<\/li>\n<\/ul>\n<p>Click <strong>&#8220;Finish&#8221;<\/strong> to add the new pool.<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-10.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"ack-article-image aligncenter wp-image-41799 size-full\" title=\"Additional Properties\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-10.jpg\" alt=\"Additional Properties\" width=\"923\" height=\"472\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-10.jpg 923w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-10-300x153.jpg 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-10-768x393.jpg 768w\" sizes=\"(max-width: 923px) 100vw, 923px\" \/><\/a><\/p>\n<p>Once you click on the finish button, the new pool will be added and shown in the Pools section.<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-11.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"ack-article-image aligncenter wp-image-41798 size-full\" title=\"Shown in The Pools Section\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-11.jpg\" alt=\"Shown in The Pools Section\" width=\"928\" height=\"355\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-11.jpg 928w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-11-300x115.jpg 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-11-768x294.jpg 768w\" sizes=\"(max-width: 928px) 100vw, 928px\" \/><\/a><\/p>\n<p><strong>Step 5.<\/strong> Select the new connection pool and click the <strong>&#8220;Ping&#8221;<\/strong> button to check if the pool is working. A <strong>&#8220;Ping Succeeded&#8221;<\/strong> message should appear.<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-12.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"ack-article-image aligncenter wp-image-41797 size-full\" title=\"Ping Succeeded\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-12.jpg\" alt=\"Ping Succeeded\" width=\"919\" height=\"497\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-12.jpg 919w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-12-300x162.jpg 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-12-768x415.jpg 768w\" sizes=\"(max-width: 919px) 100vw, 919px\" \/><\/a><\/p>\n<p><strong>Step 6.<\/strong> Go to <strong>Resources &gt; JDBC &gt; JDBC<\/strong> Resources and click <strong>&#8220;New&#8221;<\/strong> to create JDBC resources for pooling.<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-13.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"ack-article-image aligncenter wp-image-41796 size-full\" title=\"JDBC Resources\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-13.jpg\" alt=\"JDBC Resources\" width=\"976\" height=\"704\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-13.jpg 976w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-13-300x216.jpg 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-13-768x554.jpg 768w\" sizes=\"(max-width: 976px) 100vw, 976px\" \/><\/a><\/p>\n<p><strong>Step 7.<\/strong> In the form that appears, enter a JNDI Name and choose your Pool Name from the drop-down list. Click <strong>&#8220;OK&#8221;<\/strong> to create the resources.<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-14.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"ack-article-image aligncenter wp-image-41810 size-full\" title=\"Create the Resources\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-14.jpg\" alt=\"Create the Resources\" width=\"732\" height=\"425\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-14.jpg 732w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-14-300x174.jpg 300w\" sizes=\"(max-width: 732px) 100vw, 732px\" \/><\/a><\/p>\n<p><strong>Step 8.<\/strong> The new resource will be added and shown in the Resources section.<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-15.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"ack-article-image aligncenter wp-image-41809 size-full\" title=\"Resources section\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-15.jpg\" alt=\"Resources section\" width=\"729\" height=\"368\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-15.jpg 729w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-15-300x151.jpg 300w\" sizes=\"(max-width: 729px) 100vw, 729px\" \/><\/a><\/p>\n<h2 class=\"ack-h2\">Connecting from Java Code<\/h2>\n<p>Add these lines to your Java class:<\/p>\n<ul class=\"ack-ul\">\n<li><strong>InitialContext ctx = new InitialContext();<\/strong><\/li>\n<li><strong>DataSource ds = (DataSource) ctx.lookup(&#8220;{resources}&#8221;);<\/strong><\/li>\n<li><strong>Connection conn = ds.getConnection();<\/strong><\/li>\n<\/ul>\n<p>Replace <strong>{resources}<\/strong> with your JNDI name (e.g., jdbc\/mypool).<\/p>\n<p><a href=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-16.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"ack-article-image aligncenter wp-image-41808 size-full\" title=\"Connecting from Java Code\" src=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-16.jpg\" alt=\"Connecting from Java Code\" width=\"978\" height=\"733\" srcset=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-16.jpg 978w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-16-300x225.jpg 300w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-16-768x576.jpg 768w, https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/05\/JDBC-with-GlassFish-16-600x450.jpg 600w\" sizes=\"(max-width: 978px) 100vw, 978px\" \/><\/a><\/p>\n<p>Now you can deploy your Java application to the Accuweb.cloud environment and use GlassFish connection pooling!<\/p>\n<h2 class=\"ack-h2\">Conclusion<\/h2>\n<p>In conclusion, connecting a GlassFish app to <a class=\"ack-link-color\" href=\"https:\/\/accuweb.cloud\/database\/mysql-hosting\" target=\"_blank\" rel=\"noopener\">MySQL<\/a> is crucial for database operations. Setting up JDBC drivers and connection details enables smooth communication between your app and the database.<\/p>\n<p>Setting up a JDBC connection pool on your server helps reduce delays and save resources, improving database performance, especially for dynamic applications.<\/p>\n<div class=\"cta-btn-top-space\"><\/div>\n\t\t<div data-elementor-type=\"section\" data-elementor-id=\"38668\" class=\"elementor elementor-38668\" data-elementor-settings=\"{&quot;ha_cmc_init_switcher&quot;:&quot;no&quot;}\" data-elementor-post-type=\"elementor_library\">\n\t\t\t        <section class=\"elementor-section elementor-top-section elementor-element elementor-element-882321f elementor-section-boxed elementor-section-height-default elementor-section-height-default ct-header-fixed-none ct-row-max-none\" data-id=\"882321f\" data-element_type=\"section\" data-settings=\"{&quot;_ha_eqh_enable&quot;:false}\">\n            \n                        <div class=\"elementor-container elementor-column-gap-default \">\n                    <div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-7cc79cc\" data-id=\"7cc79cc\" data-element_type=\"column\">\n        <div class=\"elementor-widget-wrap elementor-element-populated\">\n                    \n        \t\t<div class=\"elementor-element elementor-element-e31b40f elementor-widget elementor-widget-shortcode\" data-id=\"e31b40f\" data-element_type=\"widget\" data-widget_type=\"shortcode.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t\t\t<div class=\"elementor-shortcode\"><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t            <\/div>\n        <\/div>\n                    <\/div>\n        <\/section>\n        \t\t<\/div>\n\t\t\n<div class=\"cta-btn-bottom-space\"><\/div>\n","protected":false},"author":1,"featured_media":52879,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","class_list":["post-41790","faq","type-faq","status-publish","has-post-thumbnail","hentry","faq_topics-database-hosting","faq_topics-databases","faq_topics-jdbc-with-glassfish","faq_topics-kb","faq_topics-product-documentation"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v20.10 (Yoast SEO v24.5) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>JDBC connection with GassFish | AccuWeb.Cloud Guide<\/title>\n<meta name=\"description\" content=\"Discover how to connect Java database with GlassFIsh. Learn with our step-by-step ease guide. Speed up your database with ease.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Perform Connection Pooling In JDBC with GlassFish Appllication Server?\" \/>\n<meta property=\"og:description\" content=\"Discover how to connect Java database with GlassFIsh. Learn with our step-by-step ease guide. Speed up your database with ease.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish\" \/>\n<meta property=\"og:site_name\" content=\"AccuWeb Cloud\" \/>\n<meta property=\"article:modified_time\" content=\"2026-02-19T05:18:11+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/07\/NEW-OG-IMAGE-URL.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"720\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish#article\",\"isPartOf\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish\"},\"author\":{\"name\":\"Jilesh Patadiya\",\"@id\":\"https:\/\/accuweb.cloud\/resource\/#\/schema\/person\/a7a4cbe8405202b537509c757b588c58\"},\"headline\":\"How to Perform Connection Pooling In JDBC with GlassFish Appllication Server?\",\"datePublished\":\"2024-05-21T11:29:52+00:00\",\"dateModified\":\"2026-02-19T05:18:11+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish\"},\"wordCount\":584,\"publisher\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/#organization\"},\"image\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish#primaryimage\"},\"thumbnailUrl\":\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/07\/NEW-OG-IMAGE-URL.jpg\",\"inLanguage\":\"en-US\"},{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish\",\"url\":\"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish\",\"name\":\"JDBC connection with GassFish | AccuWeb.Cloud Guide\",\"isPartOf\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish#primaryimage\"},\"image\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish#primaryimage\"},\"thumbnailUrl\":\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/07\/NEW-OG-IMAGE-URL.jpg\",\"datePublished\":\"2024-05-21T11:29:52+00:00\",\"dateModified\":\"2026-02-19T05:18:11+00:00\",\"description\":\"Discover how to connect Java database with GlassFIsh. Learn with our step-by-step ease guide. Speed up your database with ease.\",\"breadcrumb\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish#primaryimage\",\"url\":\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/07\/NEW-OG-IMAGE-URL.jpg\",\"contentUrl\":\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/07\/NEW-OG-IMAGE-URL.jpg\",\"width\":1280,\"height\":720},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/accuweb.cloud\/resource\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Perform Connection Pooling In JDBC with GlassFish Appllication Server?\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/accuweb.cloud\/resource\/#website\",\"url\":\"https:\/\/accuweb.cloud\/resource\/\",\"name\":\"AccuWeb Cloud\",\"description\":\"Cutting Edge Cloud Computing\",\"publisher\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/accuweb.cloud\/resource\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/accuweb.cloud\/resource\/#organization\",\"name\":\"AccuWeb.Cloud\",\"url\":\"https:\/\/accuweb.cloud\/resource\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/accuweb.cloud\/resource\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/04\/accuwebcloud_logo_black_tagline.jpg\",\"contentUrl\":\"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/04\/accuwebcloud_logo_black_tagline.jpg\",\"width\":156,\"height\":87,\"caption\":\"AccuWeb.Cloud\"},\"image\":{\"@id\":\"https:\/\/accuweb.cloud\/resource\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/accuweb.cloud\/resource\/#\/schema\/person\/a7a4cbe8405202b537509c757b588c58\",\"name\":\"Jilesh Patadiya\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/accuweb.cloud\/resource\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/2cea2bdb5bbabb771ee67e96acad7396f25cb1a0c360b9bc4a9ac40cea9cd8b2?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/2cea2bdb5bbabb771ee67e96acad7396f25cb1a0c360b9bc4a9ac40cea9cd8b2?s=96&d=mm&r=g\",\"caption\":\"Jilesh Patadiya\"},\"description\":\"Jilesh Patadiya, the visionary Co-Founder and Chief Technology Officer (CTO) behind AccuWeb.Cloud. Founder &amp; CTO at AccuWebHosting.com. He shares his web hosting insights on the AccuWeb.Cloud blog. He mostly writes on the latest web hosting trends, WordPress, storage technologies, and Windows and Linux hosting platforms.\",\"sameAs\":[\"https:\/\/accuweb.cloud\/resource\",\"https:\/\/www.facebook.com\/accuwebhosting\",\"https:\/\/www.instagram.com\/accuwebhosting\/\",\"https:\/\/www.linkedin.com\/company\/accuwebhosting\/\",\"https:\/\/x.com\/accuwebhosting\",\"https:\/\/www.youtube.com\/c\/Accuwebhosting\"],\"url\":\"https:\/\/accuweb.cloud\/resource\/author\/accuwebadmin\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"JDBC connection with GassFish | AccuWeb.Cloud Guide","description":"Discover how to connect Java database with GlassFIsh. Learn with our step-by-step ease guide. Speed up your database with ease.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish","og_locale":"en_US","og_type":"article","og_title":"How to Perform Connection Pooling In JDBC with GlassFish Appllication Server?","og_description":"Discover how to connect Java database with GlassFIsh. Learn with our step-by-step ease guide. Speed up your database with ease.","og_url":"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish","og_site_name":"AccuWeb Cloud","article_modified_time":"2026-02-19T05:18:11+00:00","og_image":[{"width":1280,"height":720,"url":"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/07\/NEW-OG-IMAGE-URL.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish#article","isPartOf":{"@id":"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish"},"author":{"name":"Jilesh Patadiya","@id":"https:\/\/accuweb.cloud\/resource\/#\/schema\/person\/a7a4cbe8405202b537509c757b588c58"},"headline":"How to Perform Connection Pooling In JDBC with GlassFish Appllication Server?","datePublished":"2024-05-21T11:29:52+00:00","dateModified":"2026-02-19T05:18:11+00:00","mainEntityOfPage":{"@id":"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish"},"wordCount":584,"publisher":{"@id":"https:\/\/accuweb.cloud\/resource\/#organization"},"image":{"@id":"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish#primaryimage"},"thumbnailUrl":"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/07\/NEW-OG-IMAGE-URL.jpg","inLanguage":"en-US"},{"@type":["WebPage","FAQPage"],"@id":"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish","url":"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish","name":"JDBC connection with GassFish | AccuWeb.Cloud Guide","isPartOf":{"@id":"https:\/\/accuweb.cloud\/resource\/#website"},"primaryImageOfPage":{"@id":"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish#primaryimage"},"image":{"@id":"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish#primaryimage"},"thumbnailUrl":"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/07\/NEW-OG-IMAGE-URL.jpg","datePublished":"2024-05-21T11:29:52+00:00","dateModified":"2026-02-19T05:18:11+00:00","description":"Discover how to connect Java database with GlassFIsh. Learn with our step-by-step ease guide. Speed up your database with ease.","breadcrumb":{"@id":"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish#primaryimage","url":"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/07\/NEW-OG-IMAGE-URL.jpg","contentUrl":"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/07\/NEW-OG-IMAGE-URL.jpg","width":1280,"height":720},{"@type":"BreadcrumbList","@id":"https:\/\/accuweb.cloud\/resource\/articles\/jdbc-connection-glassfish#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/accuweb.cloud\/resource\/"},{"@type":"ListItem","position":2,"name":"How to Perform Connection Pooling In JDBC with GlassFish Appllication Server?"}]},{"@type":"WebSite","@id":"https:\/\/accuweb.cloud\/resource\/#website","url":"https:\/\/accuweb.cloud\/resource\/","name":"AccuWeb Cloud","description":"Cutting Edge Cloud Computing","publisher":{"@id":"https:\/\/accuweb.cloud\/resource\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/accuweb.cloud\/resource\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/accuweb.cloud\/resource\/#organization","name":"AccuWeb.Cloud","url":"https:\/\/accuweb.cloud\/resource\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/accuweb.cloud\/resource\/#\/schema\/logo\/image\/","url":"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/04\/accuwebcloud_logo_black_tagline.jpg","contentUrl":"https:\/\/accuweb.cloud\/resource\/wp-content\/uploads\/2024\/04\/accuwebcloud_logo_black_tagline.jpg","width":156,"height":87,"caption":"AccuWeb.Cloud"},"image":{"@id":"https:\/\/accuweb.cloud\/resource\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/accuweb.cloud\/resource\/#\/schema\/person\/a7a4cbe8405202b537509c757b588c58","name":"Jilesh Patadiya","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/accuweb.cloud\/resource\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/2cea2bdb5bbabb771ee67e96acad7396f25cb1a0c360b9bc4a9ac40cea9cd8b2?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/2cea2bdb5bbabb771ee67e96acad7396f25cb1a0c360b9bc4a9ac40cea9cd8b2?s=96&d=mm&r=g","caption":"Jilesh Patadiya"},"description":"Jilesh Patadiya, the visionary Co-Founder and Chief Technology Officer (CTO) behind AccuWeb.Cloud. Founder &amp; CTO at AccuWebHosting.com. He shares his web hosting insights on the AccuWeb.Cloud blog. He mostly writes on the latest web hosting trends, WordPress, storage technologies, and Windows and Linux hosting platforms.","sameAs":["https:\/\/accuweb.cloud\/resource","https:\/\/www.facebook.com\/accuwebhosting","https:\/\/www.instagram.com\/accuwebhosting\/","https:\/\/www.linkedin.com\/company\/accuwebhosting\/","https:\/\/x.com\/accuwebhosting","https:\/\/www.youtube.com\/c\/Accuwebhosting"],"url":"https:\/\/accuweb.cloud\/resource\/author\/accuwebadmin"}]}},"_links":{"self":[{"href":"https:\/\/accuweb.cloud\/resource\/wp-json\/wp\/v2\/faq\/41790","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/accuweb.cloud\/resource\/wp-json\/wp\/v2\/faq"}],"about":[{"href":"https:\/\/accuweb.cloud\/resource\/wp-json\/wp\/v2\/types\/faq"}],"author":[{"embeddable":true,"href":"https:\/\/accuweb.cloud\/resource\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/accuweb.cloud\/resource\/wp-json\/wp\/v2\/comments?post=41790"}],"version-history":[{"count":8,"href":"https:\/\/accuweb.cloud\/resource\/wp-json\/wp\/v2\/faq\/41790\/revisions"}],"predecessor-version":[{"id":53234,"href":"https:\/\/accuweb.cloud\/resource\/wp-json\/wp\/v2\/faq\/41790\/revisions\/53234"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/accuweb.cloud\/resource\/wp-json\/wp\/v2\/media\/52879"}],"wp:attachment":[{"href":"https:\/\/accuweb.cloud\/resource\/wp-json\/wp\/v2\/media?parent=41790"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}