Swing & Database

I want to have a swing application that access database.
can anyone help me ?
if possible, please share me some codes...
thx.

You'll need to include the libraries for ADF also in your jar.
Have a look at the command line JDeveloper uses to run your project (it is in the log window) you can see the classpath that is used there - replicate it for your jar as well.

Similar Messages

  • Java Swing Database Components

    Heloo guys!
    Anyone knows where to download Java Swing Database Components??

    http://www.jars.com/utilities/libraries/resource.php/28653
    http://sourceforge.net/projects/jsdbc/
    create your own rather.

  • Swing database components!!!

    Hi!!!
    Anybody knows how to use swing database components...?
    And where can i download complete JDBC tutorials.....
    Im new to java swing............
    Your help is greatly appreciated.....
    =-samer=-

    I just downloaded Java Swing Database Components and tried the demo application
    "HomeDatabase.jar" which worked well.
    I have experience with jdbc but not with jsdbc
    A JDBC tutorial is here.

  • Can Jdeveloper Be Used For Non-Oracle Databases

    I have been trying to evaluate Jdeveloper 9i and Jbuilder 7 Enterprise for Swing database development. I am particularly interested in the productivity enhancements such as BC4J and Jclient. The underlying database might be Oracle, SapDb (excellent, easy to use, and free), SQLServer, etc.
    I evaluated Jbuilder Enterprise tools and it worked flawlessly with SapDb. This emphasized using their DataExpress and DbSwing components which provide many useful capabilities similar to BC4j and Jclient. It also involved using their DBPilot tool which allows browsing similar to that provided via a Jdeveloper connection.
    I tried to use Jdeveloper for the same SapDB and it is essentially non-functional. I followed the instructions for using a non-default driver and tried to define a connection. It behaved inconsistently: often saying no suitable driver can be found and yet when you edit the connection and test without making any changes, it works. If you try to establish a BC4J definition, it is very inconsistent and fails to recognize important details as foreign keys. Even if you define a ViewLink manually, it still does not work properly if you attempt to define a Master-Detail Jclient form. As I have stated, all these types of capabilities worked flawlessly in their Jbuilder equivalent. Furthermore, I really like the fact that Jbuilder gives many of BC4Js benefits without needing a BC4J J2EE container.
    Has anyone had real success using Jdeveloper's advanced features to develop for non-Oracle databases and if so, how did you get around these types of problems?

    Hi,
    generally, SCAN can be used for 10g databases and you discovered the first half: for 10g databases you will have to modify the REMOTE_LISTENER entry for each 10g database instance to point to the SCAN listeners (as opposed to pointing to the remote local listeners, which is the default in 10g). You could even have the databases registers themselves with SCAN and the remote listeners, if you wanted to... It's more or less a matter of configuration. But for simplification reasons, I will stick to the case where you have your 10g databases register with the SCAN listeners only.
    Now the other half is the client and the client configuration. An 11g Rel. 2 client configured for RAC would have a TNSNAMES entry that has only one address line for the RAC databases. The host entry in this one address line should point to the SCAN (the SCAN name is ideally resolved in DNS). A 10g client configured for RAC would have as many address lines in the TNSNAMES as you have nodes in the cluster.
    The 10g client SCAN configuration would then be in the middle so to speak: You would have 3 address lines in your TNSNAMES, in which each host entry would resolve to one SCAN address (I assume you will use the recommended default of 3 SCAN IPs). If you choose, you can have a name resolution for each of your SCAN IPs, but this would not be required. Now, why would you do it this way? Because this configuration will always work and does not make you dependent on certain functionality that your DNS server may or may not offer.
    For the remaining questions: SCAN is a DNS entry resolving one name to more than one (typically 3) IP addresses. OID is short for Oracle Internet Directory, which is a complete LDAP server. And you are right that there is no document how to configure 10g clients for SCAN from Oracle yet. However, there is a quite good document on SCAN on otn.oracle.com/rac, but I am sure you are aware of it already.
    Hope that helps. Thanks,
    Markus

  • Looking for database-frontend utility libraries

    Hello,
    I am currently writing yet another swing database frontend and I am tired of writing glue-classes for the sql tables, writing functionality that fills the swing widgets with the data and so on.
    I know Hibernate but it would just take away writing glue-classes but actually not the gui part.
    Does anybody know a library which allows RAD of swing database frontends, is easy to learn and is free for non-commercial use?
    Thank you in advance, lg Clemens

    Hi Mary.
    What are you trying to do exactly? Is this for a client or server application? Are you using the ADF framework or not?
    Best Regards,
    Frédéric.

  • I'm a new java learner from china,how should I start my journey?

    I have never learned java before,how should I start it? Dose it hard to learn?
    At the beginning,which part of it should I learn?
    Thank you !

    Advice:
    1. Learn the basics with simple command line applications first. Don't worry about complicated topics like Swing, databases, Web applications, etc. for at six months
    2. After you learn how to write, compile & run programs with just a text editor & Java compiler, download & learn to use an Integrated Development Environment, such as Eclipse. Especially, learn how to use the debugger that comes with the IDE.
    3. Experiment with lots of small programs & examples. Learn by doing (and by making mistakes).
    4 Find others in your community who use Java & learn from them.

  • Advice on Java Learning Curve - What Next?

    Dear Experts
    With big thanks to this forum users i have covered my ground and have become a bit familar with the following
    -> Console Applications
    -> Classes, Inheritance, Abstract Classes, Interfaces
    -> Threads
    -> Packages (to a certain extent)
    -> Swing
    -> Database (JDBC)
    What Next? Should i get into servlets or JSP? I mean which would be a proper sequence? I would appreciate if you will be able suggest a suitable flow+
    Thank you very much
    standman

    Kayaman wrote:
    Most of the remotely useful functionality that Applets could give you can be easier done with Flash these days.A year ago I'd say because of the vendor lockin it isn't worth to think about flash, but today...
    But it seems that I'm the only one bothering... :o(Maybe there's a reason that nobody else bothers.Surely is, but I don't understand it.
    Nearly every web application we created in the last 3 years was about to put fat clinet features like dynamic auto compleetion and updates of the page content without Page refresh (to give just 2 examples) into a web application hiding the networtk communication by ajax.
    Doing that as an applet (or flash-application if you'r Adobe addicted) would have been much easier, more (automatically) testable and more browser indipendent. But nobody (including customers who don't know better and collegues who don't want to cunsult the customers but code) wants to think about that because web applications are considered as the most modern aproach...
    bye
    TPD

  • A database connection in a swing application

    hi ,
    i am developping an intranet stabdalone swing application based on a jdbc connection to oracle8i data server.
    in fact i am interested in keeping my user authentification encrypted while this connection is done! is there any method to do it ! i read about SSL but is it supported by web application ! i have a client-server simple connection !
    please help !

    Hello Levi,
    You can to do this form:
    String appModule = "yourAppmodule";
    String config = "yourAppmodule"+ "Local";
    ApplicationModule am = Configuration.createRootApplicationModule(appModule, config);
    ConnectionMetada cm = am.getTransaction().getConnectionMetadata();
    DriverManager.registerDriver(new OracleDriver());
    Connection connection = DriverManager.getConnection(cm.getJdbcURL());You can to see this threads:
    Retrieve Database Connection
    Getting the Connection object out of ApplicationModule
    Regards,
    Renan

  • How to bind JtextFields in Swing to Table fields in the database

    Can some one give the code of how to bind JtextFields in Swing to Table fields in the database
    Am really new to java programming and have interest in learning

    The standard JDK doesn't do this for you. If you search on Google, you may find some 3rd party packages that will do this.
    You need to create your own form add execute the appropriate SQL yourself. Read the tutorial on [url http://java.sun.com/docs/books/tutorial/]JDBC Database Access to get started.

  • Populating Swing JList using SQL Database

    Sup peeps, im trying to to populate a JList using the entries in a table in a database i created.
    package networks;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.PrintWriter;
    import java.sql.*;
    public class Contestantlist extends javax.swing.JFrame {
        /** Creates new form contestantList */
        public Contestantlist() {
            initComponents();
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">
        private void initComponents() {
             try
               // Load driver's class, inilialize, register with DriverManager
               //Class.forName("oracle.jdbc.driver.OracleDriver");
               Class.forName("org.gjt.mm.mysql.Driver");
            catch (ClassNotFoundException e)
               System.out.println("Unable to load driver class");
               return;
            ResultSet rs = null;
            try
               // Call DriverManager's methods (all are static)
               // To print log on sysout
               //DriverManager.setLogStream(System.out); //JDBC 1.x driver
              // DriverManager.setLogWriter(new PrintWriter(System.out) );
               // Connect to database.  DriverManager loads each registered driver
               // in turn until one can handle the database URL format
               //Connection con = DriverManager.getConnection(
               //                     "jdbc:oracle:thin:@host.domain.com:1521:db_name"
               //                     ,"scott","tiger");
              // Connection con = DriverManager.getConnection("jdbc:mySql://localhost:3306/Contest","root","blink182");
               // Get the DatabaseMetaData object to display database info
            //   DatabaseMetaData dmd = con.getMetaData();
             //  Statement stmt = con.createStatement();
           //     String sql;
             //  sql = "SELECT Username FROM Contestant WHERE Username IS NOT NULL";
              // rs = stmt.executeQuery(sql); //throws SQLExecption if fails
              // printResultSet(rs);
               DriverManager.setLogWriter(new PrintWriter(System.out) );
               Connection con = DriverManager.getConnection("jdbc:mySql://localhost:3306/Contest","root","blink182");
               // Get the DatabaseMetaData object to display database info
               DatabaseMetaData dmd = con.getMetaData();
               String sql;
                 Statement stmt = con.createStatement();
             sql = "SELECT Username FROM Contestant WHERE Username IS NOT NULL";
             rs = stmt.executeQuery(sql); //throws SQLExecption if fails
            ResultSetMetaData rsmd = rs.getMetaData();
            int numCols = rsmd.getColumnCount();*
            // Display data, fetching until end of the result set
            // Calling next moves to first or next row and returns true if success
            while(rs.next() )
               // Each rs after next() contains next rows data
               for(final int i=1; i<=numCols; i++)
                  if(i > 1) System.out.print(",");
                  // Almost all SQL types can be cast to a string by JDBC
                 // System.out.print(rs.getString(i));
                  theList.setModel(new javax.swing.AbstractListModel() {
                      String[] strings = { rs.getString(i) };
                      public int getSize() { return strings.length; }
                      public Object getElementAt(int i) { return rs.getString(i); }
               System.out.println("");
            catch(Exception f)
            titleLabel = new javax.swing.JLabel();
            jScrollPane1 = new javax.swing.JScrollPane();
           // theList.setVisibleRowCount(6);
            theList = new javax.swing.JList();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            titleLabel.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
            titleLabel.setText("The Scrupulous Contestants!");
           /* theList.setModel(new javax.swing.AbstractListModel() {
                String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5", "Item 3", "Item 4", "Item 5", "Item 4", "Item 5"  };
                public int getSize() { return strings.length; }
                public Object getElementAt(int i) { return strings; }
    jScrollPane1.setViewportView(theList);
    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGap(70, 70, 70)
    .addComponent(titleLabel))
    .addGroup(layout.createSequentialGroup()
    .addContainerGap()
    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 215, javax.swing.GroupLayout.PREFERRED_SIZE)))
    .addContainerGap(71, Short.MAX_VALUE))
    layout.setVerticalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addContainerGap()
    .addComponent(titleLabel)
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addContainerGap(124, Short.MAX_VALUE))
    pack();
    }// </editor-fold>
    /* private static void printResultSet(ResultSet rs) throws SQLException
         DriverManager.setLogWriter(new PrintWriter(System.out) );
    Connection con = DriverManager.getConnection("jdbc:mySql://localhost:3306/Contest","root","blink182");
    // Get the DatabaseMetaData object to display database info
    DatabaseMetaData dmd = con.getMetaData();
    String sql;
         Statement stmt = con.createStatement();
    sql = "SELECT Username FROM Contestant WHERE Username IS NOT NULL";
    rs = stmt.executeQuery(sql); //throws SQLExecption if fails
    ResultSetMetaData rsmd = rs.getMetaData();
    int numCols = rsmd.getColumnCount();
    // Display data, fetching until end of the result set
    // Calling next moves to first or next row and returns true if success
    while(rs.next() )
    // Each rs after next() contains next rows data
    for(int i=1; i<=numCols; i++)
    if(i > 1) System.out.print(",");
    // Almost all SQL types can be cast to a string by JDBC
    System.out.print(rs.getString(i));
    System.out.println("");
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new Contestantlist().setVisible(true);
    // Variables declaration - do not modify
    private javax.swing.JList theList;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JLabel titleLabel;
    // End of variables declaration
    I can tell that im not using something correctly. Can you guys just point out how i should proceed through this? I encapsulated the piece of code that has got me confused.
    Edited by: 860597 on May 29, 2011 6:29 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    package networks;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.PrintWriter;
    import java.sql.*;
    public class Contestantlist extends javax.swing.JFrame {
        public Contestantlist() {
            initComponents();
        @SuppressWarnings("unchecked")
        private void initComponents() {
             try
               Class.forName("org.gjt.mm.mysql.Driver");
            catch (ClassNotFoundException e)
               System.out.println("Unable to load driver class");
               return;
            try
                 ResultSet rs = null;
               DriverManager.setLogWriter(new PrintWriter(System.out) );
               Connection con = DriverManager.getConnection("jdbc:mySql://localhost:3306/Contest","root","blink182");
               DatabaseMetaData dmd = con.getMetaData();
               String sql;
                 Statement stmt = con.createStatement();
             sql = "SELECT Username FROM Contestant WHERE Username IS NOT NULL";
             rs = stmt.executeQuery(sql);
             printResultSet(rs);
            ResultSetMetaData rsmd = rs.getMetaData();
            int numCols = rsmd.getColumnCount();
            catch(Exception f)
            titleLabel = new javax.swing.JLabel();
            jScrollPane2 = new javax.swing.JScrollPane();
            jTable1 = new javax.swing.JTable();
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
            titleLabel.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
            titleLabel.setText("The Scrupulous Contestants!");
            jTable1.setModel(new javax.swing.table.DefaultTableModel(
                new Object [][] {
                new String [] {
                    "Title 1", "Title 2", "Title 3", "Title 4"
            jScrollPane2.setViewportView(jTable1);
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(0, 0, 0)
                            .addComponent(titleLabel))
                        .addGroup(layout.createSequentialGroup()
                            .addGap(0, 0, 0)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 454, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addContainerGap(33, Short.MAX_VALUE))
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(titleLabel)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(263, Short.MAX_VALUE))
            pack();
        }// </editor-fold>/ </editor-fold>
        private static void printResultSet(ResultSet rs) throws SQLException
               DriverManager.setLogWriter(new PrintWriter(System.out) );
              Connection con = DriverManager.getConnection("jdbc:mySql://localhost:3306/Contest","root","blink182");
              DatabaseMetaData dmd = con.getMetaData();
              String sql;
                Statement stmt = con.createStatement();
            sql = "SELECT Username FROM Contestant WHERE Username IS NOT NULL";
            rs = stmt.executeQuery(sql); //throws SQLExecption if fails
           ResultSetMetaData rsmd = rs.getMetaData();
           int numCols = rsmd.getColumnCount();
           while(rs.next() )
              for(int i=1; i<=numCols; i++)
                 if(i > 1) System.out.print(",");
                 System.out.print(rs.getString(i));
              System.out.println("");
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new Contestantlist().setVisible(true);
        private javax.swing.JList theList;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JLabel titleLabel;
        private javax.swing.JScrollPane jScrollPane2;
        private javax.swing.JTable jTable1;
    }I have amended the code and now it does print out the specified contents of my table.
    I have added a a JTable, but excuse my ignorance because i have no idea as to how to proceed from here. I can't figure out how call database entries from the array in the JTable.
    Edited by: 860597 on May 29, 2011 7:27 AM

  • How to store all database values in to a single textarea in swing

    I am trying to show my database values in to a single textarea but i cannot able to show to that textarea.. pls someone help..

    I am not shure what you are exactly meaning but you can use the setText(String text) method of JTextArea.
    Several values could be seperated with a "\n" character.
    import javax.swing.*;
    public class ImplodeTrial {
      public static void main(String[] args) {
          String[] databaseValues={"Apple", "Banana", "Orange"};
          String temp=implode(databaseValues, "\n");
          JTextArea t=new JTextArea();
           t.setText(temp);     
          JFrame j=new JFrame();
           j.getContentPane().add(t);
           j.pack();
           j.setVisible(true);
       public static String implode(String[] ary, String delim) {
             String out = "";
             for(int i=0; i<ary.length; i++) {
                 if(i!=0) { out += delim; }
                 out += ary;
         return out;

  • Install swing application on server/desktop with database

    Hi,
    I developped a swing application which I need to install soon. It's the first time I install an application on my own, so any help would be welcome.
    I use maven for build, hibernate for the database access.
    Is there anything I need to take into consideration about the following things (are there good sites for reference?):
    - the build process
    - I use an external database (mysql), the configuration files are part of the program (they are not put somewhere external) --> any advice on good practices?
    - if the database is put on a server, as well as the jar file of the program, will there be any problem when trying to open the program from another computer, having access to the server?
    - if the database is put on a server, and the jar file of the program on a computer having access to the server (for the database), beside the normal hibernate configuration for the database (ip adres, port, ...), are there important things that might cause problems for the communication between the program and the database?
    thanks for any advice

    user8276126 wrote:
    Is there anything I need to take into consideration about the following things (are there good sites for reference?):
    - the build process
    - I use an external database (mysql), the configuration files are part of the program (they are not put somewhere external) --> any advice on good practices?Put the configuration files into the jar with the compiled classes.
    - if the database is put on a server, as well as the jar file of the program, will there be any problem when trying to open the program from another computer, having access to the server?"Will there be any problem" is rather a naive question. There are always problems when trying to communicate between two machines. Have you set up your MySQL server so that your database accepts connections from all other machines, for example? Or does it just accept connections from "localhost" because that's where you were testing?
    - if the database is put on a server, and the jar file of the program on a computer having access to the server (for the database), beside the normal hibernate configuration for the database (ip adres, port, ...), are there important things that might cause problems for the communication between the program and the database?Yes. The names of some of those things are "firewall" and "router".

  • Connecting to two different database instances from a swing application.

    Hi All,
    I am developing a swing application which needs to interact with two different database instances of two different weblogic servers.
    More eloborately,
    I have some data in DB_Instance1 running on[b] Weblogic_Server1 and I need to insert the same data into DB_instance2 running on Weblogic_server2. Is it possible. Could some explain me how to do that..
    Thanks in advance...
    Sreekanth.

    Hi Rick,
    Try logging onto both Server first. You'll have to use either 2 separate ODBC DSN's or 2 separate OLE DB connections. Set them both for Trusted Authentication, you'll have to configure that on the Server also.Then try your query.
    If that doesn't work then you'll have to create a Stored Procedure or View that can link the 2 Server side.
    Thank you
    Don

  • How to display multiple tables from database using netbeans swing gui

    plz reply asap on how to display multiple tables from database using netbeans swing gui into the same project

    Layered Pane with JTables or you can easily to it with a little scripting and HTML.
    plzzzzzzzzzzzzzzzzz, do not use SMS speak when posting.

  • Swing Applet in JSP: problem with fetching data from database

    i am facing a problem while fetching data from database using Swing Applet plugged in a JSP page.
    // necessary import statements
    public class NewJApplet extends javax.swing.JApplet {
    private JLabel jlblNewTitle;
    private Vector vec;
    public static void main(String[] args) {
    JFrame frame = new JFrame();
    NewJApplet inst = new NewJApplet();
    frame.getContentPane().add(inst);
    ((JComponent)frame.getContentPane()).setPreferredSize(inst.getSize());
    frame.pack();
    frame.setVisible(true);
    public NewJApplet() {
    super();
    initGUI();
    private void initGUI() {
    try {
    this.setSize(542, 701);
    this.getContentPane().setLayout(null);
    jlblTitle = new JLabel();
    this.getContentPane().add(jlblTitle);
    jlblTitle.setText("TITLE");
    jlblTitle.setBounds(197, 16, 117, 30);
    jlblTitle.setFont(new java.awt.Font("Dialog",1,20));
    jlblNewTitle = new JLabel();
    this.getContentPane().add(jlblNewTitle);
    Vector vecTemp = getDBDatum(); // data fetched fm DB r stored here.
    jlblNewTitle.setText(vecTemp.get(1).toString());
    jlblNewTitle.setBounds(350, 16, 117, 30);
    jlblNewTitle.setFont(new java.awt.Font("Dialog",1,20));
    } catch (Exception e) {
    e.printStackTrace();
    }//end of initGUI()
    private Vector getDBDatum() {
    // fetches datum from oracle database and stores it in a vector
    return lvecData;
    }//end of getDBDatum()
    }//end of class
    in index.jsp page i have included the following code for calling this applet:
    <jsp:plugin type="applet" code="NewJApplet.class" codebase="applets"
    width="600" height="300">
    <jsp:fallback>Could not load applet...</jsp:fallback>
    </jsp:plugin>
    if i view it in using AppletViewer it runs perfectly and display the data in JLabel. (ie, both jlblTitle and jlblNewTitle).(ie, DATA FETCHES FROM db AND DISPLAYS PROPERLY)
    BUT IF I CLICK ON INDEX.JSP, ONLY jlblTitle APPEARS. jlblnNewTitle WILL BE BLANK(this label name is supposed to fetch from database)
    EVERY THING IS DISPAYING PROPERLY EXCEPT DATA FROM DATABASE!!!
    i signed the applet as follows :
    grant {
    permission java.security.AllPermission;
    Can any body help me to figure out the problem?

    This is the Swing Applet java code
    import java.awt.Dimension;
    import java.sql.Connection;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.sql.Statement;
    import java.util.Vector;
    import javax.swing.tree.DefaultMutableTreeNode;
    import javax.swing.JScrollPane;
    import javax.swing.JApplet;
    import javax.swing.JButton;
    import javax.swing.JComponent;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JTree;
    import javax.swing.ScrollPaneConstants;
    import javax.swing.SwingConstants;
    public class HaiApplet extends javax.swing.JApplet {
         private JLabel     jlblTitle;
         private JLabel     jlblNewTitle;
         private Vector     vec;
         * main method to display this
         * JApplet inside a new JFrame.
         public static void main(String[] args) {
              JFrame frame = new JFrame();
              NewJApplet inst = new NewJApplet();
              frame.getContentPane().add(inst);
              ((JComponent)frame.getContentPane()).setPreferredSize(inst.getSize());
              frame.pack();
              frame.setVisible(true);
         public HaiApplet() {
              super();
              initGUI();
         private void initGUI() {
              try {               
                   this.setSize(542, 701);
                   this.getContentPane().setLayout(null);
                        jlblTitle = new JLabel();
                        this.getContentPane().add(jlblTitle);
                        jlblTitle.setText("OMMS");
                        jlblTitle.setBounds(197, 16, 117, 30);
                        jlblTitle.setFont(new java.awt.Font("Dialog",1,20));
                        jlblTitle.setHorizontalAlignment(SwingConstants.CENTER);
                        jlblTitle.setForeground(new java.awt.Color(0,128,192));
                        jlblNewTitle = new JLabel();
                        this.getContentPane().add(jlblNewTitle);
                        Vector vecTemp = getDBDatum();
                        jlblNewTitle.setText(vecTemp.get(1).toString());
                        jlblNewTitle.setBounds(350, 16, 117, 30);
                        jlblNewTitle.setFont(new java.awt.Font("Dialog",1,20));     
              } catch (Exception e) {
                   e.printStackTrace();
         }//end of initGUI()
         private Vector getDBDatum() {
              Vector lvecData = new Vector(10,5);
              Connection lcon = null;
              Statement lstmt = null;
              ResultSet lrsResults = null;
              String lstrSQL = null;
              String lstrOut = null;
              try {
                   OmmsDBConnect db = new OmmsDBConnect();
                   lcon = db.connectDb();
                   lstmt = lcon.createStatement(lrsResults.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
                   lstrSQL = "select DT_ID from P_DATATABLES";
                   lrsResults = lstmt.executeQuery(lstrSQL);        
                   int i = 0;
                   lrsResults.last();
                   int length = lrsResults.getRow();
                   System.out.println(length);
                   lrsResults.beforeFirst();
                   int recCount = 0;
                   while (lrsResults.next()) {
                        recCount++;
                        lvecData.addElement(new String(lrsResults.getString("DT_ID")));
                   //     System.out.println("ID :  " + lrsResults.getString(1));
                        i++;
                   }System.out.println("here 3 out fm while");
              catch(SQLException e) {
                   System.out.print("SQLException: ");
                   System.out.println(e.getMessage());
              catch(Exception ex) {
                   lstrOut = "Exception Occured " + ex.getMessage();
              finally {
                   try {
                        lrsResults.close();
                        lstmt.close();
                        lcon.close();
                        System.out.println("[DONE]");
                   catch(Exception e) {
                        System.out.println(e);
             }//end of finally
              return lvecData;
         }//end of getDBDatum()
    }//end of classOfcourse the above code compiles and runs well. in Applet Viewer
    I plugged the above Swing Applet in a JSP page index.jsp
    <jsp:plugin type="applet" code="NewJApplet.class" codebase="applets"
                   width="600" height="300">
         <jsp:fallback>Could not load applet...</jsp:fallback>
    </jsp:plugin>Every thing is working fine in AppletViewer...But if i view this in any browser, then only the jlblTitle is displaying. jlblNewTitle is not displaying(this label name is actually fetching from thedatabase)
    can any body help me regarding this matter.? Thx in Advance.

Maybe you are looking for

  • Is it possible to recover lost data from an iPhone 4 iOS 5

    Hello, I recently upgraded my iphone from iOS 4.2 to 5.0, and in the process of restoring my iphone, my photos and some other settings (some email accounts and phone number "favorites") were not restored.  I'm very upset about the pictures....I've lo

  • Time Machine to AFP volume is extremely slow after 10.5.2 update

    I remember the time, after I have just installed the very first version of Leopard, when Time Machine was working with close to physical speed of my wireless network. Incremental backups would take less than a minute. Comes 10.5.1. Time Machine becam

  • Commons fileupload suddenly very slow

    I've been using the commons fileupload for a couple of years with no problem. Suddenly though it's started to work impossibly slowly. I updated to the most recent version, but still no luck. FileItemFactory factory = new DiskFileItemFactory(); Servle

  • PCK Scenario

    Hi, Iam doing a scenario PCK->XI. Iam following the blog https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/2269. [original link is broken] [original link is broken] [original link is broken] [original link is broken] [original link is broken] [or

  • Multiple listeners using both protocols

    All. I have two listeners configured on a database server (10.2.0 on Linux). I need to be able to call external procedures (via extproc) from instances configured under each of these listeners.. Here are the listener entries.. DEFAULT: LISTENER = (DE