Connecting NetBeans 8.0.2 to Microsoft SQL Server Management Studio - java

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.

There is a tutorial here for connecting to a MySQL database:
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.
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.
You will also need to add the driver to each projects libraries.
The general JDBC tutorial is here:
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.
See this tutorial:
https://netbeans.org/kb/docs/java/gui-binding.html

Related

Java local database

I am creating a piece of software using Java and Eclipse. The software is to be freestanding and not require an internet connection.
The main use of the program requires access to database. I am used to developing for Android where there is an inbuilt MySQL database in every device. Is there a similar thing with Java. I have looked everywhere and have seen references to this kind of thing but have not seen any clear answers. I know there is JDBC, but this seems to be a method of controlling the database rather than creating it.
What I am trying to establish is, is there a pre installed database available to use in Eclipse without any further installation, in the same way as the MySQL Db is available when using Android??
The version of Java I am using is java.runtime.version=1.7.0_40-b43
and I am using Eclipse Kepler Service Release 2
What I am trying to establish is, is there a pre installed database available to use in Eclipse without any further installation, in the same way as the MySQL Db is available when using Android??
First, Android includes SQLite (not mysql). Second, No. No there is not. You could use Derby or SQLite or H2 (or any other pure Java database). As pure Java databases they don't require external installation (but they can be installed externally) and can be run directly in Eclipse.
Would SQLite work for your purposes?
http://developer.android.com/reference/android/database/sqlite/SQLiteDatabase.html
It's not pre-installed, but seems like it might be a good fit otherwise:
http://wiki.eclipse.org/Connecting_to_SQLite

The derby database

In the IT class room I constantly hear chat about the derby database not being built for netbeans. I write code in java and becuase I am learning to implement databases and I have the oppurtunity to be taught sql code. My question is, is the derby database not meant for netbeans and if not why why? So far it works fine for me. Our education system is a bit out of order so I like to be well informed about things.(You don't have to worry about making sense about the last statement).I use the database for recording details in shop and company scenarios so far. So answer could relate to this.
The Java DB(Derby) database is Oracle's supported distribution of Apache Derby. Java DB(Derby) is a fully transactional, secure, standards-based database server, written entirely in Java, and fully supports SQL, JDBC API, and Java EE technology. The Java DB database is packaged with the GlassFish application server, and is included in JDK 8(except Mac OS X) as well.
There is a whole official NetBeans IDE Tutorial about Working with the Java DB(Derby) Database. Whoever has suggested you those incorrect details,he might not have got to work with Derby Database OR might be a fan of Oracle/MySQL,etc. databases! But,I and all the commentators post suggest you to move frankly with Derby database as there is no such problem!
Also,I am leaving you the official tutorial's link---> Official NetBeans IDE Tutorial on Java DB(Derby) Database

How to save user name (simple example of jdbc) in java?

can you please give the steps how to make simple program of jdbc on mac .
I have eclipse on my mac .so I need steps what to do next so that can able to make program of jdbc ?
I do lot of RND but they provide for windows.But I also download Mysql from this link
http://dev.mysql.com/downloads/file.php?id=450342
and download workbench from this link
http://dev.mysql.com/downloads/file.php?id=412161
Then can you please may I right ?
or what next I have to do to make jdbc program ?
Install and start MySql.
Download the MySql JDBC driver. Try here: http://dev.mysql.com/downloads/connector/j/. Extract all the files and add the jar to your eclipse project.
Now you can start coding. Look up the docs for DriverManager, Statement and ResultSet.
There is not much difference at all in using a Mac than other platforms for working with JDBC.
JDK
You need an implementation of Java, a "JDK". See my answer to another question about installing Java 7 and Java 8 on a Mac, including links for downloading a JDK. Before doing the database stuff, be sure this works in the Terminal.app program: java -version
JDBC Driver
You need a JDBC driver specific to your particular database engine.
H2 Database
I suggest trying the H2 database rather than MySQL, only because it may be a gentler easier way to get started. H2 is pure Java, rather simple in terms of installing and administrating, and free-of-cost. H2 comes with its own JDBC driver. The H2 web site has a quick-start page and a tutorial page. It is not written explicitly for Mac OS X, but you should be able to "translate" as needed.
Oracle Tutorial
Then follow the JDBC tutorial provided by Oracle.
Also: StackOverflow is for specific questions on programming, not general or wide-ranging discussion.

SQLite manager, Add on to FireFox

I'm new to databases and i need to use it for a project i am working on, i have the following question.
If we use SQLite manager to create a database on java and then produce a jar file of the complete program. To install this project do we have to always have the SQLite Manager add-on for FireFox for every computer this program is going to be installed on. Despite having the ability to add and remove things from the database in my program in a GUI.
No, it's not necessary to include extra tools if your program contains every functionality that is needed to operate the database. In some cases it's even better when the end user can't directly access the database, to avoid all kinds of data corruption issues.
That being said, it can be nice to offer a generic tool alongside your solution, and SQLite Manager would be an excellent choice. Check out this list of SQLite management tools for other possible choices.
As a sidenote, there are embeddable database engines that are written in Java and may be easier/more natural to integrate in a Java program than SQLIte - examples of this type of product are Apache Derby and H2

How should I make a simple database of names?

I am currently working on a simple web-based program involving a user typing in a word in a client program(written in Java), and sending the word and other basic information to a database. I am finished with the word typing portion, but I have no idea what to do about the database. What software should I use for the database? Here are the requirements that I need for the database:
Read/Write Functionality
Java compatibility
Easy to use/set up
Has plenty of tutorials/documentation
Thank you all for your help!
It sounds to me that this is either a dev experiment or a school project. If this is something you're playing with I think the easiest/quickest would be to go with Sqlite. Here is some info on using it with Java: Java and SQLite
If it is something you intend to deploy in a production environment then go with mysql and jdbc.
How about sqlite?
Its very simple, extremely well supported and if you need to do some more advanced SQL queries it can do that as well.
I would use MySQL and a JDBC driver for communicating with it. The trick is to Google
java mysql jdbc
That should give a lot of usefull results. Good luck!
If you're just learning about databases and getting started, nothing is simpler than an sqlite database since it's actually nothing more than a static file. Here is a jdbc driver for it: http://www.zentus.com/sqlitejdbc/

Categories