尝试弄清楚如何将 EasyPHP (MySQL) 与 Java EE 6 结合使用

发布于 2024-12-21 06:41:04 字数 286 浏览 2 评论 0原文

我正在尝试弄清楚如何将 MySQL 与 Java EE 6 结合使用。我想在我的计算机上本地使用它,这样我可以获得一些经验。可以这样做吗?我见过这个MySQL Connector,我希望它是就像一个类或其他东西,但它远不止于此,我不确定如何实现它。任何人都可以提供有关从哪里开始的建议吗?我确实发现一篇文章没有我希望的那么详细,但无论如何它都是 2004 年的,所以它不再相关了。

I'm trying to figure out how to use MySQL with Java EE 6. I'd like to work with it locally on my machine so I can get some experience. Is it possible to do this? I've seen this MySQL Connector and I expected it to be like a class or something, but it's a lot more than that and I'm not sure about how to implement it. Can anyone offer any advice on where to get started? I did find one article that wasn't as detailed as I'd hoped, but it was from 2004 anyways, so it's no longer relevant.

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

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

发布评论

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

评论(2

海夕 2024-12-28 06:41:04

官方 Java 文档中的 JDBC 数据库访问 描述了如何访问数据库来自爪哇。 JDBC 基础入门页面 表示该教程已经过测试与MySQL。

您需要安装 MySQL JDBC 驱动程序(我想这就是您上面链接到的驱动程序)并将其放在您的类路径中,以便数据库连接正常工作。但除了将其放在类路径中之外,您不需要与代码中任何特定于 MySQL 的类进行交互。

The JDBC Database Access trail in the official Java documentation describes how you access databases from Java. The JDBC Basics Getting Started page says that the tutorial has been tested with MySQL.

You will need to install the MySQL JDBC driver (I presume that's what you've linked to above) and have it on your classpath in order for the database connection to work. But other than having it on your classpath, you shouldn't need to interact with any MySQL-specific classes from your code.

来世叙缘 2024-12-28 06:41:04

那么基本上您是使用 EasyPHP 在 Windows 上建立 MySQL 实例吗?看起来有点矫枉过正,但无论如何,您可以执行以下操作:

  1. 下载并安装 Jboss 7< /a>(完整档案)。
  2. 运行JBoss(/bin/standalone.bat>
  3. 下载MySQL Connector for Java
  4. 解压,然后将 MySQL 连接器 Jar 复制到 /standalone/deployments
  5. 登录到 JBoss 管理控制台 (http://localhost:8080)
  6. 浏览到 Connector/Datasources 并定义一个指向您的 MySQL DB 的新数据源

现在就可以设置服务器环境了。您可以在您最喜欢的 IDE 中发挥 JEE6 的全部优点,并将代码部署到您的 Jboss 服务器,或者您可以跳过所有这些,并使用 NetBeans 中的内置功能。 netbeans.org/kb/docs/javaee/ecommerce/intro.html" rel="nofollow">此处。

So basically you are using EasyPHP to stand up a MySQL instance on Windows? Seems like a little bit of overkill but in any case here is what you can do:

  1. Download and install Jboss 7 (Full profile).
  2. Run JBoss (/bin/standalone.bat>
  3. Download MySQL connector for Java
  4. Unzip, then copy the MySQL connector Jar to /standalone/deployments
  5. Login to JBoss admin console (http://localhost:8080)
  6. Browse to Connector/Datasources and define a new datasource pointing to your MySQL DB

Thats it for setting up a server environment. Now you can do all your JEE6 goodness in your favorite IDE and deploy the code to your Jboss server. Or you can skip all that and use the baked in goodies in NetBeans. A good tutorial can be followed here.

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