• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Swing Application freezes in DriverManager.getConnection

 
Eby George
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I am a newbie to Swing and Java World. I wanted to create a small swing application(as part of my project requirement) which will pull some details from the Oracle DB and display it to the user. The window just freezes on DriverManager.getConnection call and then nothing happens for a long time,until i terminate the application. The program is running fine as a stand alone Java program. But it is failing when the same is implemented in Swing. I have pasted the relevant codes. I gogled around and found several threads but could not find a solution. I am using

Netbeans 6.7.1.
Java version "1.6.0_16"
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi(the server is located on a remote Unix box).

Please let me know if any other information is needed.
 
Stephan van Hulst
Bartender
Pie
Posts: 5590
55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ebi, welcome to CodeRanch! Please UseCodeTags. I added them for you this time.

Eby George wrote:I am a newbie to Swing and Java World. [...] I am using Netbeans 6.7.1.


Here's the problem. First learn Swing before you learn how to make a Swing program in an IDE. Writing a Swing application is incredibly hard to get right if your IDE adds all sorts of code and you don't know what it does.

Have you read Oracle's Swing tutorial yet?
 
Nam Ha Minh
Ranch Hand
Posts: 502
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To avoid GUI freezing, the code that connects to database should be executed in a separate thread, other than in the event dispatching thread.
 
Rob Spoor
Sheriff
Pie
Posts: 20512
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In other words, read Concurrency in Swing.
 
Eby George
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow and I thot, learning Swing will be easier/faster with an IDE. Will try launching it in a seperate thread and get back with the results.
 
Darryl Burke
Bartender
Posts: 5125
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Swing Application Framework (org.jdesktop... classes) isn't part of Swing. Learn to use the core Java classes first. The SAF (JSR-296) may be useful for large Swing applications, but it has its own learning curve.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic