This document demonstrates how to set up a connection to a MySQL database from the NetBeans IDE. Once connected, you can begin working with MySQL in the IDE's Database Explorer by creating new databases and tables, populating tables with data, and running SQL queries on database structures and content. This tutorial is designed for beginners with a basic understanding of database management, who want to apply their knowledge to working with MySQL in NetBeans IDE.
To follow this documentation, you need the following software and resources.
Software or Resources | Version Required |
---|---|
NetBeans IDE | 8.0,8.1,8.2,9 or latest |
Java Development Kit (JDK) | version 11 or latest |
MySQL database server | version 5.7 or latest |
NetBeans IDE comes bundled with support for the MySQL RDBMS. Before you can access the MySQL Database Server in NetBeans IDE, you must configure the MySQL Server properties.
Type any arguments for the admin tool in the Arguments field.
Type any arguments for the start command in the Arguments field.
Before you can connect to a MySQL Database Server, you must first ensure that the MySQL Database Server is running on your machine. If the database server is not connected you will see (disconnected) next to the user name in the MySQL Server node in the Service window and you will not be able to expand the node.
To connect to the database server, confirm that the MySQL Database Server is running on your machine, right-click the Databases > MySQL Server node in the Services window and choose Connect. You might be prompted to supply a password to connect to the server.
When the server is connected you will be able to expand the MySQL Server node and view the all available MySQL databases.
A common way of interacting with databases is through an SQL editor. NetBeans IDE has a built-in SQL Editor for this purpose. The SQL Editor is generally accessible via the Execute Command option from the right-click menu of the connection node (or of the connection node's child nodes). Now that you are connected to the MySQL server, you can create a new database instance using the SQL Editor. For purposes of this tutorial, create an instance called MyNewDatabase:
Now that you have connected to MyNewDatabase, you can begin exploring how to create tables, populate them with data, and modify data maintained in tables. This allows you to take a closer look at the functionality offered by the Database Explorer, as well as NetBeans IDE's support for SQL files.
MyNewDatabase is currently empty. In the IDE it is possible to add a database table by either using the Create Table dialog or by inputting an SQL query and running it directly from the SQL Editor. In the following exercises, you will use the SQL editor to create the Counselor table and the Create Table dialog box to create the Subject table. After you create the tables you will run an SQL script to populate the tables.
Using the SQL Editor
CREATE TABLE Counselor (
id SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
firstName VARCHAR (50),
nickName VARCHAR (50),
lastName VARCHAR (50),
telephone VARCHAR (25),
email VARCHAR (50),
memberSince DATE DEFAULT '0000-00-00',
PRIMARY KEY (id)
);
In this exercise, you will use the Create Table dialog box to create the Subject table.
Key | Index | Null | Unique | Column Name | Data Type | Size |
---|---|---|---|---|---|---|
[checked] | [checked] | [checked] | id | SMALLINT | 0 | |
[checked] | name | VARCHAR | 50 | |||
[checked] | description | VARCHAR | 500 | |||
[checked] | FK_counselorID | SMALLINT | 0 |
You are creating a table named Subject that will hold data for each of the following records.
Name: name of the subject
Description:description of the subject
Counselor ID:counselor ID that corresponds to an ID from the Counselor table
Make sure that the fields in your Create Table dialog match those shown above, then click OK. The IDE generates the Subject table in the database, and you can see a new Subject table node (table node icon) immediately display under Tables in the Database Explorer.
In order to work with table data, you can make use of the SQL Editor in NetBeans IDE. By running SQL queries on a database, you can add, modify and delete data maintained in database structures.
To add a new record (row) to the Counselor table, do the following:
INSERT INTO Counselor
VALUES (1, 'Ricky', '"The Dragon"', 'Steamboat','334 612-5678', 'r_steamboat@ifpwafcad.com', '1996-01-01')
Another way to manage table data in NetBeans IDE is by running an external SQL script directly in the IDE. If you have created an SQL script elsewhere, you can simply open it in NetBeans IDE and run it in the SQL Editor.
For demonstrative purposes, download ifpwafcad.sql and save it to a location on your computer. This script creates two tables similar to what you just created above (Counselor and Subject), and immediately populates them with data.
Because the script overwrites these tables if they already exist, delete the Counselor and Subject tables now so it becomes obvious that new tables are being created when the script is run. To delete tables:
When you click Yes in the Confirm Object Deletion dialog box, the table nodes are automatically removed from the Database Explorer.
To run the SQL script on MyNewDatabase:
User can add one or more element according to the requirement before creating a new project. Here user can specify the nature of the document, refer a file, create new task, add new vendor etc.
Tasks needs to be configured before creating project. Tasks are important and can be customized based on your project workflow.
Submitted task will be added to the list below and these tasks will be part of
project creation. Now you can create project with these created tasks.
User can also create category according to the nature of the document before creating a new project.
For example document might be related to Finance,Educational,Banking,Entertainment,Legal etc. In that way user first create the category based on the nature and then select that category during creating new project.
Category Name: User can mention any names that he wants in characters.
Category description: User can also write description regarding the category.
User can also search for the category if it's already existed or not in the list shown in the image. If it is already existed user do not need to create new category and can choose the same while creating a new project.
Agency Email: To add a vendor or agency user need to enter agency's mail id and click on the submit button as shown in the below image:
Once submit you can see the agency email id in the list as shown in the below image:
Agency Name: Till the time agency or vendor will not register and logged into the portal, the Agency name column will shows "Never logged in" status. Once vendor register and log in, it automatically show the name of the agency here.
This way user can add a new vendor and during creating a new project he can select vendor from the drop down list. Then it depends on the vendor whether he wants to accept the project or not.
Here user can also refer project or document to agency or translator for their better understanding. In some cases user can also refer one particular project for changes he wants to make in the project by uploading reference file.
As shown in the image above if user wants to refer a project "Neha 2" then he will click on the "+" button to expand it. User can send the file to agency or to translator or both of them by clicking on the check box and then click on the upload option shown next to the name of file.
For privacy and security reasons main user(owner) of the software can grant authorities to agencies and translator according to their requirements. Here main user can define the role and can assign them to different users.
Assign role to user: To assign the role following steps required:
User email id: Enter user e-mail id whom you want to grant the authorities.
Select role(s):select a role from the drop down list.
Description: Add description of the role if required
Click on "Submit" button.
After clicking on submit button, you will see in the below list (as shown in the image above) that the role has been assigned to the particular user. You can also edit the role by clicking on " Edit" option, can take back the authorities by clicking on the "Delete" option and can also activate and deactivate the user by clicking on "active" or "Deactive" options.
Define a role: To define a new role following steps required:
Role Name:Enter any name you want to define the rale.
Permission(s): Select one or more permissions from the drop down list.
Description:Describe the role if required.
Click on the "Assign" button.
After clicking on the submit button, you can see the role name and the permissions assigned to the role name in the list below(as shown in the images above). If required you can also add or remove one or more permissions to the same role name by clicking on "Edit" button.