Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 358661 - Default SQLDataSource binding name is not a valid name
Summary: Default SQLDataSource binding name is not a valid name
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Zhi Zhu CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-22 16:19 EDT by Joseph Vincens CLA
Modified: 2017-02-23 14:14 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Vincens CLA 2011-09-22 16:19:23 EDT
In the egldd editor Resource Binding tab.
After pressing add SQL Datasource the binding name must be a valid EGL identifier see 358310 and 358309.
The name field should be added, it can default to the selected database descriptor, but must be changed to a valid identifier.
Comment 1 Joseph Vincens CLA 2011-09-23 09:29:11 EDT
Justin made a point in 358659, if the user wants to use @Resource{bindingKey="mm nn%@/"}, then mm nn%@/ as a name it is legal. So the default name we generate should be a valid identifier, but the user should be able to override it with any text they choose.
Comment 2 Zhi Zhu CLA 2011-09-29 02:16:05 EDT
the binding name is got from name of defined database connection, why not invalid, can you give an example for this?
Comment 3 Justin Spadea CLA 2011-09-29 09:45:11 EDT
The name of the connection usually contains spaces, for example the default for Derby is "New Derby". Since the default binding key used by your code is based on the variable name, we should default the SQL binding name to a value that can be used as a variable name.

Given a database connection: "New Derby". Set the binding name to "NewDerby". User can then code as follows to make use of the default binding key:

NewDerby sqldatasource{@Resource};

The user can still change the binding name to whatever they want in the DD editor, after the binding has been created. No validation should be added to the binding name. The following is perfectly legal: "1abc- 1234$%"

ds sqldatasource(@Resource{bindingKey = "1abc- 1234$%"}};

So to summarize, the only thing that should be changed is when determining the default binding name (either through the New Binding wizard or the New Record wizard that creates a record from a database connection) we should strip out any characters that aren't valid in a variable name.
Comment 4 Zhi Zhu CLA 2011-09-29 22:25:43 EDT
thanks for Justin's comment, fix it
Comment 5 Joseph Vincens CLA 2011-10-03 09:12:42 EDT
verified
Comment 6 Justin Spadea CLA 2011-10-05 10:42:55 EDT
I just created a binding for DB2 and the name created was: NewDB2ForLinux,UNIX,AndWindows

This is not a valid identifier.
Comment 7 Justin Spadea CLA 2011-10-05 10:47:51 EDT
Fixed BindingSQLDatabaseConfiguration to use the same check for each character as what validation allows. My DB2 binding name now becomes "NewDB2forLinuxUNIXandWindows".
Comment 8 Joseph Vincens CLA 2011-10-24 16:16:51 EDT
verified