Java 将 NetBeans 8.0.2 连接到 Microsoft SQL Server Management Studio
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32729099/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Connecting NetBeans 8.0.2 to Microsoft SQL Server Management Studio
提问by Kevin Cardella
I am working on an app in NetBeans for a class and need the GUI to be able to communicate to a database that I created in Microsoft SQL Server Management Studio. The GUI need to be able to take user information and import it to the database. It also needs to be able to retrieve information from the database for review and editing purposes. I have never used the database before, but was able to teach myself the basics. I am having trouble finding out how to connect the GUI to my database though. Is there an easy way to connect the two? I don't mind learning myself, in fact that would be preferable, but any links or suggestions would be very much appreciated.
我正在 NetBeans 中为一个类开发一个应用程序,需要 GUI 才能与我在 Microsoft SQL Server Management Studio 中创建的数据库进行通信。GUI 需要能够获取用户信息并将其导入数据库。它还需要能够从数据库中检索信息以进行和编辑。我以前从未使用过数据库,但能够自学基础知识。我在找出如何将 GUI 连接到我的数据库时遇到了麻烦。有没有简单的方法来连接两者?我不介意自己学习,事实上这会更可取,但任何链接或建议将不胜感激。
采纳答案by WillShackleford
There is a tutorial here for connecting to a MySQL database:
这里有一个连接 MySQL 数据库的教程:
https://netbeans.org/kb/docs/ide/mysql.html
https://netbeans.org/kb/docs/ide/mysql.html
Almost everything will be the same with Microsoft, except you will need a different JDBC driver. You might want to practice with MySQL first since it is free. The MySQL driver comes with Netbeans but the Microsoft Driver will need to be downloaded separately. I believe you can get at the following, but I haven't tried it.
几乎所有内容都与 Microsoft 相同,只是您需要不同的 JDBC 驱动程序。你可能想先练习一下 MySQL,因为它是免费的。MySQL 驱动程序随 Netbeans 一起提供,但需要单独下载 Microsoft 驱动程序。我相信您可以了解以下内容,但我还没有尝试过。
https://msdn.microsoft.com/en-us/sqlserver/aa937724.aspx
https://msdn.microsoft.com/en-us/sqlserver/aa937724.aspx
You add drivers to Netbeans by going to the Services Tab, Right-click on Databases -> New Connection and click the Add button in the dialog.
通过转到“服务”选项卡,将驱动程序添加到 Netbeans,右键单击“数据库”->“新建连接”,然后单击对话框中的“添加”按钮。
You will also need to add the driver to each projects libraries.
您还需要将驱动程序添加到每个项目库中。
The general JDBC tutorial is here:
一般的 JDBC 教程在这里:
https://docs.oracle.com/javase/tutorial/jdbc/
https://docs.oracle.com/javase/tutorial/jdbc/
which covers the common interface between databases.
它涵盖了数据库之间的公共接口。
It is not necessary but it can be useful and or easier to do beans binding between Gui and database.
这不是必需的,但在 Gui 和数据库之间进行 bean 绑定可能很有用,或者更容易。
See this tutorial:
请参阅本教程: