Please help in storing JTable in database

hai Abrami,
I saw in JDK\bin\demo\jfc\Tableexample. but it contans example only for populating the Table with the values from database which I finished alraedy. But I treid of storing the Table values in database using VArray. but it contradicts with the several operations such as retireving Single field from database Updating the database when value single populated table changes.
So please help me in this.This isthe final part of project.

Bathina,
Did you try doing an Internet search? I did one for the terms "jtable" and "database". Here are my results:
http://tinyurl.com/4ttl4
And if you just want someone to do your work for you, then try HotDispatch or Rent-A-Coder (or similar -- there are lots of others like these two).
Good Luck,
Avi.

Similar Messages

  • Please help - Stuck with JTable???

    Hi everyone, i have had this problem now for ages and really wanna solve it - hope u can help!
    I have a Jtable and basically column 3 has a value in it, column 4 is editable and takes in a value that the user enters. I need to take the value from column 3 and multiply it by the number entered into column 4 to update column 5 with the result.
    I have looked over and over the API for this and saw working examples, however i am using my own table model class and finding it hard to adapt these examples to work with my code, below is my table model class and the method i have written to try undertake this piece of functionality, can anyone help me get this working - dukes!!
    class ResultSetTableModel extends AbstractTableModel {
    protected Vector columnHeaders;
    protected Vector tableData;
    protected Vector rowData;
    private Connection con;    
    private int column_count;
    int QTY_COLUMN = 4;
    private double value;
    private JTable table;
    public void fillTableModel (ResultSet result) throws SQLException {
         ResultSetMetaData rsmd = result.getMetaData();
         int count = rsmd.getColumnCount();
         columnHeaders = new Vector();
         tableData = new Vector ();
         for (int i = 1; i <= count; i++)
              columnHeaders.addElement(rsmd.getColumnName (i));
              //System.out.println(rsmd.getColumnName(i));
         columnHeaders.addElement("Qty");
         columnHeaders.addElement("Total");
         while (result.next())
              rowData = new Vector (count);
              int row = 0;
              for (int i = 1; i <= count ; i++)
                   rowData.addElement (result.getObject(i));          
              rowData.addElement("4");
              rowData.addElement("0.00");
              tableData.addElement (rowData);
         result.close();
         fireTableDataChanged();
    public int getColumnCount ()
         return columnHeaders.size();     
    public int getRowCount ()
         return tableData.size();          
    /*public Object getValueAt (int row, int column)
         Vector rowData = (Vector) (tableData.elementAt (row));   
         return rowData.elementAt (column);
    public Object getValueAt(int row, int col){  //This is the method i have written
         int sum = 0; 
         if(col == 5) {   
         try {     
              sum = Integer.parseInt((String)getValueAt(row, 3)) * Integer.parseInt((String)getValueAt(row,4));//Need to take a user input here instead of a value - i think!   
         catch (Exception e)    { //Sum above not working as column 5 displays the number 4 in each row     
              sum = 4;   
         return (new Double(sum)); 
         else  {   
              Vector rowData = (Vector) (tableData.elementAt (row));   
              return rowData.elementAt (col); 
    public boolean isCellEditable (int row, int column )
         return (column == QTY_COLUMN);
    public String getColumnName (int column)
         return (String) (columnHeaders.elementAt (column));
    public void emptyColumn(int column){   
         int rowCount = tableData.size();       
         for (int i = 0; i < rowCount; i++)    {       
              Vector rowData = (Vector)tableData.elementAt(i);               
              rowData.setElementAt("", column);   
         fireTableDataChanged();
    public void setValueAt(Object value, int row, int column) {
             ((Vector)tableData.elementAt(row)).setElementAt(value, column);
             fireTableCellUpdated(row, 5);
    }Can anyone please help and yes im desperate, he he
    Thanks in advance

    Here's something:import java.awt.*;
    import java.util.*;
    import javax.swing.*;
    import javax.swing.table.*;
    public class Test extends JFrame {
        public Test () {
            getContentPane ().setLayout (new BorderLayout ());
            getContentPane ().add (new JTable (new TestModel ()));
            setDefaultCloseOperation (EXIT_ON_CLOSE);
            setTitle ("Test");
            pack ();
            setLocationRelativeTo (null);
            show ();
        public static void main (String[] parameters) {
            new Test ();
        private class TestModel extends AbstractTableModel {
            private java.util.List data;
            public TestModel () {
                data = new ArrayList ();
                data.add (new Pair (3, 4));
                data.add (new Pair (1, 7));
                data.add (new Pair (2, 9));
                data.add (new Pair (6, 5));
                data.add (new Pair (8, 0));
            public int getRowCount () {
                return data.size ();
            public int getColumnCount () {
                return 3;
            public Object getValueAt (int r, int c) {
                Pair pair = (Pair) data.get (r);
                int value;
                switch (c) {
                    case 0:
                        value = pair.a;
                        break;
                    case 1:
                        value = pair.b;
                        break;
                    default:
                        value = pair.a * pair.b;
                        break;
                return new Integer (value);
            public Class getColumnClass (int c) {
                return Integer.class;
            public boolean isCellEditable (int r, int c) {
                return c < 2;
            public void setValueAt (Object wrappedValue, int r, int c) {
                Pair pair = (Pair) data.get (r);
                int value = ((Integer) wrappedValue).intValue ();
                switch (c) {
                    case 0:
                        pair.a = value;
                        break;
                    case 1:
                        pair.b = value;
                        break;
                fireTableRowsUpdated (r, r);
            private class Pair {
                public int a;
                public int b;
                public Pair (int a, int b) {
                    this.a = a;
                    this.b = b;
    }Kind regards,
      Levi

  • Please help in Stored procedure? Psoting third time Urgent!!!

    Hi,
    We are running websphere3.5.3 on AS/400 machine with DB2Connect as local database.
    I am using com.ibm.db2.jdbc.app.DB2Driver
    We are trying to execute a servlet with stroedprocedure in it.
    In the bottom, I included complete error. Can some one help me? I tried so many things but nothing is working. Infact I could execute other storedprocedure which have hard code input values and outputvalues.
    Same stored procedure is working fine in coldfusion
    Following is creation, code, complete error of storedprocedure.
    I greatly appreciate your help.
    Thanks
    How we created stored procedure is
    create procedure fmgdata.test1
    in puserid char(10), in psuppno dec(7,0),in pitemno dec(5,0),out pmean dec(15,5),out pmedian dec(7,2), out
    pmode dec(7,2), out psamplefx dec(5,0), out pfmgdeal dec(7,2), out pfmgfist dec(7,2),out wrkdatmdy1 char(8),
    out wrkdatmdy2 char(8)
    language rpgle
    NOT DETERMINISTIC
    EXTERNAL NAME fmgdata.rdg002cf
    My code:
    public class storedProcServlet extends HttpServlet
    * Handle the GET Method
    public void doGet (HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
    PrintWriter output;
    String title = "Test Servlet2";
    // set the content type
    resp.setContentType("text/html");
    // write the output
    output = resp.getWriter();
    HttpSession session = req.getSession(true);
    output.println("<HTML><HEAD><TITLE>");
    output.println(title);
    output.println("</TITLE></HEAD><BODY>");
    // load the Db2driver bridge by referencing it
    try
    Class.forName("com.ibm.db2.jdbc.app.DB2Driver");
    catch (Exception e)
    output.println("<P>Failed to load DB2driver.");
    return;
    output.println("<P>Loaded DB2driver.");
    String url = "jdbc:db2://s105k4tm//FMGDATA//SYSDATA//FMGLIB//SYSLIB//*USRLBL//QSYS//aaa";
    // get a connection
    try
    CallableStatement cstmt = null;
    ResultSet resultset = null;
    Connection con = DriverManager.getConnection(
    url, "QSECOFR", "wasadmin"); // User Name: sa, Password: "
    cstmt = con.prepareCall ("{call FMGDATA.test1(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}");
    if(cstmt == null)
    output.println("problem while callable statement");
    else
    output.println("create callable statement is Ok");
    output.println("Before 1");
    cstmt.setString(1,"MILAR");
    output.println("Before 2");
    cstmt.setDouble(2,21000);
    output.println("Before 3");
    cstmt.setDouble(3,65886);
    output.println("Before 4");
    cstmt.registerOutParameter(4, java.sql.Types.DOUBLE);
    output.println("Before 5");
    cstmt.registerOutParameter(5, java.sql.Types.DOUBLE);
    output.println("Before 6");
    cstmt.registerOutParameter(6, java.sql.Types.DOUBLE);
    output.println("Before 7");
    cstmt.registerOutParameter(7, java.sql.Types.DOUBLE);
    output.println("Before 8");
    cstmt.registerOutParameter(8, java.sql.Types.DOUBLE);
    output.println("Before 9");
    cstmt.registerOutParameter(9, java.sql.Types.DOUBLE);
    output.println("Before 10");
    cstmt.registerOutParameter(10, java.sql.Types.CHAR);
    output.println("Before 11");
    cstmt.registerOutParameter(11, java.sql.Types.CHAR);
    output.println("After 11");
    output.println("Before execute");
    cstmt.execute();
    output.println("After execute");
    catch (Exception e)
    e.printStackTrace(output);
    output.println("<P>This is output from a Stored Procedure Servlet.");
    output.println("</BODY></HTML>");
    output.close();
    //Handle the POST method. To handle POST, we will simple pass the request to the GET method
    public void doPost (HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
    doGet(req,resp);
    error
    Loaded DB2driver.
    create callable statement is Ok
    Before 1 Before 2 Before 3 Before 4 Before 5 Before 6 Before 7 Before 8 Before 9 Before 10 Before 11 After 11 Before execute
    com.ibm.db2.jdbc.app.DB2SQLException2: Trigger program or external routine detected an error. java/lang/Throwable.(Ljava/lang/String;)V+4 (Throwable.java:94) java/sql/SQLException.(Ljava/lang/String;Ljava/lang/String;I)V+1 (SQLException.java:43) com/ibm/db2/jdbc/app/DB2SQLException2.(Ljava/lang/String;Ljava/lang/String;I)V+1 (DB2SQLException2.java:300) com/ibm/db2/jdbc/app/DB2PreparedStatementRuntimeImpl.execute(II)I+40 (DB2PreparedStatementRuntimeImpl.java:387) com/ibm/db2/jdbc/app/DB2PreparedStatement.execute()Z+28 (DB2PreparedStatement.java:1381) storedProcServlet.doGet(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+0 (storedProcServlet.java:19) javax/servlet/http/HttpServlet.service(Ljavax/servlet/http/HttpServletRequest;Ljavax/servlet/http/HttpServletResponse;)V+32 (HttpServlet.java:740) javax/servlet/http/HttpServlet.service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+25 (HttpServlet.java:853) com/ibm/servlet/engine/webapp/StrictServletInstance.doService(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+21 (ServletManager.java:626) com/ibm/servlet/engine/webapp/StrictLifecycleServlet._service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+46 (StrictLifecycleServlet.java:160) com/ibm/servlet/engine/webapp/ServletInstance.service(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Lcom/ibm/servlet/engine/webapp/WebAppServletInvocationEvent;)V+186 (ServletManager.java:360) com/ibm/servlet/engine/webapp/WebAppRequestDispatcher.handleWebAppDispatch(Lcom/ibm/servlet/engine/webapp/WebAppRequest;Ljavax/servlet/http/HttpServletResponse;Z)V+771 (WebAppRequestDispatcher.java:404) com/ibm/servlet/engine/webapp/WebAppRequestDispatcher.dispatch(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;Z)V+443 (WebAppRequestDispatcher.java:203) com/ibm/servlet/engine/webapp/WebAppRequestDispatcher.forward(Ljavax/servlet/ServletRequest;Ljavax/servlet/ServletResponse;)V+105 (WebAppRequestDispatcher.java:107) com/ibm/servlet/engine/srt/WebAppInvoker.handleInvocationHook(Ljava/lang/Object;)V+127 (WebAppInvoker.java:77) com/ibm/servlet/engine/invocation/CachedInvocation.handleInvocation(Ljava/lang/Object;)V+25 (CachedInvocation.java:67) com/ibm/servlet/engine/srp/ServletRequestProcessor.dispatchByURI(Ljava/lang/String;Lcom/ibm/servlet/engine/srp/ISRPConnection;)V+839 (ServletRequestProcessor.java:155) com/ibm/servlet/engine/oselistener/OSEListenerDispatcher.service(Lcom/ibm/servlet/engine/oselistener/api/IOSEConnection;)V+95 (OSEListener.java:300) com/ibm/servlet/engine/oselistener/SQEventListenerImp$ServiceRunnable.run()V+155 (SQEventListenerImp.java:230) com/ibm/servlet/engine/oselistener/SQEventListenerImp.notifySQEvent(Lcom/ibm/servlet/engine/oselistener/api/ISQEvent;)V+184 (SQEventListenerImp.java:104) com/ibm/servlet/engine/oselistener/serverqueue/SQEventSource.notifyEvent(Lcom/ibm/servlet/engine/oselistener/api/SQEventImp;)V+40 (SQEventSource.java:212) com/ibm/servlet/engine/oselistener/serverqueue/SQWrapperEventSource$SelectRunnable.notifyService()V+116 (SQWrapperEventSource.java:353) com/ibm/servlet/engine/oselistener/serverqueue/SQWrapperEventSource$SelectRunnable.run()V+124 (SQWrapperEventSource.java:220) com/ibm/servlet/engine/oselistener/outofproc/OutOfProcThread$CtlRunnable.run()V+104 (OutOfProcThread.java:248) java/lang/Thread.run()V+11 (Thread.java:479)
    This is output from a Stored Procedure Servlet.

    Thanks again Jschell,
    I will try to find out exactly what that stored proc is doing. They are saying this stored proc simply gets the values from database using inputs. No insert, delete or update.
    I am too thinking that sending inputs is giving problems.
    If you have any idea how can i format the inputs please let me know. Do you think any problem with driver??
    I did know the same is working in cold fusion fine. Basically it takes three values as inputs and gives 8 out put vaues. In cold fusion they formatted input such that
    AS/400 can under stand.
    In Cold Fusion they formatted as follows,
    <cfset supplier = Numberformat(supplier,'0000000')>
    <cfset item = Numberformat(item,'00000')>
    Even I am trying to do the same thing. It didn't work.
    I did execute some other simple sps where i give hard coded string as input retrieve int, double, strings as outputs.
    This is how they execute the same in cold fusion
    <cfstoredproc procedure="test1" datasource="#datasource#">          
    <cfprocparam type="In" cfsqltype="CF_SQL_CHAR" variable="puserid" value="#session.fsuser#">
    <cfprocparam type="In" cfsqltype="CF_SQL_INTEGER" variable="psuppno" value="#supplier#">
    <cfprocparam type="In" cfsqltype="CF_SQL_INTEGER" variable="pitemno" value="#item#">
    <cfprocparam type="Out" cfsqltype="CF_SQL_FLOAT" variable="pMean">
         <cfprocparam type="Out" cfsqltype="CF_SQL_FLOAT" variable="pMedian">
              <cfprocparam type="Out" cfsqltype="CF_SQL_FLOAT" variable="pMode">
              <cfprocparam type="Out" cfsqltype="CF_SQL_INTEGER" variable="psamplefx">
              <cfprocparam type="Out" cfsqltype="CF_SQL_FLOAT" variable="pfmgdeal">
              <cfprocparam type="Out" cfsqltype="CF_SQL_FLOAT" variable="pfmgfist">
              <cfprocparam type="Out" cfsqltype="CF_SQL_CHAR" variable="wrkdatmdy1">
              <cfprocparam type="Out" cfsqltype="CF_SQL_CHAR" variable="wrkdatmdy2">          
         </cfstoredproc>
    Thanks for any help,

  • Please help me..JTable trouble

    Hi all java guru,
    i've have a JTable in which i want to insert some styled text (e.g. bold,underline,italic).... i use a JEditorPane as CellEditor and JEditorPane as renderer. In each JEditorPane i have registered a StyledEditorKit that is used for styles.
    I've noted that when i insert styled text, initially cell maintains text style, but when i click on other cell,style of text disappears....i want to specify that i don't want to add style to entire cell, but i wish to add style at a portion of text.....
    notbold bold | not styled text
    Cell0 ----------------------- Cell1
    Is this behavior normally ???
    Then i've implemented a CustomTableModel that maintains information about text style, in such way that when renderer cell, i can rebuild exact text with its style....same method is adopted for CellEditor.
    It is possible to have more than one JTable in my application....then to correctly handle all JTables ' put the in a vector and during editing and rendering i find current focusable JTable and edit/render it.
    It seems a right solution ???
    I insert style on text using a toolbar and menubar in a dynamically way.
    Please, give to me an advice...Is right this solution??Or exist another way to resolve this proble in a more elegant way??
    Tnx in advance
    regards,
    anti-shock

    That's correct.
    Try to set HTMLEditorKit for your editor/renderer JTextPane. In the TableModel you can save text from textPane.getText() and set the text in the renderer component in the appropriate renderer's method.
    regards,
    Stas

  • Please Help me in JTable Updating   - URGENT

    Hai all
    am corrently working on a project which am using swing of 1.4
    here in one screen when user enteres data in JTable and clicks submit button i must read the whole Table model of the table and i will insert it to DB.
    in this am gettting problem.
    that is
    when user enters data into jtable and user directly clicks submit i can take all the data iin the table but only on tablce colum value i cant take which is the user currencly entering or modifying the filed.
    if after entering data i need to click any other cell or i need to just click tab to come out of the cell then only i cant take the data from that cell when inserting .
    pls anybody help me how to come out of this problem.
    thanking you
    Rajesh

    Hi
    before you save the changes you have to call stopCellEditing method.

  • Please help me get started with Databases...

    I've spent all day moving from one tutorial to the other trying to figure out how to use a Database with Java. I haven't found anything that explained things basic enough for me to understand, however, I did download and install MDAC 2.8 which was suggested in on one of the sites and I also have MS Access to work with for creating the database. Can somebody please explain what I need to do in order to access a database from my program in simple, easy to follow, steps?
    Also I have a small question about .requestFocus();In my program I have a Radio button called Format1 and a text area called textArea. I set Format1 to be selected using the following code: Format1.setSelected(true); and I attempted to make the cursor start inside the text area with: textArea.requestFocus(); Currently, when I start the program, Format1 has the focus instead of textArea. How can I make the cursor start at the end of the text inside of textArea everytime I start my program?

    Try this:
    package be;
    import java.sql.*;
    import java.util.*;
    public class DataConnection
        public static final String DEFAULT_DRIVER   = "sun.jdbc.odbc.JdbcOdbcDriver";
        public static final String DEFAULT_URL      = "jdbc:odbc:DRIVER={Microsoft Access Driver (*.mdb)};DBQ=e:\\Project\\Database.mdb";
        public static final String DEFAULT_USERNAME = "admin";
        public static final String DEFAULT_PASSWORD = "";
        /** Database connection */
        private Connection connection;
         * Driver for the DataConnection
         * @param command line arguments
         * <ol start='0'>
         * <li>SQL query string</li>
         * <li>JDBC driver class</li>
         * <li>database URL</li>
         * <li>username</li>
         * <li>password</li>
         * </ol>
        public static void main(String [] args)
            DataConnection db = null;
            try
                if (args.length > 0)
                    String sql      = args[0];
                    String driver   = ((args.length > 1) ? args[1] : DEFAULT_DRIVER);
                    String url      = ((args.length > 2) ? args[2] : DEFAULT_URL);
                    String username = ((args.length > 3) ? args[3] : DEFAULT_USERNAME);
                    String password = ((args.length > 4) ? args[4] : DEFAULT_PASSWORD);
                    db = new DataConnection(driver, url, username, password);
                    List result = db.query(sql);
                    System.out.println(result);
                else
                    System.out.println("Usage: db.DataConnection <sql> <driver> <url> <username> <password>");
            catch (SQLException e)
                System.err.println("SQL error: " + e.getErrorCode());
                System.err.println("SQL state: " + e.getSQLState());
                e.printStackTrace(System.err);
            catch (Exception e)
                e.printStackTrace(System.err);
            finally
                if (db != null)
                    db.close();
                db = null;
         * Create a DataConnection
         * @throws SQLException if the database connection fails
         * @throws ClassNotFoundException if the driver class can't be loaded
        public DataConnection() throws SQLException,ClassNotFoundException
            this(DEFAULT_DRIVER, DEFAULT_URL, DEFAULT_USERNAME, DEFAULT_PASSWORD);
         * Create a DataConnection
         * @throws SQLException if the database connection fails
         * @throws ClassNotFoundException if the driver class can't be loaded
        public DataConnection(final String driver,
                              final String url,
                              final String username,
                              final String password)
            throws SQLException,ClassNotFoundException
            Class.forName(driver);
            this.connection = DriverManager.getConnection(url, username, password);
         * Clean up the connection
        public void close()
            try
                this.connection.close();
            catch (Exception e)
                ; // do nothing; you've done your best
         * Execute an SQL query
         * @param SQL query to execute
         * @returns list of row values
         * @throws SQLException if the query fails
        public List query(final String sql) throws SQLException
            Statement statement     = this.connection.createStatement();
            ResultSet rs            = statement.executeQuery(sql);
            ResultSetMetaData meta  = rs.getMetaData();
            int numColumns          = meta.getColumnCount();
            List rows               = new ArrayList();
            while (rs.next())
                Map thisRow = new LinkedHashMap();
                for (int i = 1; i <= numColumns; ++i)
                    String columnName   = meta.getColumnName(i);
                    Object value        = rs.getObject(columnName);
                    thisRow.put(columnName, value);
                rows.add(thisRow);
            rs.close();
            statement.close();
            return rows;
    }Solve one problem at a time. Get the database going, then worry about how you'll present it to the users. - MOD

  • Please help, cannot connect to Access database with a jar file

    Hi, i created a jar file from my java project, using eclipse.
    When i try open the jar through command prompt, the following error is given:
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Could not find
    file '(unknown)'.
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at Methods.con(Methods.java:15)
    at LoginScreen.getCmboLogins(LoginScreen.java:80)
    at LoginScreen.getJContentPane(LoginScreen.java:65)
    at LoginScreen.initialize(LoginScreen.java:46)
    at LoginScreen.<init>(LoginScreen.java:31)
    at DataUse.main(DataUse.java:25)
    No Connection to dataBASE
    The program runs fine within eclipse and the database is bundled in the jar.

    rohangr wrote:
    The program runs fine within eclipse Because the database isn't in the jar.
    ...and the database is bundled in the jar.That isn't going to work.
    The MS ODBC driver (which has absolutely nothing to do with java) expects to find the MS Access file in the windows file system.
    And the contents of the jar file does not fit into that requirement.

  • Please help me on this "creating database manually"

    1) copied all datafiles and init.ora file from source and placed in target folder 2)edit the init.ora file, change the db_name and location of the controlfile
    3)
    C:\>set oracle_sid=jeeno1
    C:\>sqlplus /nolog
    SQL*Plus: Release 10.1.0.2.0 - Production on Tue Apr
    11 06:44:28 2006
    Copyright (c) 1982, 2004, Oracle. All rights reserved.
    SQL> connect / as sysdba;
    Connected to an idle instance.
    SQL> startup nomount
    pfile='C:\oracle\product\10.1.0\admin\jeeno\pfile\jeenoinit.ora'
    ORACLE instance started.
    Total System Global Area 171966464 bytes
    Fixed Size 787988 bytes
    Variable Size 145750508 bytes
    Database Buffers 25165824 bytes
    Redo Buffers 262144 bytes
    SQL> CREATE CONTROLFILE set DATABASE "jeeno1"
    RESETLOGS NOARCHIVELOG
    2 MAXLOGFILES 16
    3 MAXLOGMEMBERS 3
    4 MAXDATAFILES 100
    5 MAXINSTANCES 8
    6 MAXLOGHISTORY 454
    7 LOGFILE
    8 GROUP 1
    'C:\ORACLE\PRODUCT\10.1.0\ORADATA\jeeno\REDO01.LOG'
    SIZE 10M,
    9 GROUP 2
    'C:\ORACLE\PRODUCT\10.1.0\ORADATA\jeeno\REDO02.LOG'
    SIZE 10M,
    10 GROUP 3
    'C:\ORACLE\PRODUCT\10.1.0\ORADATA\jeeno\REDO03.LOG'
    SIZE 10M
    11 -- STANDBY LOGFILE
    12 DATAFILE
    13
    'C:\ORACLE\PRODUCT\10.1.0\ORADATA\jeeno\SYSTEM01.DBF',
    14
    'C:\ORACLE\PRODUCT\10.1.0\ORADATA\jeeno\UNDOTBS01.DBF',
    15
    'C:\ORACLE\PRODUCT\10.1.0\ORADATA\jeeno\SYSAUX01.DBF',
    16
    'C:\ORACLE\PRODUCT\10.1.0\ORADATA\jeeno\USERS01.DBF'
    17 CHARACTER SET WE8MSWIN1252
    18 ;
    Control file created.
    SQL> alter database open resetlogs;
    alter database open resetlogs
    ERROR at line 1:
    ORA-01194: file 1 needs more recovery to be consistent
    ORA-01110: data file 1: 'C:\ORACLE\PRODUCT\10.1.0\ORADATA\JEENO\SYSTEM01.DBF'

    Hi,
    From the error message it seems that there is not enough info for recovery. Probably your redo log was overwritten with new information, but currently you need info that was overwritten. If you have not used ARCHIVELOG mode, than overwritten redo info is lost.
    Regards,
    Andrejus

  • Please help me with JTable

    I am working with a 2 column JTable and I have to map value together from left to right on a one to many relationship. So the user should never enter data on the first column of the JTable more than one time. How would I go about making sure no one is able to enter the same value twice on the first column?

    A TableModelListener fires an event "after" the model has already been updated.
    A better approach would probably be to write a custom editor to prevent the model from being updated in the first place. Search the forum for my "Table Edit" (without the space) example that shows a simple example of writing a custom editor. You would need to have access to the TableModel and would then need to loop through every row of the column to make sure the value entered does not already exist.

  • Please help, probleme de connection to database oracle and  java

    Ihave a problem to make connection to database Oracle when I use a simple code of java
    ======================
    import java.sql.*;
    public class Exemple1 {
    public static void main (String args[]) {
    Statement stmt = null;
    Connection con=null;
    try {
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    con = DriverManager.getConnection ("jdbc:oracle:thin:@localhost:1521:GB","scott","tiger");
    catch (Exception e) { System.out.println(e);        }
    =================
    I have :
    * Linux (Fedora core3).
    * Oracle 10g
    My var. environ.:
    * ORACLE_HOME=/u01/app/oracle/product/10.1.0/Db_1
    * PATH=$ORACLE_HOME/bin
    * CLASSPATH=$ORACLE_HOME/jdbc/lib/ojdbc14.jar
    the error is:
    Exception in thread "main" java.lang.NoClassDefFoundError: while resolving class: oracle.sql.CharacterSet
    at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib/libgcj.so.5.0.0)
    at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.5.0.0)
    at JvResolvePoolEntry(java.lang.Class, int) (/usr/lib/libgcj.so.5.0.0)
    at oracle.jdbc.driver.DBConversion.DBConversion(short, short, short) (Unknown Source)
    at oracle.jdbc.driver.T4CConnection.connect(java.lang.String, java.util.Properties) (Unknown Source)
    at oracle.jdbc.driver.T4CConnection.logon() (Unknown Source)
    I don't know what's heppen exactly?

    If
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    is replaced
    with
    Class.forName("oracle.jdbc.driver.OracleDriver");does the java.lang.NoClassDefFoundError: while resolving class: oracle.sql.CharacterSet get generated?

  • FAL_SERVER and FAL_CLIENT - Please help me

    Sir,
    What is the difference between FAL_SERVER and FAL_CLIENT?
    How we can configure this on Primary and Satndby databases? What
    will be the changes happen to this parameters at the time of
    Switchover and Failover?
    Please help me.
    regards
    Mathew

    Note: Primary Database Name = Chicago.
    Standby Database Name = Boston
    Example 3-2 Primary Database: Standby Role Initialization Parameters
    FAL_SERVER=boston
    FAL_CLIENT=chicago
    DB_FILE_NAME_CONVERT=
    '/arch1/boston/','/arch1/chicago/','/arch2/boston/','/arch2/chicago/'
    LOG_FILE_NAME_CONVERT=
    '/arch1/boston/','/arch1/chicago/','/arch2/boston/','/arch2/chicago/'
    STANDBY_FILE_MANAGEMENT=AUTO
    FAL_SERVER
    Specify the Oracle Net service name of the FAL server (typically this is the database running in the primary role). When the Chicago database is running in the standby role, it uses the Boston database as the FAL server from which to fetch (request) missing archived redo log files if Boston is unable to automatically send the missing log files. See Section 5.8.
    FAL_CLIENT
    Specify the Oracle Net service name of the Chicago database. The FAL server (Boston) copies missing archived redo log files to the Chicago standby database. See Section 5.8.
    Example 3-3 Modifying Initialization Parameters for a Physical Standby Database
    INSTANCE_NAME=boston
    FAL_SERVER=chicago
    FAL_CLIENT=boston
    FAL_CLIENTSpecify the Oracle Net service name of the FAL server (typically this is the database running in the primary role). When the Boston database is running in the standby role, it uses the Chicago database as the FAL server from which to fetch (request) missing archived redo log files if Chicago is unable to automatically send the missing log files. See Section 5.8.
    FAL_CLIENT
    Specify the Oracle Net service name of the Boston database. The FAL server (Chicago) copies missing archived redo log files to the Boston standby database. See Section 5.8.
    >>>>http://download-uk.oracle.com/docs/cd/B14117_01/server.101/b10823/create_ps.htm#68627
    Message was edited by:
    user526020

  • Jtable Update problem .. Please help !!!!!!!!

    Hi ,
    I am trying to get my updated Jtable, stored in a table of database over a previous table ......after updating it via drag n drop ....
    But even after I change the cell position to make the changes ... it still takes up the old value of that cell and not the new one while writing the data in the database table...
    Here is the code .... Please see it and tell me if it is possible :
    package newpackage;
    import java.sql.*;
    import java.util.Vector;
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.Dimension;
    import java.text.*;
    import newpackage.ExcelExporter;
    import java.awt.Dimension;
    import javax.swing.border.*;
    import javax.swing.table.*;
    import java.awt.datatransfer.*;
    import java.awt.dnd.*;
    import java.awt.image.*;
    import java.io.*;
    import java.util.*;
    import java.awt.print.*;
    import java.awt.*;
    import java.io.*;
    import java.util.Random.*;
    import javax.swing.*;
    import java.text.*;
    import javax.swing.DefaultCellEditor;
    import javax.swing.JComboBox;
    import javax.swing.JTable;
    import javax.swing.table.DefaultTableCellRenderer;
    import javax.swing.table.TableColumn;
    public class tab7le extends javax.swing.JFrame {
        Vector columnNames = new Vector();
        Vector data = new Vector();
        Connection con;
    Statement stat;
    ResultSet rs;
    int li_cols = 0;
    Vector allRows;
    Vector row;
    Vector newRow;
    Vector colNames;
    String dbColNames[];
    String pkValues[];
    String tableName;
    ResultSetMetaData myM;
    String pKeyCol;
    Vector deletedKeys;
    Vector newRows;
    boolean ibRowNew = false;
    boolean ibRowInserted = false;
        private Map<String, Color> colormap = new HashMap<String, Color>();
        /** Creates new form tab7le */
        public tab7le() {
            populate();
            initComponents();
           public void updateDB(){
                     try{
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
          catch (ClassNotFoundException e){
                System.out.println("Cannot Load Driver!");
          try{
             String url = "jdbc:odbc:FAMS";
             con = DriverManager.getConnection(url);
             stat = con.createStatement();
             rs = stat.executeQuery("Select * from SubAllot");
             deletedKeys = new Vector();
             newRows = new Vector();
             myM = rs.getMetaData();
             tableName = myM.getTableName(1);
             li_cols = myM.getColumnCount();
             dbColNames = new String[li_cols];
             for(int col = 0; col < li_cols; col ++){
                dbColNames[col] = myM.getColumnName(col + 1);
             allRows = new Vector();
             while(rs.next()){
                newRow = new Vector();
                for(int i = 1; i <= li_cols; i++){
                   newRow.addElement(rs.getObject(i));
                } // for
                allRows.addElement(newRow);
             } // while
          catch(SQLException e){
             System.out.println(e.getMessage());
    String updateLine[] = new String[dbColNames.length];
          try{
             DatabaseMetaData dbData = con.getMetaData();
             String catalog;
             // Get the name of all of the columns for this table
             String curCol;
             colNames = new Vector();
             ResultSet rset1 = dbData.getColumns(null,null,tableName,null);
             while (rset1.next()) {
                curCol = rset1.getString(4);
                colNames.addElement(curCol);
             rset1.close();
             pKeyCol = colNames.firstElement().toString();
             // Go through the rows and perform INSERTS/UPDATES/DELETES
             int totalrows;
             totalrows = allRows.size();
             String dbValues[];
             Vector currentRow = new Vector();
             pkValues = new String[allRows.size()];
             // Get column names and values
             for(int i=0;i < totalrows;i++){
                currentRow = (Vector) allRows.elementAt(i);
                int numElements = currentRow.size();
                dbValues = new String[numElements];
                for(int x = 0; x < numElements; x++){
                   String classType = currentRow.elementAt(x).getClass().toString();
                   int pos = classType.indexOf("String");
                   if(pos > 0){ // we have a String
                      dbValues[x] = "'" + currentRow.elementAt(x) + "'";
                      updateLine[x] = dbColNames[x] + " = " + "'" + currentRow.elementAt(x) + "',";
                      if (dbColNames[x].toUpperCase().equals(pKeyCol.toUpperCase())){
                        pkValues[i] = currentRow.elementAt(x).toString() ;
                   pos = classType.indexOf("Integer");
                   if(pos > 0){ // we have an Integer
                      dbValues[x] = currentRow.elementAt(x).toString();
                      if (dbColNames[x].toUpperCase().equals(pKeyCol.toUpperCase())){
                         pkValues[i] = currentRow.elementAt(x).toString();
                      else{
                         updateLine[x] = dbColNames[x] + " = " + currentRow.elementAt(x).toString() + ",";
                   pos = classType.indexOf("Boolean");
                   if(pos > 0){ // we have a Boolean
                      dbValues[x] = currentRow.elementAt(x).toString();
                      updateLine[x] = dbColNames[x] + " = " + currentRow.elementAt(x).toString() + ",";
                      if (dbColNames[x].toUpperCase().equals(pKeyCol.toUpperCase())){
                         pkValues[i] = currentRow.elementAt(x).toString() ;
                } // For Loop
                // If we are here, we have read one entire row of data. Do an UPDATE or an INSERT
                int numNewRows = newRows.size();
                int insertRow = 0;
                boolean newRowFound;
                for (int z = 0;z < numNewRows;z++){
                   insertRow = ((Integer) newRows.get(z)).intValue();
                   if(insertRow == i+1){
                      StringBuffer InsertSQL = new StringBuffer();
                      InsertSQL.append("INSERT INTO " + tableName + " (");
                      for(int zz=0;zz<=dbColNames.length-1;zz++){
                         if (dbColNames[zz] != null){
                            InsertSQL.append(dbColNames[zz] + ",");
                      // Strip out last comma
                      InsertSQL.replace(InsertSQL.length()-1,InsertSQL.length(),")");
                      InsertSQL.append(" VALUES(" + pkValues[i] + ",");
                      for(int c=1;c < dbValues.length;c++){
                         InsertSQL.append(dbValues[c] + ",");
                      InsertSQL.replace(InsertSQL.length()-1,InsertSQL.length(),")");
                      System.out.println(InsertSQL.toString());
                      stat.executeUpdate(InsertSQL.toString());
                      ibRowInserted=true;
                } // End of INSERT Logic
                // If row has not been INSERTED perform an UPDATE
                if(ibRowInserted == false){
                   StringBuffer updateSQL = new StringBuffer();
                   updateSQL.append("UPDATE " + tableName + " SET ");
                   for(int z=0;z<=updateLine.length-1;z++){
                      if (updateLine[z] != null){
                         updateSQL.append(updateLine[z]);
                   // Replace the last ',' in the SQL statement with a blank. Then add WHERE clause
                   updateSQL.replace(updateSQL.length()-1,updateSQL.length()," ");
                   updateSQL.append(" WHERE " + pKeyCol + " = " + pkValues[i] );
                   System.out.println(updateSQL.toString());
                   stat.executeUpdate(updateSQL.toString());
                   } //for
             catch(Exception ex){
                System.out.println("SQL Error! Cannot perform SQL UPDATE " + ex.getMessage());
             // Delete records from the DB
             try{
                int numDeletes = deletedKeys.size();
                String deleteSQL;
                for(int i = 0; i < numDeletes;i++){
                   deleteSQL = "DELETE FROM " + tableName + " WHERE " + pKeyCol + " = " +
                                                ((Integer) deletedKeys.get(i)).toString();
                System.out.println(deleteSQL);
                   stat.executeUpdate(deleteSQL);
                // Assume deletes where successful. Recreate Vector holding PK Keys
                deletedKeys = new Vector();
             catch(Exception ex){
                System.out.println(ex.getMessage());
        public void populate()
            try
                //  Connect to the Database
                Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                Connection con = DriverManager.getConnection("Jdbc:Odbc:FAMS"," "," ");
                System.out.println("ok1");
                //  Read data from a table
                String sql;
                 sql = "Select * from SubAllot";
                 System.out.println("ok1");
                Statement stmt = con.createStatement();
                System.out.println("ok1");
                ResultSet rs = stmt.executeQuery( sql );
                System.out.println("ok1");
                ResultSetMetaData md = rs.getMetaData();
                System.out.println("ok1");
                int columns = md.getColumnCount();
                for(int i = 0;i<columns;i++){
                    columnNames.addElement(md.getColumnName(i+1));
                    System.out.println("ok2");
                while (rs.next())
                    Vector row = new Vector(columns);
                    for (int i = 1; i <columns+1; i++)
                        row.addElement( rs.getObject(i) );
                    data.addElement( row );
            catch(Exception e){
                e.printStackTrace();
                 public void dropmenu(JTable table,TableColumn subpref1) {
            //Set up the editor for the sport cells.
            JComboBox comboBox = new JComboBox();
          for (int i = 0;i<=20;i++)
           comboBox.addItem(i);
            subpref1.setCellEditor(new DefaultCellEditor(comboBox));
            //Set up tool tips for the sport cells.
            DefaultTableCellRenderer renderer =
                    new DefaultTableCellRenderer();
            renderer.setToolTipText("Click for combo box");
            subpref1.setCellRenderer(renderer);
                       abstract class StringTransferHandler extends TransferHandler {
            public int dropAction;
            protected abstract String exportString(final JComponent c);
            protected abstract void importString(final JComponent c, final String str);
            @Override
            protected Transferable createTransferable(final JComponent c) {
                return new StringSelection(exportString(c));
            @Override
            public int getSourceActions(final JComponent c) {
                return MOVE;
            @Override
            public boolean importData(final JComponent c, final Transferable t) {
                if (canImport(c, t.getTransferDataFlavors())) {
                    try {
                        String str = (String) t.getTransferData(DataFlavor.stringFlavor);
                        importString(c, str);
                        return true;
                    } catch (UnsupportedFlavorException ufe) {
                    } catch (IOException ioe) {
                return false;
            @Override
            public boolean canImport(final JComponent c, final DataFlavor[] flavors) {
                for (int ndx = 0; ndx < flavors.length; ndx++) {
                    if (DataFlavor.stringFlavor.equals(flavors[ndx])) {
                        return true;
                return false;
        class TableTransferHandler extends StringTransferHandler {
            private int dragRow;
            private int[] dragColumns;
            private BufferedImage[] image;
            private int row;
            private int[] columns;
            public JTable target;
            private Map<String, Color> colormap;
            private TableTransferHandler(final Map<String, Color> colormap) {
                this.colormap = colormap;
            @Override
            protected Transferable createTransferable(final JComponent c) {
                JTable table = (JTable) c;
                dragRow = table.getSelectedRow();
                dragColumns = table.getSelectedColumns();
                createDragImage(table);
                return new StringSelection(exportString(c));
            protected String exportString(final JComponent c) {
                JTable table = (JTable) c;
                row = table.getSelectedRow();
                columns = table.getSelectedColumns();
                StringBuffer buff = new StringBuffer();
                colormap.clear();
                for (int j = 0; j < columns.length; j++) {
                    Object val = table.getValueAt(row, columns[j]);
                    buff.append(val == null ? "" : val.toString());
                    if (j != columns.length - 1) {
                        buff.append(",");
                    colormap.put(row+","+columns[j], Color.LIGHT_GRAY);
                table.repaint();
                return buff.toString();
            protected void importString(final JComponent c, final String str) {
                target = (JTable) c;
                DefaultTableModel model = (DefaultTableModel) target.getModel();
                String[] values = str.split("\n");
                int colCount = target.getSelectedColumn();
                int max = target.getColumnCount();
                for (int ndx = 0; ndx < values.length; ndx++) {
                    String[] data = values[ndx].split(",");
                    for (int i = 0; i < data.length; i++) {
                        String string = data;
    if(colCount < max){
    Object val = model.getValueAt(target.getSelectedRow(), colCount);
    model.setValueAt(string, target.getSelectedRow(), colCount);
    model.setValueAt(val, dragRow, dragColumns[i]);
    colCount++;
    public BufferedImage[] getDragImage() {
    return image;
    private void createDragImage(final JTable table) {
    if (dragColumns != null) {
    try {
    image = new BufferedImage[dragColumns.length];
    for (int i = 0; i < dragColumns.length; i++) {
    Rectangle cellBounds = table.getCellRect(dragRow, i, true);
    TableCellRenderer r = table.getCellRenderer(dragRow, i);
    DefaultTableModel m = (DefaultTableModel) table.getModel();
    JComponent lbl = (JComponent) r.getTableCellRendererComponent(table,
    table.getValueAt(dragRow, dragColumns[i]), false, false, dragRow, i);
    lbl.setBounds(cellBounds);
    BufferedImage img = new BufferedImage(lbl.getWidth(), lbl.getHeight(),
    BufferedImage.TYPE_INT_ARGB_PRE);
    Graphics2D graphics = img.createGraphics();
    graphics.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f));
    lbl.setBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY));
    lbl.paint(graphics);
    graphics.dispose();
    image[i] = img;
    } catch (RuntimeException re) {
    class TableDropTarget extends DropTarget {
    private Insets autoscrollInsets = new Insets(20, 20, 20, 20);
    private Rectangle rect2D = new Rectangle();
    private TableTransferHandler handler;
    public TableDropTarget(final TableTransferHandler h) {
    super();
    this.handler = h;
    @Override
    public void dragOver(final DropTargetDragEvent dtde) {
    handler.dropAction = dtde.getDropAction();
    JTable table = (JTable) dtde.getDropTargetContext().getComponent();
    Point location = dtde.getLocation();
    int row = table.rowAtPoint(location);
    int column = table.columnAtPoint(location);
    table.changeSelection(row, column, false, false);
    paintImage(table, location);
    autoscroll(table, location);
    super.dragOver(dtde);
    public void dragExit(final DropTargetDragEvent dtde) {
    clearImage((JTable) dtde.getDropTargetContext().getComponent());
    super.dragExit(dtde);
    @Override
    public void drop(final DropTargetDropEvent dtde) {
    Transferable data = dtde.getTransferable();
    JTable table = (JTable) dtde.getDropTargetContext().getComponent();
    clearImage(table);
    handler.importData(table, data);
    super.drop(dtde);
    private final void paintImage(final JTable table, final Point location) {
    Point pt = new Point(location);
    BufferedImage[] image = handler.getDragImage();
    if (image != null) {
    table.paintImmediately(rect2D.getBounds());
    rect2D.setLocation(pt.x - 15, pt.y - 15);
    int wRect2D = 0;
    int hRect2D = 0;
    for (int i = 0; i < image.length; i++) {
    table.getGraphics().drawImage(image[i], pt.x - 15, pt.y - 15, table);
    pt.x += image[i].getWidth();
    if (hRect2D < image[i].getHeight()) {
    hRect2D = image[i].getHeight();
    wRect2D += image[i].getWidth();
    rect2D.setSize(wRect2D, hRect2D);
    private final void clearImage(final JTable table) {
    table.paintImmediately(rect2D.getBounds());
    private Insets getAutoscrollInsets() {
    return autoscrollInsets;
    private void autoscroll(final JTable table, final Point cursorLocation) {
    Insets insets = getAutoscrollInsets();
    Rectangle outer = table.getVisibleRect();
    Rectangle inner = new Rectangle(outer.x + insets.left,
    outer.y + insets.top,
    outer.width - (insets.left + insets.right),
    outer.height - (insets.top + insets.bottom));
    if (!inner.contains(cursorLocation)) {
    Rectangle scrollRect = new Rectangle(cursorLocation.x - insets.left,
    cursorLocation.y - insets.top,
    insets.left + insets.right,
    insets.top + insets.bottom);
    table.scrollRectToVisible(scrollRect);
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc="Generated Code">
    private void initComponents() {
    jScrollPane1 = new javax.swing.JScrollPane();
    table = new javax.swing.JTable();
    jButton1 = new javax.swing.JButton();
    jButton2 = new javax.swing.JButton();
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    table.setModel(new javax.swing.table.DefaultTableModel(
    data, columnNames
    jScrollPane1.setViewportView(table);
    //populate();
    table.getTableHeader().setReorderingAllowed(false);
    table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    table.setCellSelectionEnabled(true);
    table.setDragEnabled(true);
    TableTransferHandler th = new TableTransferHandler(colormap);
    table.setTransferHandler(th);
    table.setDropTarget(new TableDropTarget(th));
    dropmenu(table, table.getColumnModel().getColumn(11));
    jButton1.setText("Update");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jButton1ActionPerformed(evt);
    jButton2.setText("Ex");
    jButton2.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jButton2ActionPerformed(evt);
    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(92, 92, 92)
    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 605, javax.swing.GroupLayout.PREFERRED_SIZE))
    .addGroup(layout.createSequentialGroup()
    .addGap(347, 347, 347)
    .addComponent(jButton1)
    .addGap(115, 115, 115)
    .addComponent(jButton2)))
    .addContainerGap(73, Short.MAX_VALUE))
    layout.setVerticalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGap(47, 47, 47)
    .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 354, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGap(58, 58, 58)
    .addComponent(jButton1)
    .addContainerGap(83, Short.MAX_VALUE))
    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
    .addComponent(jButton2)
    .addGap(65, 65, 65))))
    pack();
    }// </editor-fold>
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                        
    updateDB(); // TODO add your handling code here:
    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {                                        
    try {
    String pathToDesktop = System.getProperty("user.home")+File.separator+"Desktop";
    pathToDesktop = pathToDesktop + "//Final Allotment.xls";
    ExcelExporter exp = new ExcelExporter();
    exp.exportTable(table, new File(pathToDesktop));
    JOptionPane.showMessageDialog(this,"File exported and saved on desktop!");
    catch (IOException ex) {
    System.out.println(ex.getMessage());
    ex.printStackTrace();
    } // TODO add your handling code here:
    * @param args the command line arguments
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new tab7le().setVisible(true);
    // Variables declaration - do not modify
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JTable table;
    // End of variables declaration
    Please help !!!!!!!!
    Thanks in advance.....                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                

    Here is the code Do you expect people to read through 400 lines of code to understand what you are doing?
    Why post code with access to a database? We can't access the database.
    Search the forum for my "Database Information" (without the space) example class which shows you how to refresh a table with new data.
    If you need further help then you need to create a [Short, Self Contained, Compilable and Executable, Example Program (SSCCE)|http://homepage1.nifty.com/algafield/sscce.html], that demonstrates the incorrect behaviour.

  • Can you please help me in creating a stored procedure which can create a tablesapce in a specified location ?

    Hello ...
    Can you please help me in writing a procedure which can create tablespace. like i have a requirement that
    through sql query i need to get the location of where the data file of the newly created tablespace need to be stored.
    I need to store the location of the datafiles in a variable and i need to use that variable for specifying the location of the data file in newly created data file.
    please help me writing this procedure.....
    Regards vinay raj.
    Thanks in advance..

    select distinct substr(file_name,1,instr(file_name,'/',-1)) from dba_data_files;
    Run this in a few of your databases and see how often you ONLY get one row returned.
    Normally there is no "default" file system for data files (read about the DB_CREATE_FILE_DEST parameter and Oracle Managed Files for the exception to that).
    You could pick the same file system as an existing tablespace, but even then there is no guarantee that the file system has sufficient space for the new tablespace - you have to check that OUTSIDE the database.
    Given the query at the top it is pretty simple to create a SQL script that generates a SQL script.  This can be run in any database via sqlplus, and then the generated script can be edited as needed and run immediately, under human control, avoiding surprises.
    set echo off
    set feedback off
    set heading off
    set lines 100
    spool myts.sql
    select distinct 'create tablespace MYTS DATAFILE '''||substr(file_name,1,instr(file_name,'/',-1))||'myts01.dbf'' size 40M ONLINE;' stmt
    from dba_data_files;
    spool off
    For example, if you find there are multiple filesystems to choose from, run this then delete the filesystems you don't want from the generated script.  If you find there is only one file system but it is too full, work with your SA or storage to to add space or allocate a new file system, then modify the generated script accordingly.
    This example assumes a traditional file system, on a UNIX-style OS, not using Oracle-Managed files.  ASM or RAW will have a different format for the data file location, of course.

  • Please Help!!!!! Problem Migrating from sql 2000 stored procedure to PL/SQL

    I have used a tool to convert my sql 2000 stored procedure to Oracle 10g PL/SQL, here is an example
    SQL 2000 Stored Procedure
    CREATE PROCEDURE [GetEmployees]
    AS
    Select * from EMPMST ORDER BY emp_name
    GO
    After Transformation i got 2 files, one was a procedure and other a package
    CREATE OR REPLACE PACKAGE GLOBALPKG
    AS
         TYPE RCT1 IS REF CURSOR;
         TRANCOUNT INTEGER := 0;
         IDENTITY INTEGER;
    END;
    CREATE OR REPLACE PROCEDURE GetEmployees
         RCT1 IN OUT      GLOBALPKG.RCT1
    AS
    BEGIN
         OPEN RCT1 FOR
         SELECT *
         FROM EMPMST
         ORDER BY emp_name;
    END;
    When i execute the procedure GetEmployees i got this error :
    SQL> execute GetEmployees;
    BEGIN GetEmployees; END;
    ERROR at line 1:
    ORA-06550: line 1, column 7:
    PLS-00306: wrong number or types of arguments in call to 'GETEMPLOYEES'
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    Please Help me in debugging this error. Thanks in advance.

    As the poster above mentioned you cannot call "GetEmployees" without a parameter.
    Note that the procedure declaration has the following line
    RCT1 IN OUT GLOBALPKG.RCT1
    This means that whenever you want to call the procedure you must pass it a variable of type GLOBALPKG.RCT1
    However unless this is merely a homework or learning exercise (i.e. you are not porting the code of a production application) i would strongly recommend that you do not attempt to simply convert the code to PL/SQL.
    The reasoning behind this is that Oracle's architecture will be completely different to the source of the original code and if you attempt to simply port the code (especially using an automatic tool) you will almost certainly hit problems.
    For example the SQL Server's 2000 code may (should be) be written based on SQL Server's locking strategy. Oracle's locking strategy is completly different if you try to use the same techniques as you do in SQL Server the performance will suffer.
    Porting a code or a database schema from one platform to another involves a lot of analysis in order to take advantage of the features of the destination platform.
    As I said this may not be important to you depending on why you are attempting a port.
    Good Luck.

  • Please help - Can not use stored procedure with CTE and temp table in OLEDB source

    Hi,
       I am going to create a simple package. It has OLEDB source , a Derived transformation and a OLEDB Target database.
    Now, for the OLEDB Source, I have a stored procedure with CTE and there are many temp tables inside it. When I give like EXEC <Procedure name> then I am getting the error like ''The metadata  could not be determined because statement with CTE.......uses
    temp table. 
    Please help me how to resolve this ?

    you write to the temp tables that get created at the time the procedure runs I guess
    Instead do it a staged approach, run Execute SQL to populate them, then pull the data using the source.
    You must set retainsameconnection to TRUE to be able to use the temp tables
    Arthur My Blog

Maybe you are looking for

  • I get a green screen

    Hi, I use Windows XP Home Edition and my QT is giving me a few problems. When I start a video (download or stream) I get a few seconds of video and then the screen goes green. My PC is using a LOT of CPU power when this happens. What do I need to fix

  • JDeveloper Code Editor doesn't do ClearType font anti-aliasing

    I can't seem to get the Code Editor in JDeveloper (11.1.1.5.0) to do ClearType sub-pixel font anti-aliasing. Everything else in the IDE is doing proper sub-pixel anti-aliasing, it's only the Code Editor that's not doing it. It's doing "normal" pixel

  • Split large sound files

    Is there a easy way to split large sound files? Thank you

  • Regex - Find a word

    Greetings all I want to find a particular word in a string example string: SELECT CUSTOMER.STUDENT."NAME", CUSTOMER.STUDENT." FROM DATE" FROM CUSTOMER.STUDENT i want to grab the FROM WORD from the above string . search condition: There must be a spac

  • Starts in Open Firmware.  No OS

    Short story, When I turn on the Pismo, I get open firmware. I beleive the Hard Drive was formatted, and maybe partitioned eternally through a PC program called Macdrive. I have the software Restore Disc, and the software Install Disc. Neither will bo