DatasourceNaming

Tracked by issue 88871

Intro

In VWP 5.5 it's not possible to choose or easily rename a datasource. This spec will describe how the renaming will take place. Also, a parser for determining the datasource name may be implemented here, TBD.

(snippets from VWPDataSourceIntegration) In the visual web project at design time, a data source needs to be created the first time a table from a given database is bound to a visual component.

The JNDI name and resource reference name both need to be defined at this time. We are going to prompt the user to provide the resource reference name, as this is the logical name that is used throughout the application and which should have a reasonable name for the developer.

The JNDI name will be automatically generated. We could then use that to generate a JNDI name like <vendor>-<database-name>. Exactly what we do to generate the JNDI name should be defined as part of the functional spec.

The user can change the JNDI name if they choose to by editing the deployment descriptor where it is defined. We need to document exactly how this is done so that users know how to do this.

The data source is then created both in the project and in the current target server.


Format of the datasource name TBD - need to collaborate with the serverplugins team as they need a parser also (current APIs aren't sufficient)

dbvendor[1...n] or 
table_name[1..n] or
database_name[1...n] or 
catalog_name[1...n] or 
schema name[1...n] or 
dbvendor_schemaname[1...n] or 
dbvendor_tablename[1...n] 

The format, IMHO, should include the vendor and database name/catalog name - it uniquely identifies a particular database. -- DavidVanCouvering

Use cases

1) New Datasource

User creates a new project then DnD a database table from a connection onto the:

a) Designer
b) Node in the Outline 
c) component in the Designer

Desired result:

a) the datasource child node of the Datasource References node in the project will have a property sheet and the datasource name can be changed here.
or
b) dialog opens with an textfield containing a generated datasource name. User has the option to rename the datasource 


Special cases (snippets from VWPDataSourceIntegration) If a data source of the same JNDI name already exists in the target server with exactly the same connection parameters and URL, then we just use that one.

If a data source of the same JNDI name already exists in the target server with a different JDBC URL or different connection parameters, then we generate a different JNDI name and create a data source using that name.

Potential conflict - It is possible for the user to create two resource reference names that map to the same JNDI name. As a result, when a table from a database is dragged onto a component, it is not clear which resource ref name to use. Our suggestion is to pick the last one created; the user can change it if they want to. An alternative approach is to bring up a radio button dialog and let the user pick which res-ref name they want to use

It is also possible for a project to end up with two data sources that point to the same database. In this case again you can have two resource ref names pointing to the same underlying database . Again we are proposing a dialog with a combobox that lets the user choose.


2) Existing project datasource

User opens a project that contains a datasource

Desired result:

bindings retained if the database connection is alive


Special cases (snippets from VWPDataSourceIntegration) If a data source of the same JNDI name already exists in the target server with exactly the same connection parameters and URL, then we just use that one.

If a data source of the same JNDI name already exists in the target server with a different JDBC URL or different connection parameters, then we generate a different JNDI name and generate a data source using that name.

Potential conflict - It is possible for the user to create two resource reference names that map to the same JNDI name. As a result, when a table from a database is dragged onto a component, it is not clear which resource ref name to use. Our suggestion is to pick the last one created; the user can change it if they want to. An alternative approach is to bring up a radio button dialog and let the user pick which res-ref name they want to use

It is also possible for a project to end up with two data sources that point to the same database. In this case again you can have two resource ref names pointing to the same underlying database . Again we are proposing a dialog with an editable combobox that lets the user choose.

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo