Bug 57538

Summary: Wrong implementation of DatabaseConnection default constructor
Product: db Reporter: Vladimir Yaroslavskiy <yaroslavskiy>
Component: CodeAssignee: Nam Nguyen <nnguyen>
Status: CLOSED FIXED QA Contact: issues <issues.netbeans.org>
Priority: P1 CC: blaha, ludo
Version: 4.x   
Target Milestone: 4.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Report:
Attachments: Patched DatabaseConnection.java

Description Vladimir Yaroslavskiy 2005-04-06 12:33:19 UTC
DataDirect jdbc drivers (DB2, Oracle, Sybase, MS SQL Server) don't
work in Java Studio Enterprise 8 (Buzz) after changes made in

See bug CR 6250647 "can not establish connection to DataDirect drivers"
in Bugster and cvs log:

revision 1.34
date: 2005/03/25 15:07:52; author: nnguyen; state: Exp; lines: +42 -17
issue 56861 Use service lookup for OpenConnectionInterface

I've investigated source code and found that invoking of
'New Database Connection' dialog (select a driver and call
'Connect Using...' item) runs default constructor of

In previous version (1.32) it was

/** Default constructor */
public DatabaseConnection() {
  propertySupport = new PropertyChangeSupport(this);

// For Java Studio Enterprise. Create instanceof OpenConnection
  try {
    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    openConnection =  (OpenConnectionInterface)
    Class.forName(bundle.getString("CLASS_open_connection"), true,
  } catch(Exception ex) {

where openConnection variable was set by my implementation
com.sun.tools.dbdrivers.JseOpenConnection which sets/resets
password for unlocking driver.

But now constructor is:

/** Default constructor */
public DatabaseConnection() {
  propertySupport = new PropertyChangeSupport(this);
  openConnection = new OpenConnection();

where openConnection is empty default implementation.

/** Default constructor */
public DatabaseConnection() {
  propertySupport = new PropertyChangeSupport(this);

  // For Java Studio Enterprise. Create instanceof OpenConnection
  try {
    Collection c = getOpenConnections();
    for (Iterator i=c.iterator(); i.hasNext();) {
      OpenConnectionInterface oci = (OpenConnectionInterface) i.next();
      openConnection = oci;
  catch(Exception ex) {
    ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex);

It seems not a good patch but might be fast way to solve the problem.
Comment 1 Nam Nguyen 2005-04-06 19:11:24 UTC
My overlook, not alerted enough when changing the defautl constructor.
I have a better fix.  Will post a patch, checkin trunk and wait for release41
Comment 2 Nam Nguyen 2005-04-06 23:56:38 UTC
Created attachment 21435 [details]
Patched DatabaseConnection.java
Comment 3 Nam Nguyen 2005-04-07 00:44:46 UTC
The patch is tested against Oracle in Buzz environement.  Also tested against
NetBeans PointBase driver and connection.

Checked in to trunk.

Checking in src/org/netbeans/modules/db/explorer/DatabaseConnection.java;
/cvs/db/src/org/netbeans/modules/db/explorer/DatabaseConnection.java,v  <-- 
new revision: 1.36; previous revision: 1.35

Needs reviews@netbeans.org for release41 integration.
Ludo is offering to take care of this.  Thanks.
Vladimir (Yaroslavskiy) please help test in Buzz against other drivers.  Thanks.
Comment 4 _ ludo 2005-04-07 00:58:45 UTC
41_HR_FIX  keyword added
Comment 5 Vladimir Yaroslavskiy 2005-04-07 12:06:46 UTC
Verified against DB2, Oracle
Comment 6 _ ludo 2005-04-08 04:06:49 UTC
This fix does not introduce regression in our sun resources zero config area, so
it is safe, so far.
Comment 7 Petr Jiricka 2005-04-11 18:03:21 UTC
Petre B, can you please verify that this does not break anything?
Comment 8 Petr Blaha 2005-04-11 20:18:37 UTC
OK, I will test it more thoroughly.
Comment 9 Jan Horvath 2005-04-12 14:40:35 UTC
verified in build 200504101930 against MS SQL
Comment 10 _ ludo 2005-04-12 19:32:02 UTC
integrated into 41 branch.
Comment 11 zikmund 2005-07-12 16:16:14 UTC
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo