• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Swing Application freezes in DriverManager.getConnection

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Saloon Keeper
Posts: 15510
363
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 530
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In other words, read Concurrency in Swing.
 
Eby George
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic