JDBC with Swing ?

Hi,
I want to build a Java application that accesses an Oracle database. I want the fields of that form (JTextField) to be somehow "assocated" to the database's table so that whenever I update the field all I have to do is a save (or commit).
I know Borland has a bunch of tools like that (com.borland.dx.dataset), but I want to stay away from that Borland-specific stuff.
Is that possible to do with the Rowset Implementation ? Do I need something else ?
Thanks !

Here is what I mean :
Let say you have a JFrame with a few JTextFields and JCheckBox, and you want to have a simple query returning the results into those fields.
Then, after modifying the value of those fields, you want to click on Save.
Is there a way to show the query data in those fields and "post" the changes without saying : JTextField value goes to that table column, etc.
Something like :
  jtextfield1.assignToTable("MYTABLE");
  jtextfield1.assignToColumn("PRODUCT_ID");And whenever I update or requery this database table, the associated fields would get populated automatically.
Regards,
Alexandre

Similar Messages

  • 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

  • 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!

  • JDBC with SQL Server

    Hi,
    I am trying to connect to a SQL server database by giving table name in (SPVC) database as spvc.dbo.tablename.. If i want to access another database (SPVC_D), how can i do it without changing my java code?? Can i be able to add the database name to the connection string and i can remove the hard coding (spvc.dbo.) from my java code?? How shall i be able to do that..
    Please let me know.. I am very new with JDBC with SQL server..
    Thanks
    Praveen Padala

    In the MS SQL Server that I use, the following syntax
    spvc.dbo.tablename
    Breaks done as follows...
    <database>.<user>.<tablename>
    However connections are always to a database. Thus when one uses the above syntax it basically runs 'in' the one database and accesses another.
    Depending on various attributes of the tables, if and only if, a table called 'tablename' exists in a database called 'spvc_d' then if you connect to 'spvc_d' then you can access 'tablename' just by using 'tablename'.
    So if that is what you are doing you will not have a problem.

  • Using Report tool with Swing Application

    I'd like to use a reporting tool (Crystal Reports or anything else) with Swing application. Could anyone help me?

    You have to pass the values are parameters to the Oracle Reports report. Take a look at this: http://www.oracle.com/technology/products/database/application_express/howtos/howto_integrate_oracle_reports.html
    Also you can search this forum for "Oracle Reports"
    Mike

  • Integrating crystal report with swing application

    Hi,
    Any body knows how to integrate crystal reports with swings?
    I'm posting this after a painful search in the net/forum.Any idea
    will be greatly apprecited.
    thanx.
    regards,
    jmos

    The best place to pick up sample code is straight from the horses mouth. [url http://www.businessobjects.com/products/dev_zone/java/default.asp?ref=devzone_main] Crystal java zone

  • Reversing with swing? Help!

    Alright, before you guys flip out and say post it to the swing forum, why does the swing forum say read only? Now I have searched the forum but cannot find anything that deals with swing and the kind I am doing. So if you can provide some advice or some help, it would be greatly appreciated. This is my last hurdle to tackle in my school project.
    I tried a StringBuffer approach but it kept giving me an error saying it would not work with JTextArea? Maybe the code was wrong?
    This needs to take the text on the screen which I have and post it reversed when the "Reverse" button is clicked... I have been searching the web and these forums and all the different reverse methods and theories are confusing me, I try to copy them and get them to work but I just keep receiving errors. What is the best way to do this with using GUI?
    else if (actionCommand.equals("Reverse"))
              reverseMemo = theText.getText();
    /*Is this where I would put the reverse code?*/          
    theText.setText(reverseMemo);
         }Thanks,
    Jess

    Just write a method to reverse the text
    read the string in reverse and start plugging the values into a string buffer (inside a loop of course)
    then display results:
    textfield.setText(stringbuffer.toString());
    This is my last hurdle to tackle in my school project.I highly doubt it.
    The fact you are asking this question shows me you did not learn anything about Java much less computer science. Your question has nothing to do with swing.

  • Can i use EJB with Swing?

    Hi,
    I am developing an application in which i am using the "Swing" for GUI.Can i use the "EJB" with swing?
    regards

    Hi,
    Sure you can. The earlier poster has said the same thing too. Just that hes made out like this is possible only in jboss. EJB is a distributed component framework and can support multiple types of clients. The client can be a servlet or jsp, another EJB or in your case a swing application. In fact many IDE's allow you to test your EJB called by generating an application client. You need to add a special application client deployment descriptor file ( atleast with weblogic) in order to do this.
    Hope this helps.
    cheers,
    vidyut
    http://www.bonanzasoft.com

  • Replainf JDBC with Jco

    Hi,
    i want to replace my JDBC  with Jco to communicate with SAP. May i know what all are required to do ?

    if you want to use adaptive rfc model that can communicate with SAP you need to follow this link
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/355b9c90-0201-0010-d2a8-89fece426526
    for that you need to configure the JCO destinations follow this
    http://help.sap.com/saphelp_nw04/helpdata/en/3a/3b1b40fcdd8f5ce10000000a155106/frameset.htm
    if you want to java connectors to connect to SAP follow this
    https://forums.sdn.sap.com/click.jspa?searchID=8562442&messageID=4388980
    reward points if helpful

  • How to link crystal report with swing

    I am developing applications in swing. I have done a report using crystal report.
    Now i don't know how to link it with swing. can anyone help me to solve this with some examles.
    thanx in advanz

    Hope these links are useful:
    http://www.must.de/default.html?Jareport.htm
    http://www.utdallas.edu/~pxm034000/files/integrating.html

  • Integrating flash with swings

    Hi,
    Im looking to integrate flash with swings. This is for a desktop application, not a web based application. I was looking for some help on this, if someone could help me with it.
    Regards,
    Ghost Rider

    Flash is proprietary technology and they don't play nice with others. Same reason why you can't load an MSWord doc in a Java GUI. If Flash WAS an open technology, then perhaps someone would/could build a plugin or some way to do it.

  • Use direct JDBC with CMP entity bean in one transaction

    I am trying to use direct JDBC call with CMP entity bean within a session
    bean method that requires transaction. The problem is that it appears these
    are not in the same transaction. When I use the JDBC call, the CMP entity
    bean update to the DB has not been committed yet.
    We are using Weblogic 5.1 SP6. The DB is Oracle.
    What I do for the JDBC is get a new connection from the pool using weblogic
    jdbc pool driver.
    Any help would be appreciated.
    Patrick

    Hi. You can do JDBC and invoke CMP EJBs and have this all treated
    as one transaction, if your hand-written code explicitly starts
    a JTS transaction, then uses the jts driver or a TxDataSource to
    get the JDBC connection. Then your code can call transactional
    EJBs and their work will be included in the transaction you started.
    Assuming the bean work went OK, and your manual JDBC went OK, you
    can manually commit the UserTransaction at that time. This is 5.1
    talk. For 6.0, with @PC, this may be even easier...
    Joe
    Patrick Shen wrote:
    >
    But if I do that, then they would not be in the same transaction anymore.
    Is there any way to use JDBC with CMP Entity bean in the same transaction?
    Patrick
    "L'artiste" <[email protected]> wrote in message
    news:[email protected]...
    Are you calling all the CMP create in the session Bean ? If so, beforeyou
    make the JDBC call from the session bean, the CMP in 2. should commit. Try
    to set its attribute to TX_REQUIRES_NEW. This way, the calling client will
    block until this transaction is done (committed) before the execution
    continues. There might be some overhead involved in doing so if you are
    anticipating a lot of users.
    "Patrick Shen" <[email protected]> wrote in message
    news:[email protected]...
    What I am trying to do is:
    In a Session bean method -
    1. create a new CMP entity bean (a new row in DB table)
    2. create another new CMP entity bean that uses previous bean as foreignkey
    3. use JDBC to update the row just created
    And all these 3 calls have to be in one transaction.
    Thanks,
    Patrick
    "L'artiste" <[email protected]> wrote in message
    news:[email protected]...
    Can you give a little bit more information?
    Do you have methods in your session bean that creates this CMP entitybeans?
    It looks like
    you might wanna try to change the isolation level to
    TRANSACTION_READ_COMITTED
    to preven dirty_read.
    "Patrick Shen" <[email protected]> wrote in message
    news:[email protected]...
    I am trying to use direct JDBC call with CMP entity bean within a
    session
    bean method that requires transaction. The problem is that it
    appears
    these
    are not in the same transaction. When I use the JDBC call, the CMP
    entity
    bean update to the DB has not been committed yet.
    We are using Weblogic 5.1 SP6. The DB is Oracle.
    What I do for the JDBC is get a new connection from the pool usingweblogic
    jdbc pool driver.
    Any help would be appreciated.
    Patrick
    PS: Folks: BEA WebLogic is expanding rapidly, with both entry and advanced positions
    for people who want to work with Java, XML, SOAP and E-Commerce infrastructure products.
    We have jobs at Nashua NH, Liberty Corner NJ, San Francisco and San Jose CA.
    Send resumes to [email protected]

  • How to use unload query using JDBC with Informix database

    Hi friends,
    How can i use unload query using JDBC with Informix database?
    When i use it as "unload to 'abc.txt' select * from ........" it gives syntax error.I want to take the data of a table to a file.With dbaccess i can use it but i need to do it using jdbc.
    Thanks,
    Raneesh.

    To the best of my ability to tell, the right way to use this product from within Power Query would be to use its API. Unfortunately, we don't currently support either of the methods needed to be able to authenticate with the service (OAuth 2.0 and a relatively-custom
    digest-based method). Adding a mechanism to allow use of arbitrary OAuth-protected resources is a fairly high priority for us, and I hope we'll be able to deliver something before mid-2015.
    Scraping the website is very hard to do well -- both from an authentication and from a data discovery perspective.

  • Do I need to make an applet with swing point to the JRE 1.4 plug-in?

    Do I need to make an applet with swing point to the JRE 1.4 plug-in? I mean, in 1.3.1 plug-in, if you did not run your code through the HTML converter, the applet would still use the browsers JRE (JVM). However, with 1.4.0, it seems that you don't need to. Is this correct?

    When you ran an applet that has been compiled under 1.4 and needs classes or methods from 1.4 with an old HTML file (presumedly with the <object> tag that still refers to JRE 1.3+), the browser is going to look at the <object> tag and see that at least JRE1.3.1 is needed to correctly run the applet and since 1.4, which is higher than 1.3+, is on the system, it ignorantly proceeds to load and run the applet. The problem that you're going to run into is when you deploy the applet on the web and your viewer only have JRE1.3+, your applet which really needs 1.4, will crap out....
    ;o)
    V.V.

Maybe you are looking for

  • Creating multiple libraries and using an external drive for data

    I'm a recent switcher and new to iphoto. On the windows platform, I used adobe album. I have a around 10k of images that I put on an external drive which is attached to my new imac. I deleted the iphoto folder and redirected it to my images on my ext

  • Importing iTunes library from old powerbook to new macbook pro

    What is the best way to import my old itunes library (from my 10.4.7 powerbook) to my new macbook pro? Thanks!

  • API to validate a value against a value set

    I have a 'Table' Value Set based on the MTL_CATEGORIES_V view, and need to validate some loaded data against it to check the loaded values are are valid. Rather than use a cursor to perform a lookup of the value in MTL_CATEGORIES_V, is there an API t

  • Jbo null pointer exception whilst creating an AM

    Hello, I am trying to create some EO's,VO's and associated AM. At the end of the creation, I tend to get the following error Load Error Exception: oracle.jbo.dt.objects.JboException(java.lang.NullPointerException). The creation of EO's runs smooth, b

  • Averaging values of multiple signals seperately

    Hi All, I am attempting to create a VI that will average data over a user defined amount of time (via boolean switch). The attached vi collects data once the "collect Data" switch has been triggered, when the test is over the user triggers the "avera