如何声明 GlassFish 的数据源?

发布于 2024-10-02 08:10:11 字数 382 浏览 0 评论 0原文

我知道如何使用 JBoss 执行此操作:创建一个 *-ds.xml 文件,并将其放入我的 deploy 目录中。

  • 是否有一种声明性方法可以对 GlassFish (v3.1) 执行相同的操作?
  • 我是否以错误的方式思考这个问题? (参见下一个问题)
  • 是否有一种更玻璃鱼般的方式让我的 Java EE 应用程序与数据库对话?

其他可能相关的信息:

  • 我想连接到 SQL Server 2008 数据库
  • 我正在使用 Eclipse + GlassFish 服务器工具
  • 我对 GlassFish 几乎一无所知。我对 JBoss 比较熟悉

I know how I'd do this using JBoss: create a *-ds.xml file, and drop it into my deploy directory.

  • Is there a declarative way to do the same with GlassFish (v3.1)?
  • Am I thinking about this the wrong way? (See next question)
  • Is there a more-Glassfishy way to get my Java EE application to talk to a database?

Other potentially-revelant info:

  • I want to connect to a SQL Server 2008 database
  • I'm using Eclipse + GlassFish Server Tools
  • I know next to nothing about GlassFish. I'm much more familiar with JBoss

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

似最初 2024-10-09 08:10:11

您可以在 EAR 的 application.xmlejb-jar.xml 中定义它。您甚至可以使用注释。

长答案简短:Java EE 6 中的数据源资源定义

You can define it in application.xml or ejb-jar.xml of your EAR. You can even use annotations.

Long answer short: DataSource Resource Definition in Java EE 6.

神妖 2024-10-09 08:10:11

BalusC 是正确的 (+1 ),使用 Java EE 6,您可以通过注释或使用来声明数据源定义以标准和可移植的方式创建部署描述符。

如果您还对创建 JMS 资源等数据源之外的其他资源感兴趣,您还可以将 glassfish-resources.xml 文件打包为应用程序的一部分。请参阅:

BalusC is right (+1), with Java EE 6 you can declare datasource definitions either through annotations or through the use of deployment descriptors in a standard and portable way.

Just in case you'd be also interested by creating other resources than datasources like JMS resources, you can also package a glassfish-resources.xml file as part of your application. See:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文