简体   繁体   English

Glassfish JDBC:我只需要使用jdbc / __ default吗?

[英]Glassfish JDBC: Do I have to use only jdbc/__default?

I try to use Glassfish/MySQL. 我尝试使用Glassfish / MySQL。 I have created JDBC resource and JDBC connection pool for MySQL. 我已经为MySQL创建了JDBC资源和JDBC连接池。

But if I tried to put MySQL JDBC resource in jta-data-source, nothing works. 但如果我试图将MySQL JDBC资源放在jta-data-source中,那么什么都不行。

Then if I tried to modify jdbc/__default and change its connection pool from DerbyPool to MySQL, it works. 然后,如果我尝试修改jdbc / __ default并将其连接池从DerbyPool更改为MySQL,则可以正常工作。 My entity gets persists to the correct table. 我的实体持续到正确的表。

So do I have to use jdbc/__default only as my JDBC resource for my app? 所以我必须使用jdbc / __ default作为我的应用程序的JDBC资源吗? How can I use the JDBC resource and JDBC connection pool I created in my app? 如何使用我在应用程序中创建的JDBC资源和JDBC连接池?

I really have hard time understanding how to use JDBC in Glassfish. 我真的很难理解如何在Glassfish中使用JDBC。

This is my first time to ask question in this forum. 这是我第一次在这个论坛上提问。 Thank you very much. 非常感谢你。

See this link for a step by step tutorial on how to create JDBC connection pools in Glassfish server. 有关如何在Glassfish服务器中创建JDBC连接池的分步教程,请参阅此链接 Here is the official documentation on how to do it. 以下是有关如何执行操作的官方文档。 Or you can read this SO question. 或者你可以阅读这个问题。 And another resource that you can use is this SO question. 您可以使用的另一个资源就是这个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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