E Database Import

Download Report

Transcript E Database Import

WaveMaker Visual AJAX
Studio 4.0 Training
Basics: Building Your First
Application
Database Basics
Building your First Application
1.Define
Data
Import data in
Live Tables
Can also import
Java and Web
Services
2. Build
GUI
Drag-n-drop widgets
in Page Designer
3. Bind data
to GUI
Connect data to widgets
in Page Designer
Can deploy app
to any Java
server
** Steps 1 and 2 can be reversed – you can design first then add data
2
Database Terminology
●
1.Define
Data
To access a database in your application, you
must import the database schema.
– Data Model : the representation of a database imported
into your WaveMaker project.
– LiveTable: the representation of a table in your data
model
– Columns: the representation of the columns in your
database
– Relationships: the representation of the foreign key
relationships from your database
3
Supported Databases
●
All databases that are supported by Hibernate are
supported in WaveMaker
– http://www.hibernate.org/
●
Built-in Support:
– PostGreSQL
– MySQL
– Oracle
– DB2
– SQL Server
– Hypersonic SQL DB (HSQLDB)
4
1.Define
Data
How to Import a Database
5
●
On the Create & Import menu -> Select
Database Import…
●
Opens the Import Database editor
●
Enter settings
●
Click Test Connection
●
If successful, click Import
●
Save the project
1.Define
Data
Connection Parameters
●
1.Define
Data
Some fields are dependent on type of database imported
– Service Name – name of the data model in WaveMaker, can be
same as database name, alphanumeric characters only
– Username – login name for database
– Password – corresponding password for username
– Database System – select type of database
– Host – network host for database, default is localhost
– Port – port number to connect to database
– Database – name of database to import
– File – location of HSQLBD database on file system
– SID – Oracle System Identifier, instance of Oracle running on the
server
– Instance – name of SQL server instance
6
Advanced Options
●
1.Define
Data
Used when connection to large databases or connecting to
an non-support database
– Connection URL – JDBC connection URL
– Java Package – Change the default package name for auto
generated classes
– Table Filter – Use to import a subset of tables
– Schema Filter – Only default schema will be imported, use to
import other schemas
– Driver Class – JDBC driver class name, change to use a different
jar file name for import
– Dialect – Java class name used to map SQL names for Hibernate
7
Testing your connection
8
1.Define
Data
●
Test Connection – use to verify connection
parameters
●
Import – imports the database into WaveMaker,
can take several minutes depending on size of
database
●
Close – closes the settings dialog box without
importing the database
What are LiveTables?
●
All of the data models available to
your application are listed in the tree
on the left side of the LiveTables
editor
●
Under each data model, all of the
LiveTables for that model are listed
– LiveTable is just a fancy name for a
table in which WM has automated
producing CRUD functionality
●
9
Select a LiveTable to see its details
in the right side of the editor
1.Define
Data
Managing LiveTables
1.Define
Data
●
New – creates a new table in the data model
●
Delete – removes a table from the data model
– New and Delete table only affect the data model and do
not change the underlying database unless exported
10
●
Import Database – brings up the Import Database
dialog box to import a new database
●
Connection Settings – brings up dialog box to
which allows you to manage the connections to all
of the databases used by this application.
Managing Database
Connection Settings
11
●
Connection settings for all
databases can be accessed
through one dialog box
●
Save – save changed settings
●
Re-Import – overwrites data
model
●
Export – pushes data model to
database. BE CAREFUL
WHEN USING THIS OPTION
AS IT WILL DROP AND
RECREATE THE TARGET
SCHEMA – DATA WILL BE
LOST!
1.Define
Data
Re-importing a Database
1.Define
Data
●
Recommended that database changes be made
on the database and changes be re-imported
● Minor changes should be handled appropriate
through the application.
– Relationships,
– Addition or deletion of a tables, columns
●
If major changes are made you may need to check
functionality within the application to make sure
things still work correctly.
– Changing column names and relationships
12
Exporting a Database
13
1.Define
Data
●
Exporting a data model from WaveMaker to your
database is possible
●
This is recommended for test or new databases
only
●
All tables are dropped and recreated
●
You will lose data!
General Settings
14
1.Define
Data
●
Save – any changes made in this editor must be saved using this icon
●
Database – value is dependent on type of database system, generally
refers to name space that contains the table
●
Package – Java package name of the data model, if changed will affect
all LiveTables in that data model
●
Table Name – table name in the database that the LiveTable
references
●
Entity Name – name of the LiveTable
General Settings
1.Define
Data
●
Dynamic Insert – if checked, SQL statement sent by WaveMaker to the
database does not include empty fields
●
Dynamic Update – if checked, columns that have null values are
excluded from SQL update statements
– Dynamic Insert and Dynamic Update map directly to the Hibernate settings
dynamic-insert and dynamic-update.
●
15
Refresh Entity – if checked, a SQL select statement is run to fetch the
row just inserted or updated to include any fields that are set by the
underlying database (Example: Date Time Stamps)
Managing Column’s
16
1.Define
Data
●
Add – adds a column
●
Delete – remove selected column
●
Name – column name
●
Primary Key – if checked, column is the primary key, can only have 1
primary key per LiveTable
●
Foreign Key – true or false
●
Type – column data type
●
Not Null – if checked, column cannot hold null value
Managing Columns
1.Define
Data
●
Length – maximum number of characters in column
●
Precision - maximum number of digits used, only for numeric data
types
●
Generator – if the column is a primary key, specifies the method of
key generation
– Assigned, identity, sequence, native
●
17
Params – if a generator is selected, specifies the parameters for that
generator, if any
Managing Relationships
18
1.Define
Data
●
Add – create a relationship to another LiveTable
●
Delete – remove an existing relationship
●
Name – relationship name
●
Related Type – LiveTable referenced
●
Cardinality – to-many or to-one
●
Table Name – name of table in database referenced
●
Column Names – column in LiveTable that is related
●
Cascade Options – method to push changes from master
●
Relationships can be added at the model level and not exported back in the
case where the underlying data model does not have the needed
relationships defined
Questions?
19
Exercise 2
●
20
Import classicmodels database