Database Reference
In-Depth Information
true
));
We pass the text field values to
putAppConnString()
. For the password field, it is a
JPasswordField
type, which displays an asterisk for each character entered in the text field. We cannot get the text of the
password field as a
String
; rather, we call the
getPassword()
method to get a character array, from which
we instantiate a
String
to pass to
putAppConnString()
.
When we call
putAppConnString()
, we pass a
boolean
set to
true
as the last argument. That tells
putAppConnString()
to test the resultant connection string to see whether we are able to make a
connection to the database with the designated string.
We have modified the
putAppConnString()
method that takes this final
boolean
to return a
String
instead of a
void
. Previously, we had only sent a success or fail message to the
System.out
stream. Now
we are additionally returning the success or failure message. We set the value of
connSuccessLabel
on
this screen to the value of the message being returned. After we have updated the connection strings in
the list, we want to refresh the list in
existingConnComboBox
, so we call
OracleJavaSecure.listConnNames()
like we did in
dataInit()
to repopulate the drop-down combo box.
Saving the List of Connection Strings to the Database
The final action to be taken on the Edit Application Connection Strings screen is a call to the
saveButton_actionPerformed()
method, which occurs when the Save List button is selected. In this
method, we simply call
OracleJavaSecure.putAppConnections()
. That was easy!
Connection String Copy Screen
If you have modified the
innerClassRevLvl
member of the application inner class in order to designate a
new version of the application, with a new/modified set of Oracle connection strings, then you can use
the Copy to New Version screen shown in Figure 12-9 to duplicate the previous application version
connection strings to the current version.
Note
It only works to copy connection strings from a previous version to the current version if the list of
connection strings for the current version is empty, that is the list in the database.
Figure 12-9.
Copy to New Version functional screen