How to use the Database Designer part of the Netbeans module. Including generation of SQL code.
Visual SQL Editor
The second file type allows the physical structure of a database to be modeled (including the different data types). 1. From the File menu, or on the toolbar, choose add new file
2. In the dialog box which opens, select Databases from the list of Categories, followed by DBDesignTemplate.dbd followed by Next
3. Give the File a suitable name and choose Finish
4. In the Palette on the right hand side of the screen, expand the different tabs. To add a table to the database, drag the New Table icon onto the drawing surface * To change the name of the table double click it's title
5. To add columns to the table, drag a datatype onto the bottom half of the table on the drawing surface (either onto the grey drag datatypes here label, or onto a datatype already in the table). * To change the name of the column, double click the column label * To alter the attributes of the column, hover the mouse over the column and a popup box appears where the different options can be altered. * To create a relationship between two columns (in two different tables) first make sure that the datatypes are identical (eg same type and size...) and that at least one is a primary key of a table. Then Ctrl Click on one column and drag to the Primary key column.
6. Tables can be dragged and dropped in different places on the drawing surface.
7. Once complete save the file, the diagram is saved to disk as an XML file - visible from the XML tab on the toolbar. The diagram can also be exported to disk from the icon on the toolbar.
8. As well, it is possible to generate an SQL file (which opens in the Netbeans IDE), containing the SQL required to create the database. * No check is made for valid names, the SQL tries to optimise itself to create the tables in the correct order to respect the relationships, however, it is important that the user visually inspects the created SQL file to be sure that all relations have been respected and all tables have the correct structure.
I wrote the module, it is available for download on the netbeans plugin portal
punkedALARM 1 year ago