Java、Eclipse 和 SQL Server
我对 Java 还很陌生(尽管我对 C# 有经验)。 不管怎样,我在过去的几个小时里用谷歌搜索了很多,但我无法理解一些东西。我希望你能帮我一些指导。
我想将 Eclipse 与 SQL Server 一起使用,但我不知道该怎么做。 我见过一些名为 SQLExplorer 的插件,但我不知道与其集成的步骤是什么。
关于:
- 最好的方法是什么?
- 有没有任何指南或完整的教程?
- 也许您有一些连接 SQL 的源代码示例?
- 我应该使用那个插件吗?如何?
- 为什么找到有关此问题的信息如此困难? eclipse不熟悉SQL吗?
谢谢大家。
I'm pretty new with Java (though I'm experienced with C#).
Anyway I've Googled a lot in the last few hours and I can't understand something. I'm hoping you can help me with some guidance.
I'd like to use Eclipse with SQL Server and I have no idea how am I doing that.
I've seen some plugin called SQLExplorer but I just can't figure what are the steps to integrate with that.
Regarding:
- What is the best way of doing that?
- Is there any guide or full tutorial?
- Maybe you have some source code example of a connection to SQL?
- Should I use that plugin? How?
- Why is it so difficult to find info about this issue? Isn't eclipse familiar with SQL?
Thank you all.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Java 和数据库就像面包和黄油一样结合在一起,但语言的不同足以让您可能会遇到问题。可以在许多不同的级别上进行集成:传统的查询/结果 API 称为 JDBC,而要通过 Java 代码处理任何数据库,您所需要的只是适当的 JDBC 驱动程序。 这里是 Microsoft SQL Server 的官方版本,这里是有关使用 JDBC API 的教程。
除此之外,还有像 Hibernate 这样的对象关系映射工具,它可以让您将 Java 对象直接保存到数据库中。 Hibernate 自动化了很多映射,让您可以在高级别上工作。 Hibernate 是一个庞大的主题;从这里开始。
SQLExplorer 以及类似的工具可以让您浏览数据库、探索表以及其中的数据。它不是您与代码一起使用的东西,而是以交互方式检查您正在使用的数据。
这是一个 JDBC“Hello World”,假设本地计算机上的默认数据库,名为
some_table_name
的表在第一个位置有一个字符值列:Java and databases go together like bread and butter, but the language is just different enough that you might have issues breaking in. There are a number of different levels at which things can be integrated: the traditional query/result API is called JDBC, and all you need to work with any database from Java code is the appropriate JDBC driver. Here is the official one from Microsoft for SQL Server, and here is a tutorial about using the JDBC API.
Above that, there are object-relational mapping tools like Hibernate which let you persist Java objects directly onto your database. Hibernate automates a lot of the mapping and lets you work at a high level. Hibernate is an enormous subject; start here.
What SQLExplorer, and tools like it, let you do is browse around in a database, exploring the tables and the data in them. It's not something you use with code, but rather interactively to examine the data you're working with.
Here is a JDBC "Hello World," assuming the default database on the local machine, a table named
some_table_name
has a character-valued column in the first position: