SWING GUI blockes when doing a DB action with microsoft nativ JDBC driver

hi,
in a bigger project i have the problem that if i perform a DB action the GUI is blocked. It does not matter if i do the DB Action in invokeLater or
in a SwingWorker or in a new Thread if i call the DB Action and i move another window over my window it is not refreshed.
normally the GUI shouln�t be blocked if i use invokeLater. maybe it
has something to do that i use the native DB driver? I am using JDK
1.4. has anyone ever encounterd the same problem?
alex
package swingtest;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.sql.*;
public class GUIProblem extends JDialog {   
// this method does a simple DB call to generate some load
public void doMyDBCall()
try {
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection con = DriverManager.getConnection ("jdbc:microsoft:sqlserver://abgvdr71:1433;databasename=v52li;","sa","");
Statement question0 = con.createStatement();
ResultSet rs0=null;
rs0 = question0.executeQuery("select * from intercept_24");
boolean more=rs0.next();
while (more) {    more=rs0.next();}
catch (Exception sql)
{ sql.printStackTrace(); }
public void doItinvokeLater()
SwingUtilities.invokeLater(new Runnable(){    public void run(){       
doMyDBCall();     
public void doItSwingWorker()
SwingWorker worker = new SwingWorker() {
public Object construct() {
System.out.println("worker start");
doMyDBCall();
return null;
worker.start();
System.out.println("finished .....");
Object view = (Object) worker.get();
public GUIProblem (){
super((JFrame)null,"",true);
JButton button = new JButton("do it");
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent event)
// calls it direct -> GUI blocked
//doMyDBCall();
// with invoke later -> GUI blocked
//doItinvokeLater();
// with the swingWorker -> GUI also blocks
doItSwingWorker();     
getContentPane().add(button);
setSize(200,200);
setVisible(true);
public static void main(String [] args)
{  new GUIProblem(); }
}

The invokeLater runs the Runnable in the event thread, so yes, that will block your GUI. You ALMOST got the SwingWorker right. DB call in the construct() method -- the construct() method executes outside the event thread, the finished() method executes in the event thread. The only problem is, you did a worker.get() method in your event thread (right after worker.start(0, and get() blocks until result is ready from construct() -- so, bingo, you're jammed up waiting in you event thread.

Similar Messages

  • Lately Photoshop CC 2014 in my PC gets blocked when doing panoramas. First I edit my raw photos in Lightroom, then export to Photoshop for making panoramas. My Pc runs Windows 8.1 64 bits 8Gb Ram, Lately Photoshop CC 2014 in my PC gets blocked when doing

    Últimamente Photoshop CC 2014 se  detiene fusionando las capas al hacer panoramas. Primero  edito mis fotos Raw en Lightroom luego las paso a Photoshop para hacer panoramas. Photoshop las abre y fusionando las capas se detiene.
    Según el administrador de tareas cuando se bloquea tiene ocupado el 81 % de memoria 25% de CPU y 1% del disco.
    Mi PC tiene Windows 8.1 de 64 bits y tiene 8 Gb de ram
    Lately Photoshop CC 2014 in my PC gets blocked when doing panoramas. First I edit my raw photos in Lightroom, then export to Photoshop for making panoramas. My Pc runs Windows 8.1 64 bits 8Gb Ram

    Últimamente Photoshop CC 2014 se  detiene fusionando las capas al hacer panoramas. Primero  edito mis fotos Raw en Lightroom luego las paso a Photoshop para hacer panoramas. Photoshop las abre y fusionando las capas se detiene.
    Según el administrador de tareas cuando se bloquea tiene ocupado el 81 % de memoria 25% de CPU y 1% del disco.
    Mi PC tiene Windows 8.1 de 64 bits y tiene 8 Gb de ram
    Lately Photoshop CC 2014 in my PC gets blocked when doing panoramas. First I edit my raw photos in Lightroom, then export to Photoshop for making panoramas. My Pc runs Windows 8.1 64 bits 8Gb Ram

  • "Error loading native JDBC driver library" received when connecting to a DB

    I recently installed 10g client onto my PC. After installation I now recieve an "Error loading native JDBC driver library" error when attempting to connect to a database.
    This is a dual core Dell loaded with XP sp 2. I am attempting to connect to a 10gR2 instance. I tried the solution mentioned in another post to no avail. I am using SQL Developer v 1.2.1 build main-32.13.

    Hi,
    I found this thread from googling and am having the same problem for four days now...
    For those who can get SQL Developer to work, could you please detail what properties you have in your installation? Could you please describe what we are supposed to see in the SQL Developer Properties tab? I found this tab in Help>About>Properties but have no idea where SQL Developer picks up those attributes. And it does not seem we can change any of them within SQL Developer. How frustrating!
    Even more frustrating is that I am able to access the database I want to connect to with SQL Plus (right click on the connect node in SQL Developer)...
    Thanks,
    Clueless

  • Does Windows 7 come with a native uncompress (unzip) command-line tool?

    Hi
    Does Windows 7 come with a native uncompress (unzip) tool that can be run from the command-line?
    I am looking for native uncompress solution so that users do not have to either provide a third-party Unzip tool or for me having to create a self-extraction file.
    Thanks
    Jeff in Seattle

    OK so an update, on the 7-zip download page (http://7-zip.org/download.html) they have a specific command line version (http://downloads.sourceforge.net/sevenzip/7za920.zip). 
    It does not even contain a 7z.dll so I presume the poster above was jerry rigging the normal install version.  The zip file contains 7za.exe and 7-zip.chm.  The help files seems broken to me so I found the switches online, but I only could find them
    on a japanese website, but it is english:
    Syntax: 
    http://sevenzip.sourceforge.jp/chm/cmdline/syntax.htm 
    commands: 
    http://sevenzip.sourceforge.jp/chm/cmdline/commands/index.htm
    Extract with full paths: 
    http://sevenzip.sourceforge.jp/chm/cmdline/commands/extract_full.htm
    From the site:
    Examples
    7za.exe x archive.zip
    extracts all files from the archive archive.zip to the current directory.
    7za.exe x archive.zip -oc:\soft *.cpp -r
    extracts all *.cpp files from the archive archive.zip to
    c:\soft folder.
    Find this post helpful? Does this post answer your question? Be sure to mark it appropriately to help others find answers to their searches.

  • How effective does iPhone 4 sync with Microsoft Exchange

    Hello,
    Sorry for a possible repost but I did try to search for this topic but didn't find anything.
    I'm really into the new iPhone 4 to use as a business phone. I have a Dell PC with Windows XP. The most important thing for me regarding iPhone is that the sync with Microsoft Exchange is flawless.
    Can somebody (who has an iPhone and Microsoft Exchange) tell me how effective the sync is with iPhone and Microsoft Exchange? Does the e-mail sync quickly and how does the sync work with contacts and calendar. If I put a new calendar item in Outlook does it appear on my iPhone without me asking it to sync and etc.?
    Please do share your experience

    Can I put the sync settings on the iPhone 4 to only sync between certain time interval? Say, monday to friday from 08am to 7pm?
    If you want push sync, then, no, you can't set a time interval. The entire point of push support is that the server notifies your system whenever something new arrives or something is changed. If you want to control when your iPhone contacts the server, then you can't use push. You can have the system fetch data at a set interval, or you can set to do it manually, if you prefer, but there's no setting where you can set a time window.
    And can I put the sync settings only to store a certain amount of e-mails? Say the 100 newest?
    You can set how may days of mail to sync, and also how many emails to show.
    You might find the the user's guide helpful in learning about features and settings:
    http://manuals.info.apple.com/enUS/iPhone_iOS4_UserGuide.pdf
    Regards.

  • Issue encountered when Login as sysdba role using Thin Oracle JDBC Driver

    Hello all,
    we are now considering to use Thin oracle JDBC driver to create database in our project, but we met one issue when we tried to connect to oracle as sysdba role using Thin driver, and it throws java.sql.SQLException: Io Exception: SO Exception was generated, I have found some tips on oracle jdbc website and it says :
    How do I connect as SYSDBA or SYSOPER?
    The only way to do this is to use the Properties object when connecting, rather than specifying the username and password as strings. Put the username into the "user" property, and the password into the "password" property. Then, put the mode into the "internal_logon" property. Something like the following:
    Properties props = new Properties();
    props.put("user", "scott");
    props.put("password", "tiger");
    props.put("internal_logon", "sysoper");
    Connection conn = DriverManager.getConnection (url, props);
    When connecting as SYSDBA or SYSOPER using the Thin driver, the RDBMS must be configured to use a password file. See "Creating and Maintaining a Password File" in the "Oracle Database Administrator's Guide".
    So, i did execute orapwd command to create a password file and also set remote_login_passwordfile=execlusive in my initxxx.ora initial parameter file, however, when i tried to connect, it failed.
    private static void createEmsdbDatabase(){
    String url = "jdbc:oracle:thin:@localhost:1521:";
    StringBuffer sqlStatement = new StringBuffer();
    sqlStatement.append("create database xxx");
    sqlStatement.append("maxdatafiles 254 ");
    sqlStatement.append("maxinstances 8 ");
    sqlStatement.append("maxlogfiles 32 ");
    sqlStatement.append("character set UTF8 ");
    sqlStatement.append("national character set UTF8 ");
    sqlStatement.append("DATAFILE 'c:\\oracle\\xxx\\system01.dbf' SIZE 18M REUSE ");
    sqlStatement.append("logfile 'c:\\oracle\\xxx\\redo01.log' SIZE 2M REUSE, ");
    sqlStatement.append("'c:\\oracle\\xxx\\redo02.log' SIZE 2M REUSE, ");
    sqlStatement.append("'c:\\oracle\\xxx\\redo03.log' SIZE 2M REUSE ");
    try {
    DriverManager.registerDriver(new OracleDriver());
    Properties props = new Properties();
    props.put("user", "sys");
    props.put("password", "password");
    props.put("database","xxx");
    props.put("internal_logon", "sysdba");
    Connection conn = DriverManager.getConnection(url, props);
    Statement statement = conn.createStatement();
    statement.executeUpdate(sqlStatement.toString());
    statement.close();
    conn.close();
    } catch (SQLException e) {
    e.printStackTrace();
    But what made me puzzled a lot is if i use OCI driver, it did work great, why??? guys, anybody knows, please give me some tips, thanks in advance.
    regards,
    Kaixuan @ Shanghai

    clarify my question in detail:
    Step 1 : create password file using orapwd command
    Step 2 : create database instance using oradim command
    Step 3 : login using sys as sysdba to startup database, e.g startup nomount pfile='...\initxxx.ora'
    Step 4 : create database.
    java code showing below:
    private static void createEmsdbDatabase(){
    String url = "jdbc:oracle:thin:@localhost:1521:";
    StringBuffer sqlStatement = new StringBuffer();
    sqlStatement.append("create database xxx ");
    sqlStatement.append("maxdatafiles 254 ");
    sqlStatement.append("maxinstances 8 ");
    sqlStatement.append("maxlogfiles 32 ");
    sqlStatement.append("character set UTF8 ");
    sqlStatement.append("national character set UTF8 ");
    sqlStatement.append("DATAFILE 'c:\\oracle\\xxx\\system01.dbf' SIZE 18M REUSE ");
    sqlStatement.append("logfile 'c:\\oracle\\xxx\\redo01.log' SIZE 2M REUSE, ");
    sqlStatement.append("'c:\\oracle\\xxx\\redo02.log' SIZE 2M REUSE, ");
    sqlStatement.append("'c:\\oracle\\xxx\\redo03.log' SIZE 2M REUSE ");
    try {
    DriverManager.registerDriver(new OracleDriver());
    Properties props = new Properties();
    props.put("user", "sys");
    props.put("password", "password");
    props.put("database","xxx");
    props.put("internal_logon", "sysdba");
    Connection conn = DriverManager.getConnection(url, props);
    Statement statement = conn.createStatement();
    statement.executeUpdate(sqlStatement.toString());
    statement.close();
    conn.close();
    } catch (SQLException e) {
    e.printStackTrace();
    issue was met here, when i tried to login as sysdba using sys, and in my java code, i use Thin driver, it then thrus exception, but when OCI driver is used, it works great, i don't know why.
    that is, when i use "jdbc:oracle:oci8:@" as database URL and then properties.put("database","xxx"), it works great. but, when i use "jdbc:oracle:thin:@localhost:1521:" as database URL and then properties.put("database","xxx"), it failed. hopefully, i have clarified my question clearly. thanks.

  • Does macbook pro come with microsoft office?

    İ am planning on buying a macbook and i have two questions.
    1)does it come with microsoft office or its cd?
    2)i want it custimised so will apple ship a macbook pro to Turkey??

    Merhaba bey!
    Why don't you just go to the turkish Applestore and order one?
    http://www.apple.com/tr/macbookpro/
    Sorry, my bad, I just figured out it seems you have no ordinary Applestore in Turkey...

  • HT1386 when does a merge sync with icloud

    I have added a second Iphone to my i tunes & merged the contacts from it to contacts on my mac but it won't synchronise with icloud. Previously when I added my original iphone to contacts in outlook (windows XP) all my contacts on outlook were deleted and I ended up with a copy of my empty contact folder from the iphone. What am I doing wrong?

    On My Mac is a local account, it does not sync to iCloud, use the iCloud account for all contacts/calendars you wish to be available on your devices.
    If you are actually using 10.6.7 and not Lion this will not work at all, iCloud services require Lion (10.7.x) or 3rd party software (Soho Organizer) in order to subscribe on Snow Leopard (10.6.x)

  • When does TM erase backups for removed USB/FW drives?

    I have a MacBook Pro running 10.6.1 and I have a 2TB Western Digital My Book Studio (formatted HFS and attached with FW800) on which I store a lot of data (about 1.2 TB).
    I have a couple of backup strategies including Time Machine (my Synology NAS acts as Time Machine server) and I would like to understand better what happens if I allow TM backups to occur WITHOUT my WD My Book FW800.
    My concern is - would TM automatically 'remove' the backups of my FW drive if it's not connected when a backup occurs? This might occur once every four backups...

    rafsanchez wrote:
    Pondini wrote:
    That's not what it says, and not what it means. That article is about when to use Time Machine vs. the Backup application (part of a Mobile Me subscription).
    Whilst the KB does mainly deal with when TM should be used and when Backup should be used, I'm not sure what you mean by "that's not what it says"? The KB does clearly state (as I quoted in my post) that "Time Machine allow you to back up data to a network volume". Perhaps Apple needs to change the text of this KB and make it clear that the "network volume" they mean is only the Time Capsule or later AirDisk.
    Perhaps you need to tell Apple that: http://www.apple.com/feedback/
    TM will do network backups, but only to a Time Capsule; or a shared disk on another Mac running Leopard or Snow Leopard on the same local network; or a USB drive attached to a (recent) Airport Extreme.
    Actually this is not correct as I have been successfully using both Synology and a ReadyNAS devices as TM volumes...all that is needed is a network volume that supports sparsebundle disk images (no firmware hacks on either the NAS or the Mac are needed).
    Yes, sometimes it will. Excuse me for not prefacing that with the word "Officially."
    There are a number of threads here and in the +Leopard / Time Machine+ forums where it works for a while, then something goes wrong, and there don't seem to be any solutions.
    There's even a chance that your backups will be useless just when you need them the most.
    I'm not worried about this because, as I mentioned in my original post, I have a couple of backup strategies
    As long as you (and others who might read this) understand the risks.

  • Does anyone know if I can save my Whatsapp messages when doing a back up with iTunes?

    I might need to restore my iPhone 5. I was wondering if I do the back up with iTunes, will this save my Whatsapp messages? Or would I have to do it through Whatsapp itself?
    Thank yoooouuu.

    hi gabrielaaimeefp
    If you want to take backup of your whatsapp message, you have to do it through app, whatsapp allows users to backup their messages into icloud through app, just go into the settings of the whatsapp their you will find chat setting in the chat setting you will find chat backup their you can backup your whatsapp messages and you could also set to auto backup for it.

  • TS1638 When syncing calendar on iPhone with Microsoft Office whole day appointments get moved to double day. I am aware this may be caused by conflicts in clock, viz daylight saving time. However, Outlook seems OK and takes time from Windows time and zone

    When syncing my iPhone to Microsoft Outloook all the full day appointments become two day - 2300hrs to 2300hrs next day. Sometimes this will include a nuber of a single day of 23 hours. Looked at solutions and all point to a clock issue or a daylight saving and winter times. Outlook operating time is directly from the Windows clock that incudes the change of times for daylight saving etc. It is set for UTC Dublin, Edinburgh, Lisban, London with daylight saving included in the options. I can't see what I can do.

    When syncing my iPhone to Microsoft Outloook all the full day appointments become two day - 2300hrs to 2300hrs next day. Sometimes this will include a nuber of a single day of 23 hours. Looked at solutions and all point to a clock issue or a daylight saving and winter times. Outlook operating time is directly from the Windows clock that incudes the change of times for daylight saving etc. It is set for UTC Dublin, Edinburgh, Lisban, London with daylight saving included in the options. I can't see what I can do.

  • Does logic pro works with hd native thunderbolt?

    my logic pro does not recognized my HD Native thnderbolt!! what can i do?
    David

    Hello there! who's Core Audio driver? avid or logic? where can i find it?

  • Does Mac Office work with Microsoft Office

    I'm a teenager making a choice on getting a macbook for school because I heard macs are outstanding and have done research on them too. The only thing I dont know and need to know is that, does the Mac Office work with Mircosoft Office? I would like to know this because I like to write papers home and at school but I dont know if I can transfer the data from my schools Mirosoft Office to a Mac Office.
    Thanks!
    -Jake

    Hey JC21 and welcome to the forum -
    I think you mean one of these 2 products:
    [*iWork '09*|http://store.apple.com/us/product/MB942Z/A/iWork-09?fnode=MTY1NDA0OA&mco=M TM5NjI0MDY] (see the Compatibility and Sharing section)
    [*Office 2008 for Mac*|http://store.apple.com/us/product/TQ744LL/A/Office-2008-for-Mac-Home-Stude nt-Microsoft?fnode=MTY1NDA0OA&mco=MTU3NDU2OTY] made by microsoft for a Mac
    Click on the links above to read all about these application and their compatibility with the windows version of ms office.

  • Does the E71 work with Microsoft Active Sync or no...

    Hi,
    Can anyone help please.
    I need to Sync the E71 with my work email, the company runs Exchange servers. 
    I've read countless messages and posts about the E71 and Active Sync and I still can't understand if it works or not. I know the specification says it supports Microsoft Active Sync but does it work?
    Can anyone give me any tips, advice or any downloads that are required?  
    A guy at the office has an E63 and he cannot get it to receive his work emails. The IT department have tried and say it just does not work.
    Any pointers would be very welcome!
    Many thanks,

    Hi,
    Nokia E71 supports Active Sync Protocol, to Sync your Personal Info with your corporate Microsoft Exchange Account, you can install Mail for Exchange (An application from Nokia to receive/sync your corporate mails) which works on the Active Sync protocol. Log onto www.businesssoftware.nokia.com or go to Downloads in your handset & download the Mail for Exchange application. Install it in your handset, then contact your Company's IT Admin to configure the account & enable you to receive/sync mails with your corporate account. For more info on Mail for Exchange, log onto www.businesssoftware.nokia.com
    "If this post helped you solve your concern, please do click the KUDOS tab."

  • Why does adobe reader work with microsoft explorer but it doen't work with Firefox?

    Web Pages do not show PDF files when I try to open them..

    Tools > Options > Applications > Portable Document Format (PDF) > Use Other > Browse to Adobe Reader

Maybe you are looking for

  • BUTTON CLICK ON SEARCH ITEM CAUSES OTHER REGIONS (FORM) IN TABLE TO ERRORS

    Hello, I dont know if I have come to a limitation or flaw of the XE or is it me who does not know how to. (probably me) The thing is that I have in one page, one standard form for entering data and one report output table to show them. This output ta

  • Help,Again!!! I didn't receive a email when I set up imessage!

    How come when I set up imessage, I don't get a email back and back in settings, it says Error next to my email address?  Also, don't say that I need to wait, because I have been waiting for a day and counting!

  • Suitable Page Size for Fixed Layout

    What could be a suitable Page Size for EPUB Fixed Layout? Is there a best practice? Should we take iBook Author's format which is 768 x 1004 pt? Has Google Play Books any suggestions (I didn't found any...). Any suggestions? Thanks Haeme Ulrich

  • JMenu obscured by another component

    Hi all, I've inherited about 10k lines of jdk 1.2 code and I'm converting it to swing for the GUI. There's some pretty messing implementation of scroll panes and such (It's essentially a telnet client). So, here is what I am experiencing: I changed a

  • Telepresence: Cisco vs Polycom

    My personal opinion. Both systems work really well; and I'd be happy to highly recommend both.However, as a general rule, the Cisco kit is a bit more expensive than the Polycom. The argument could be made that the difference between the two is that C