JDBC access in conjunction with Swing

I'm attempting to query a database to retrieve two Strings. Next I'm trying to take those two Strings and add them to a JLabel before adding them to a JPanel.
My problem is that BEFORE I create the database connection, I can add Strings to JLabels and then to the JPanel without trouble, however AFTER I create the database Connection I CAN'T add any Components to the JPanel.
I have a close() call on the Connection before I attempt to make additions to the JPanel.
I also discovered that most attempted additions to the JPanel BEFORE the database Connection is created are NOT added to the JPanel either.
I'm reluctant at the moment to post my code because it's still in a bit of a mess. So you know, the database connection is working correctly as I can still perform queries and display output to the console, also, adding Components to the JPanel is also working correctly (without the presence of the database Connection).
If anyone would like to see my code, I'll definately clean it up a bit and post it.
Edited by: chris.little on Dec 6, 2007 2:41 PM
UPDATE**
Turns out it was a mix up of where I had placed my Frame.pack() call.
Edited by: chris.little on Dec 6, 2007 4:33 PM

Refer to UPDATE** on post

Similar Messages

  • Accessing synonym tables with jdbc

    accessing synonym tables with oracle jdbc driver 9i
    hi
    i'm having a problem selecting, updating, inserting and retrieving metadata from synonym tables.
    simple example is selecting from a table that is a synonym, i receive ORA-00942 table or view does not exist.
    is there any way to access synonym tables using the oracle jdbc driver?
    any help would be most appreciated.
    thanks
    Takis

    Hi Mirco,
    you can create your own function module to read TOA01 table and call this function module. It is a 5 minutes job of your ABAP programmer.
    To read list of BAPIs existing in your system call transaction BAPI.
    Generally there is no reason to read SAP tables. Think about 15.000 - 20.000 tables of standard SAP Web AS. No one is able to give you data model. You have to use business objects and their methods.
    Jiri

  • How use jdbc with swing ? i am new in this concept.

    hi
    freinds,
    i am new in java can any one give the example which explain the how to use jdbc with swing.
    thanks in advace.
    satish
    thanks.

    See here  >  http://support.apple.com/kb/HT4236
    More info in the User Guides for your Devices...

  • Connect jasper report with swing

    hai
    can any one tell me how to connect jasper report with swing plz.
    Thanks in advance.

    Thanks for your reply
    i tried the code you gave. but i get following error during runtime
    java.lang.NoClassDefFoundError: org/apache/commons/javaflow/bytecode/Continuable
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(Unknown Source)
         at java.security.SecureClassLoader.defineClass(Unknown Source)
         at java.net.URLClassLoader.defineClass(Unknown Source)
         at java.net.URLClassLoader.access$100(Unknown Source)
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
         at java.lang.ClassLoader.defineClass0(Native Method)
         at java.lang.ClassLoader.defineClass(Unknown Source)
         at java.security.SecureClassLoader.defineClass(Unknown Source)
         at java.net.URLClassLoader.defineClass(Unknown Source)
         at java.net.URLClassLoader.access$100(Unknown Source)
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
         at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:402)
         at Report.runReport(Report.java:35)
         at Report.main(Report.java:47)
    Exception in thread "main" & this is the code i used
    import java.sql.*;
    import net.sf.jasperreports.view.JasperViewer;
    import net.sf.jasperreports.engine.xml.JRXmlLoader;
    import net.sf.jasperreports.engine.JasperCompileManager;
    import net.sf.jasperreports.engine.JasperFillManager;
    import net.sf.jasperreports.engine.JasperPrint;
    import net.sf.jasperreports.engine.design.JasperDesign;
    import net.sf.jasperreports.engine.JasperReport;
    import java.io.File;
    import java.io.OutputStream;
    public class Report {
         public static Connection connectDB() {
              Connection jdbcConnection = null;
              try {
                   Class.forName("com.mysql.jdbc.Driver");
                   jdbcConnection = DriverManager
                             .getConnection("jdbc:mysql://localhost/example?user=root&password=yspl");
              } catch (Exception ex) {
                   String connectMsg = "Could not connect to the database: "
                             + ex.getMessage() + " " + ex.getLocalizedMessage();
                   System.out.println(connectMsg);
              return jdbcConnection;
         public static void runReport() {
              try {
                   JasperDesign jasperDesign = JRXmlLoader
                             .load(new File("F:\\Reports\\testReport.jrxml"));
                   JasperReport jasperReport = JasperCompileManager
                             .compileReport(jasperDesign);
                   Connection jdbcConnection = connectDB();
                   JasperPrint jasperPrint = JasperFillManager.fillReport(
                             jasperReport, null, jdbcConnection);
                   JasperViewer.viewReport(jasperPrint);
              } catch (Exception ex) {
                   String connectMsg = "Could not create the report "
                             + ex.getMessage() + " " + ex.getLocalizedMessage();
                   System.out.println(connectMsg);
         public static void main(String[] args) {
              runReport();
    }why i occurs please tell me
    anticipating for your reply
    Thanks once again

  • Error transaction no longer active, no further JDBC access allowed

    Hello
    Our application uses WLS 6.0 SP2, TopLink 3.5.3, WebLogic JMS. A
    (pooled) JMS driven message bean invokes other application components
    (stateless session beans). Also, application components use JMS to send
    messages. JMS and application (through TopLink) use the same JDBC
    connection pool. TopLink connects through javax.sql.DataSource and
    external transaction controller. 2PC transactions are required to
    integrate JMS and TopLink DB access (see data source definition below).
    All components run in a single JVM, there is not distributed transaction
    between JVMs.
    When pushing > 5 concurrent messages into the system I get an error that
    somehow indicates TopLink access to a connection that is no longer
    associated with a WebLogic transaction.
    I can consistently reproduce this error with the Oracle thin, Oracle OCI
    and WebLogic OCI JDBC drivers. It seems to occur independent from the
    maximum number of connections in the pool (tested between 1 and 30).
    Also, when serializing the message supply with a pause in between the
    error does not seem to occur.
    Has anybody seen this type of problem before?
    Are there possibly known issues with the external transaction controller
    integration?
    Any help greatly appreciated.
    Thanks,
    Thomas
    EXCEPTION [TOPLINK-4002] (3.5.3 JDK1.2):
    TOPLink.Public.Exceptions.DatabaseException
    EXCEPTION DESCRIPTION: java.sql.SQLException: The transaction is no
    longer active (status = Committing). No further JDBC access is allowed
    within this transaction.
    INTERNAL EXCEPTION: java.sql.SQLException: The transaction is no longer
    active (status = Committing). No further JDBC access is allowed within
    this transaction.
    ERROR CODE: 0
    ### WebLogic config.xml ###
    <JDBCConnectionPool CapacityIncrement="1"
    DriverName="oracle.jdbc.driver.OracleDriver" InitialCapacity="1"
    MaxCapacity="15" Name="oraclePool"
    Properties="user=wlpi20;password=wlpi20;dll=ocijdbc8;protocol=thin"
    Targets="appserver"
    URL="jdbc:oracle:thin:@10.3.209.35:1521:wcdevdb"/>
    <JDBCTxDataSource EnableTwoPhaseCommit="true"
    JNDIName="com.bea.wlpi.TXDataSource" Name="TXDataSource"
    PoolName="oraclePool" Targets="appserver"/>
    <JMSJDBCStore ConnectionPool="oraclePool" Name="oraclePool"/>
    ### TopLink session/login setup for external transaction controller ###
    DatabaseLogin login = project.getLogin();
    login.setConnector(new TOPLink.Public.JNDI.JNDIConnector(
    initialContext, jdbcDataSource));
    login.setUserName(jdbcUser);
    login.setPassword(jdbcPasswd);
    ServerSession session = new ServerSession(project);
    login.useExternalConnectionPooling();
    login.useExternalTransactionController();
    final String tmname = "weblogic/transaction/TransactionManager";
    javax.transaction.TransactionManager transMgr =
    (javax.transaction.TransactionManager)
    initialContext.lookup(tmname);
    JTSSynchronizationListener.setTransactionManager(transMgr);
    session.setExternalTransactionController(
    new TOPLink.Public.JTS.JTSExternalTransactionController());
    logger.fine("registered external transaction controller");

    Better to ask on a hibernate forum, but you seem to
    be trying to reuse a closed transaction. If you have
    auto-commit set to ttrue, try changing it to false,
    the explicitly calling commit when you are done.Might be worth finding out why something is trying to use a closed transaction first, before changing your entire transaction management idiom, though

  • Using Tangosol Coherence in conjunction with Kodo JDO for distributing caching

    JDO currently has a perception problem in terms of performance. Transparent
    persistence is perceived to have a significant performance overhead compared
    to hand-coded JDBC. That was certainly true a while ago, when the first JDO
    implementations were evaluated. They typically performed about half as well
    and with higher resource requirements. No doubt JDO vendors have closed that
    gap by caching PreparedStatements, queries, data, and by using other
    optimizations.
    Aside from the ease of programming through transparent persistence, I
    believe that using JDO in conjunction with distributed caching techniques in
    a J2EE managed environment has the opportunity to transparently give
    scalability, performance, and availability improvements that would otherwise
    be much more difficult to realize through other persistence techniques.
    In particular, it looks like Tangosol is doing a lot of good work in the
    area of distributed caching for J2EE. For example, executing parallelized
    searches in a cluster is a capability that is pretty unique and potentially
    very valuable to many applications. It would appear to me to be a lot of
    synergy between Kodo JDO and Tangosol Coherence. Using Coherence as an
    implementation of Kodo JDO's distributed cache would be a natural desire for
    enterprise applications that have J2EE clustering requirements for high
    scalability, performance, and availability.
    I'm wondering if Solarmetric has any ideas or plans for closer integration
    (e.g., pluggability) of Tangosol Coherence into Kodo JDO. This is just my
    personal opinion, but I think a partnership between your two organizations
    to do this integration would be mutually advantageous, and it would
    potentially be very attractive to your customers.
    Ben

    Marc,
    Thanks for pointing that out. That is truly excellent!
    Ben
    "Marc Prud'hommeaux" <[email protected]> wrote in message
    news:[email protected]...
    Ben-
    We do currently have a plug-in for backing our data cache with a
    Tangosol cache.
    See: http://docs.solarmetric.com/manual.html#datastore_cache_config
    In article <[email protected]>, Ben Eng wrote:
    JDO currently has a perception problem in terms of performance.
    Transparent
    persistence is perceived to have a significant performance overheadcompared
    to hand-coded JDBC. That was certainly true a while ago, when the firstJDO
    implementations were evaluated. They typically performed about half aswell
    and with higher resource requirements. No doubt JDO vendors have closedthat
    gap by caching PreparedStatements, queries, data, and by using other
    optimizations.
    Aside from the ease of programming through transparent persistence, I
    believe that using JDO in conjunction with distributed cachingtechniques in
    a J2EE managed environment has the opportunity to transparently give
    scalability, performance, and availability improvements that wouldotherwise
    be much more difficult to realize through other persistence techniques.
    In particular, it looks like Tangosol is doing a lot of good work in the
    area of distributed caching for J2EE. For example, executingparallelized
    searches in a cluster is a capability that is pretty unique andpotentially
    very valuable to many applications. It would appear to me to be a lot of
    synergy between Kodo JDO and Tangosol Coherence. Using Coherence as an
    implementation of Kodo JDO's distributed cache would be a natural desirefor
    enterprise applications that have J2EE clustering requirements for high
    scalability, performance, and availability.
    I'm wondering if Solarmetric has any ideas or plans for closerintegration
    (e.g., pluggability) of Tangosol Coherence into Kodo JDO. This is justmy
    personal opinion, but I think a partnership between your twoorganizations
    to do this integration would be mutually advantageous, and it would
    potentially be very attractive to your customers.
    Ben--
    Marc Prud'hommeaux [email protected]
    SolarMetric Inc. http://www.solarmetric.com

  • High performance (low level) jdbc access routines

    Does anyone know of any low level jdbc access routines?
    My need is to be able to do high speed data access. I'm looking for something 2 orders of magnitude faster than what is available with the typical use of java.sql (connection, preparedstatement, resultset and so on).
    Several years ago while using visual basic and odbc, I had to use direct calls to the odbc32.dll functions for data access to get the performance I wanted rather than the ado and rdo stuff. I am wondering what is available with jdbc - perhaps the routines that are used when writing jdbc drivers themselves. I don't know if there is an equivalent "gateway" that all jdbc drivers use (like the odbc32.dll that is used with all odbc drivers in windows)
    Any comments would be appreciated. Even just hints as to where I might find this kind of information.

    Does anyone know of any low level jdbc access routines? What are you expecting besides what is provided in the java.sql interfaces?
    The JDBC spec spells out what the interfaces are. There isn't anything else to call.
    >
    My need is to be able to do high speed data access.
    I'm looking for something 2 orders of magnitude
    faster than what is available with the typical use
    of java.sql (connection, preparedstatement, resultset
    and so on).Faster than what driver talking to what database over what network?
    Several years ago while using visual basic and odbc,
    I had to use direct calls to the odbc32.dll functions
    for data access to get the performance I wanted
    rather than the ado and rdo stuff. I am wondering
    what is available with jdbc - perhaps the routines
    that are used when writing jdbc drivers themselves.You'll have to write your own driver.
    I don't know if there is an equivalent "gateway"
    " that all jdbc drivers use (like the odbc32.dll that
    is used with all odbc drivers in windows)Since Java's platform-independent, there's no easy out like taking advantage of OS calls.
    Any comments would be appreciated. Even just hints
    as to where I might find this kind of information.Sounds to me like you want to write your own driver, and when you're done it will only be good for one database and operating system.
    I'd have to ask what made you so certain that database calls were the bottleneck in your app. For the typical Web app, a reasonably well written persistence layer will be fast enough. There's other network latency in the system, and UI response can be slow enough to keep up. Are you worried about high throughput to the database for a Web app? If so, you might be guilty of premature optimization.
    Unless I was absolutely certain that the JDBC driver from my database vendor would not do the job, I'd write the app and then profile it to find out where the performance bottlenecks were. I wouldn't take this extreme step until I was certain that the driver was the problem and a custom version would fix it.
    %

  • Jdbc 9.2 work with RAC database

    Dear Sirs,
    I notice that jdbc 9.2 support the use of service name in the connection string, i.e : host:port_no:service_name, prior to 9.2, sid must be used to make the connection.
    Question
    1. After using jdbc 9.2 with service name, can it be benefit from the load-balancing and failover feature of 9i RAC database ?
    2. Does jdbc 9.2 compatible with Oracle 817 database ?
    Thanks

    I am having a number of problems using JDBC 9.2 with Oracle Server 8.17. Specifically it is not recognizing existing column names and applying un-related constraints when attempting to access tables. It appears to function correctly when using Oracle Server 9.0.1. Is anyone having similar problems?

  • Can I build a GUI application with SWING only without [import java.awt.*;]

    I have seen several threads (in forums), books and tutorials about SWING and I see that they all mix SWING with AWT (I mean they import both Swing and AWT in their code).
    The conclusion that comes out is:
    It is good to learn about SWING and forget AWT as it won't be supported later. I have decided to do so, and I never include <<import java.awt.*;>> in my code.
    But I see that you cannot do much without <<import java.awt.*;>>. For example this line which changes the background color:
    <<frame.getContentPane().setBackground(Color.red)>>
    works only with <<import java.awt.*;>>. I have seen that codes in this and other forums import awt to change the background. Why is that?
    After all, I wonder, what can I do;
    My question is, can I change the background (and of course do all other things listener, buttons etc) without using <<import java.awt.*;>>.
    I would like to avoid using <<import java.awt.*;>> and using awt since my program will not work later.
    In addition, I believe there is no point to learn awt, which later will not exist.
    I know, I must have misunderstood something. I would appreceate it very much, if anyone could give me even a short answer.
    Thank you in advance,
    JMelsi

    Since swing is a layer on top of awt, AWT will exist for as long as swing does.
    If sun does ever remove AWT they will have to replace it something else swing can layer on to and you will probably only have to replace your import statements.
    The main difference is the way there drawn to the screen.
    You can do custom drawing on swing components but you can't on AWT.
    If your using a desktop PC system it's probably best to use swing just in case you wish to do some custom drawing.
    awt uses less memory than swing and is faster but swing can be extended. awt comes only as standard.
    Say for example you wish to implement a JButton with a ProgressBar below the button text, this can be done with swing!

  • How do I share access to Dreamweaver with a colleague of mine in a separate location?

    How do I share access to Dreamweaver with a colleague of mine in a separate location?
    I currently have DW loaded onto my desktop. I am presuming that if my colleague wants to get access to it, I have to copy the DW files I've created and put them onto the creative cloud connection. If that is the answer, How do I do that?
    My colleague has already downloaded DW onto his computer - he just can't see the files that I've created, even though I am making sure that my version of DW is always closed when he accesses his version.
    Any help gratefully received
    Jamie

    It is against the standard Dreamweaver license for your colleague to be using your license. Your colleague needs his license.

  • Error while accessing BSAD Table with dunning date

    Hi ,
    I developed a report for FI module accessing BSAD table with default customer ranges and for specific dunning dates - It ran for a very long time and timed out - (I know this is due to huge volume of data) -
    Is there any way to access BSAD table easily with Dunning dates (Other than creating Index on it) ???
    Or any standard function module available ??
    Regards
    Rajesh.

    Hi
    Try the below tables for the dunning data details:
    MHND            Dunning Data
    MHNDO           Dunning data version before the next change
    MHNK            Dunning data (account entries)
    MHNKA           Version administration of dunning changes
    MHNKO           Dunning data (acct entries) version before the next chang
    SKS

  • I have a tesco router and an external hard drive attached to it as a network drive (shared) for my macbook and MB-Air. Have no problems with my MB accessing it, but with MB-AIR it says -  'the version of the server you are trying to connect to is not supp

    I have a tesco router and an external hard drive attached to it as a network drive (shared) for my macbook and MB-Air. Have no problems with my MB accessing it, but with MB-AIR it says -  'the version of the server you are trying to connect to is not supported. pls contact your system administrator to resolve the problem'. MB-Air uses maverick downloaded yesterday - upgrade from mountain lion. MB uses snow leopard still, as i am quite used to it and am thinking of upgrade if mavericks work fine on air. Also have parallel on snow leopard but it is no longer supported according to mac website - if i upgrade am i going to lose my parallel and will have to buy a new one!!!

    Yes, the Old Master file has a folder for each year where I find all photos from that specific year. I am attaching a screen shot of the file.
    In the meantime i have managed to download all photos (it did not download any video files though in mpg, avi, 3gp, m4v,mp4 and mov format) to a new iphoto library. Unfortunately the photos are quite mixed and often doubled up. I ma considering to purchase iphoto library which checks all duplicates in iphoto. this will save me a lot of time. What do you think?

  • I can't access the internet with Firefox on my computer (Windows 7 PC). I have used Firefox as my browser for 1 year but 5 days ago it stopped working even though Internet Explorer worked fine. I can't solve the problem and need some help.Randy Brown

    September 26, 2011
    Dear Mozilla,
    I am having some difficulty accessing the internet with Firefox on one of my PC computers. I normally use Mozilla Firefox as my web browser and google is my homepage and gmail is my email system. The operating system is Windows 7. For over a year this system worked perfectly but a few days ago it stopped working. When I launch Firefox now I get the message that that website (www.google.com) is unavailable. In fact, I can’t access any website and I am blocked from the internet entirely within Firefox. My internet connection is fine because Internet Explorer works fine. I can access google and any other website within that web browser. I have investigated all the security issue I can manage and found no smoking gun. I’ve tried uninstalling and reinstalling Firefox to no avail. Is Windows 7 compromising the effectiveness of Firefox? Any suggestions or other assistance you can offer would be appreciated.
    Sincerely,
    Randy Brown
    [email protected]

    You only have to clone your mac when using certain cable modem.  You don't clone your mac when using dsl.
    Greetings from Northern Ontario, Canada

  • Multiple users accessing entity bean with same PK

    Hi,
    Some body please clarify the below issue.
    (EJB 1.1, WAS3.5)
    I have two app servers and two clones each clone is running in each app server.
    Stateful session bean access Entity beans to update/read record in the database.
    According to my requirement multiple users can access the same entity data (same primary key). Suppose user A created a Stateful session bean SB1 and the SB1 created Entity1 with PK1, this is happening at clone1.
    User B accessed the site and the request went to Clone2 and a new SB2 created, but the SB2 need to access the database with Same PK1.
    For the above situation, I guess container can not create a new Entity bean with PK1 because EB with PK1 is already there and it tries to allocate same EB1 with SB2, so if two requests are concurrent do the SB2 wait to get the handle of the EB1?
    Is there any way to create two Entity beans with same Primary Key at the same time but in different clone?
    Thanks,
    Sagar

    Hi,
    The concurrency level has to be set at the level of database and the database will take care of consistency & integrity of the data. So specity the concurrency level on the database connection in each appserver.

  • I'm not able to access goolge docs with the blackberry browser (it worked fine till a few weeks ago)

    I'm not able to access google docs with the blackberry browser (it worked fine till a few weeks ago)
    seems that this issue happens to a lot of people
    is google going head to head with Blackberry ? or is this just a bug ? 
    Message Edited by avolcoff on 08-27-2009 01:06 AM

    Welcme to the cmmunity supprt frums
    Nurse-Berry
    Follow NurseBerry08 on Twitter

Maybe you are looking for

  • I want to downgrade my IPad 2 from IOS 6.0 to 5.1.1

    It's really a stuff that Apple gave to their fan. What is the terrible IOS with a lots of errors, I have no 3G enable/off at my ipad 2 after upgarding to IOS 6. There are some terrible functions as..........Map. Apple support need to help your END US

  • Unable to create a new company

    Hi All I have installed sap business one 8.8 But i am unable to create a new company. new button only is missing Regards Farheen

  • How to replace a "notfound" output with a null value?

    hi, I'm just getting a output of "Rows Notfound" for a script.. instead of this , i just need to show the output with a record as null value or some value.. do we have any option to use this in oracle..

  • Custom Icon goes with usb peripheral from Mac to different Mac

    Okay, so I can change the icon on my usb flash drive to show a custom icon each time I plug it into the same Mac day after day, but what if I want to change to a different computer, say my Mac at home, the icon comes up as the default icon. Can I loc

  • Flash CS3 swf quality on dvd work flow

    I have a larage movie that will not export out of flash in avi it stops work windowsexporterserver.exe stops working and it stops. i want the quality i see in swf file and windows exe projector file on dvd and the web Ihave tried everything