This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 163565 - JDBC connection problems from Swing Application Framework
Summary: JDBC connection problems from Swing Application Framework
Status: RESOLVED DUPLICATE of bug 134745
Alias: None
Product: guibuilder
Classification: Unclassified
Component: App Framework (show other bugs)
Version: 6.x
Hardware: PC All
: P4 blocker (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-24 10:45 UTC by soynegativo
Modified: 2009-04-24 12:22 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description soynegativo 2009-04-24 10:45:02 UTC
I am having a problem with Netbeans 6.5 + JDK 1.6 + Swing Application Framework + JDBC

Seems like i cannot create a new jdbc connection from the Swing gui unless i do it before in the main method (before
Swing init):

I create a new project: 
File -> New Project -> Java -> Java Desktop Application
[Name it Test]
Open TestApp.java, and go to main Method, add a db conection like this:

try
{
System.out.println("1.1");
Class.forName("com.ibdm.db2.jcc.DB2Driver");
System.out.println("1.2");
Connection conn=DriverManager.getConnection(someURL,someUser,somePassword);
System.out.println("1.3");
conn.close();
System.out.println("1.4");
}
catch(Exception ex)
{
}


Run the program, i get:
1.1
1.2
1.3
1.4

now, open TestView in Design mode, add a button, go to events, and create a new actionPerformed event method
copy & paste the same code executed on main

Run the program again, and press button, the output is:
1.1
1.2
1.3
1.4
1.1
1.2
1.3
1.4

(that means, 4 steps on main, and 4 steps on click response)

Now, the final step, remove the jdbc code on the main method
Run again and click button, output is:

1.1
1.2

.... (now, it hangs forever) ...

I don't know why but it seems like if Swing Application Framework is doing something to jdbc connections, it can be
solved testing the connection before running into gui, but this is not a solution for DB configuration from the gui.

i have seen this reported on java.sun.com here:
http://forums.sun.com/thread.jspa?threadID=5332211
Comment 1 Jan Stola 2009-04-24 11:49:27 UTC
It can be a symptom of the problem described in issue 134745. See my comment (Jul 28 13:10:10) in this issue for an 
explanation and a possible workaround. Please, let me know if this was the case e.g. if the proposed workaround helped 
or not.
Comment 2 soynegativo 2009-04-24 12:22:03 UTC
that is!
the workaround worked perfect, just setting the java.net.useSystemProxies to false when GUI starts, made it work.
It is difficult to understand why did they have the need of setting it to true in the Swing Application Framework...
I'm marking this as duplicate. http://www.netbeans.org/issues/show_bug.cgi?id=134745
You really made my week.

*** This issue has been marked as a duplicate of 134745 ***