How to edit databases from JTable?

Hello everyone, I would like to ask your help on how we can edit JTable cells that would be reflected into the database, or how do we change the database via a JTable.
I have the installer of an application which I made with Java SE called FuelStation.exe
My class files are ready for sharing along with its source files.
I have placed it in this location in my website:
http://www.apachevista.com/alphaprojects/runfiles/
It is complete with full details about databases, proposed mysql embed, and so on. Please see the file and notify me at [email protected]
Here is my sample code:
// DisplayQueryResults.java
// Display the contents of the Authors table in the
// Books database.
import java.awt.BorderLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.sql.SQLException;
import javax.swing.JFrame;
import javax.swing.JTextArea;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
import javax.swing.JTable;
import javax.swing.JOptionPane;
import javax.swing.JButton;
import javax.swing.Box;
import javax.swing.JInternalFrame;
import java.util.*; // for the Bundle
import javax.swing.event.InternalFrameEvent;
import javax.swing.event.InternalFrameListener;
import javax.swing.event.InternalFrameAdapter;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.ListSelectionModel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.event.*; // step 1
import javax.swing.table.TableModel; // step 1
public class DisplayQueryResults extends JInternalFrame implements TableModelListener { // step 2
// JDBC driver, database URL, username and password
ResourceBundle bundle = ResourceBundle.getBundle("Accounting");
final String JDBC_DRIVER = bundle.getString("Driver");
final String DATABASE_URL = bundle.getString("URL");
final String USERNAME = bundle.getString("User");
final String PASSWORD = bundle.getString("Password");
// default query retrieves all data from authors table
//static final String DEFAULT_QUERY = "SELECT authors.lastName, authors.firstName, titles.title, titles.editionNumber FROM titles INNER JOIN (authorISBN INNER JOIN authors ON authorISBN.authorID=authors.authorID) ON titles.isbn=authorISBN.isbn";
final String DEFAULT_QUERY = bundle.getString("Query");
private ResultSetTableModel tableModel;
private JTextArea queryArea;
static final int xOffset = 0, yOffset = 200;
private boolean ALLOW_COLUMN_SELECTION = false;
private boolean ALLOW_ROW_SELECTION = true;
// create ResultSetTableModel and GUI
public DisplayQueryResults() {  
super("Sales of the Day",
true, //resizable
true, //closable
true, //maximizable
false);//iconifiable
//...Create the GUI and put it in the window...
//Set the window's location.
setLocation(xOffset, yOffset);
// create ResultSetTableModel and display database table
try {
// create TableModel for results of query SELECT * FROM authors
tableModel = new ResultSetTableModel(JDBC_DRIVER, DATABASE_URL,
USERNAME, PASSWORD, DEFAULT_QUERY);
// set up JTextArea in which user types queries
queryArea = new JTextArea(DEFAULT_QUERY, 1, 100);
queryArea.setWrapStyleWord(true);
queryArea.setLineWrap(true);
JScrollPane scrollPane = new JScrollPane(queryArea,
ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
// set up JButton for submitting queries
JButton submitButton = new JButton("Submit Query");
// create Box to manage placement of queryArea and
// submitButton in GUI
Box box = Box.createHorizontalBox();
box.add(scrollPane);
box.add(submitButton);
// create JTable delegate for tableModel
JTable resultTable = new JTable(tableModel);
resultTable.setFillsViewportHeight(true); // Makes the empty space heights white
resultTable.setRowSelectionAllowed(true);
resultTable.getModel().addTableModelListener(this); // step 3
// place GUI components on content pane
add(box, BorderLayout.NORTH);
add(new JScrollPane(resultTable), BorderLayout.CENTER);
// create event listener for submitButton
submitButton.addActionListener(
new ActionListener()
// pass query to table model
public void actionPerformed(ActionEvent event)
// perform a new query
try
tableModel.setQuery(queryArea.getText());
} // end try
catch ( SQLException sqlException)
JOptionPane.showMessageDialog(null,
sqlException.getMessage(), "Database error",
JOptionPane.ERROR_MESSAGE);
// try to recover from invalid user query
// by executing default query
try {
tableModel.setQuery(DEFAULT_QUERY);
queryArea.setText(DEFAULT_QUERY);
} // end try
catch (SQLException sqlException2) {
JOptionPane.showMessageDialog(null,
sqlException2.getMessage(), "Database error",
JOptionPane.ERROR_MESSAGE);
// ensure database connection is closed
tableModel.disconnectFromDatabase();
System.exit(1); // terminate application
} // end inner catch
} // end outer catch
} // end actionPerformed
} // end ActionListener inner class
); // end call to addActionListener
//...Then set the window size or call pack...
     setSize(750,300);
setVisible(true); // display window
} // end try
catch (ClassNotFoundException classNotFound) {
JOptionPane.showMessageDialog(null,
"MySQL driver not found", "Driver not found",
JOptionPane.ERROR_MESSAGE);
System.exit(1); // terminate application
} // end catch
catch (SQLException sqlException) {
JOptionPane.showMessageDialog(null, sqlException.getMessage(),
"Database error", JOptionPane.ERROR_MESSAGE);
// ensure database connection is closed
tableModel.disconnectFromDatabase();
System.exit(1); // terminate application
} // end catch
// dispose of window when user quits application (this overrides
// the default of HIDE_ON_CLOSE)
setDefaultCloseOperation(DISPOSE_ON_CLOSE);
// ensure database connection is closed when user quits application
addInternalFrameListener(
new InternalFrameAdapter() {
// disconnect from database and exit when window has closed
public void windowClosed(WindowEvent event) {
tableModel.disconnectFromDatabase();
System.exit(0);
} // end method windowClosed
} // end WindowAdapter inner class
); // end call to addWindowListener
} // end DisplayQueryResults constructor
public void tableChanged(TableModelEvent e) { // step 4
int row = e.getFirstRow();
int column = e.getColumn();
TableModel model = (TableModel)e.getSource();
String columnName = model.getColumnName(column);
Object tableModel = model.getValueAt(row, column);
// Do something with the data...
System.out.println(tableModel);
System.out.println("data");
// execute application
public static void main(String args[]) {
new DisplayQueryResults();
} // end main
} // end class DisplayQueryResults
My question is in lines 177-187:
public void tableChanged(TableModelEvent e) { // step 4
int row = e.getFirstRow();
int column = e.getColumn();
TableModel model = (TableModel)e.getSource();
String columnName = model.getColumnName(column);
Object tableModel = model.getValueAt(row, column);
// Do something with the data...
System.out.println(tableModel);
System.out.println("data");
Why is my listener not working or why is it not implemented when I click the cells in the JTable and why is it not reflected into the JTable or into the console?
If this is Flash, Things can be done easily, but this is Java, and I dont know much about this language. I admit that I am new to this -intirely new.
PS:
When you have solved the problem, please notify me with the code that's changed
and please share it to others if you like so.
Best Wishes: Oliver Bob Lagumen
Email: [email protected]
website: www.apachevista.com
Oliver Bob Lagumen
Edited by: Oliverbob on Jan 24, 2008 9:03 PM

Why is my listener not working or why is it not implemented when I click the cells in the JTable and why is it not reflected into the JTable or into the console?What does happen when you click on the cells?
Does the ResultSetTableModel report the cells as editable? If not you will never get to edit their contents, and so the table's model won't change, and so the table model listener will never get invoked.
When you post code here use the code tags. Basically you put {code} at the start of your code and again at the end. That way the code will be readable.
Try to post minimal examples with which others can reproduce your problem. In this case "minimal" would involve removing or drastically simplifying a lot of the GUI stuff which is just noise. But "reproduce" would involve including the ResultSetTableModel.
When you have solved the problem, please notify me with the code that's changedAvoid this.
What you say here is quite possibly not what you mean. But, in any event, while there might be plenty of interest in helping with specific problems there will likely be none in writing your code. Your problem remains yours. But your solution and your code - prompted by whatever help you might recieve - will also be yours.

Similar Messages

  • Update database from Jtable

    Hi all,
    I am trying to update database from Jtable. I added Jtable to scrollpane .
    My question is..
    after updating the Jtable..I want to save the details to database..when I click save button on my screen...how to do that? Please help me out! Thanks in advance..
    Here is the code that I wrote...
    public class VasuTest extends JFrame {
    private boolean DEBUG = true;
    Vector column_list = new Vector();
    Vector rows = new Vector();
    public VasuTest() {
    super("VasuTest");
         JToolBar toolBar = new JToolBar();
    JButton button = null;
    button = new JButton("Send Email");
    button.setToolTipText("This is the Exit button");
    button.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
         System.out.println("Send Email");
    toolBar.add(button);
    button = new JButton("Save");
    button.setToolTipText("This is the Save button");
    button.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
         System.out.println("Save");
    toolBar.add(button);
    button = new JButton("Exit");
    button.setToolTipText("This is the Exit button");
    button.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
         System.exit(0);
    toolBar.add(button);
         JPanel ContentPane = new JPanel();
    ImageIcon i1 = new ImageIcon("Dongle.gif");
    JLabel j1 = new JLabel( i1, JLabel.CENTER);
         ContentPane.add(j1,BorderLayout.CENTER);
         setContentPane(ContentPane);
         JDBCT myModel = new JDBCT();
    String q = "select a.email_no,a.email_ln_no,b.cust_no,null customer_name,null cdate,a.batch_no,b.purch_ord_no,a.user_part_no,null part_desc,a.user_upgraded_part_no,null prod_id,a.qty,a.price,a.encrypted_sum_id,a.decrypted_sum_id,a.approval_key,a.status_cd,decode(a.status_cd,'APPROVED','true','ERROR','false','PROCESSED','true') approved,null end_cust,null sales_ord,null so_line,null sales_ord_cust,null shipment ,null sales_end_cust_name ,null shipment_line,a.note,null fromcust from upgrade_req_key_s3 a,upgrade_req_s3 b where a.email_no = b.email_no order by a.email_no,a.email_ln_no";
    myModel.setQuery();
    final Font f = new Font("SansSerif", Font.BOLD, 10);
    JTable table = new JTable(myModel);
    table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    // Container ContentPane = getContentPane();
         int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS;
         int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS;
         JScrollPane scrollPane = new JScrollPane(table,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
         scrollPane.setPreferredSize ( new Dimension ( 770, 400 ) );
    ContentPane.add(toolBar,BorderLayout.CENTER);
    //Add the scroll pane to this window.
    ContentPane.add(scrollPane,BorderLayout.CENTER);
    addWindowListener(new WindowAdapter() {
    public void windowClosing(WindowEvent e) {
    System.exit(0);
    public class JDBCT extends AbstractTableModel {
    Vector cache; // will hold String[] objects...
    int colCount;
    int rowHeight;
    String [] headers;
    Connection db;
    Connection conn;
    Statement statement;
    String currentURL;
    // public QueryTableModel() {
    // cache = new Vector();
    // new oracle.jdbc.driver.OracleDriver();
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    catch (ClassNotFoundException e) {
    System.out.println(e.getMessage());
    System.exit(-1);
    String url = "jdbc:odbc:c3-erp,s3,s3";
    public String getColumnName(int i) {
         if (i == 0)      {  return      "Email No"                     ;     } else
    if (i == 1)      {  return      "Email Line No.";} else
         if (i == 2)      {  return      "Customer";} else
         if (i == 3)      {  return      "Customer Name";} else
         if (i == 4)      {  return      "Date";} else
         if (i == 5)      {  return      "Batch No";} else
         if (i == 6)      {  return      "Customer PO";} else
         if (i == 7)      {  return      "Upgrade From Part";} else
         if (i == 8)      {  return      "Part Description";} else
         if (i == 9)      {  return      "Upgrade To Part";} else
         if (i == 10)      {  return      "Product Id";} else
         if (i == 11)      {  return      "Quantity";} else
         if (i == 12)      {  return      "Price";} else
         if (i == 13)      {  return      "Encypted Sum ID";} else
         if (i == 14)      {  return      "Decrypted Serial No";} else
         if (i == 15)      {  return      "Key";} else
         if (i == 16)      {  return      "Status";} else
         if (i == 17)      {  return      "Approved";} else
         if (i == 18)      {  return      "End Customer";} else
         if (i == 19)      {  return      "Sales Order";} else
         if (i == 20)      {  return      "SO Line";} else
         if (i == 21)      {  return      "Sales Order End Customer";} else
         if (i == 22)      {  return      "Sales Order End Customer Name";} else
         if (i == 23)      {  return      "Shipment";} else
         if (i == 24)      {  return      "Shipment Line";} else
         if (i == 25)      {  return      "Errors";} else
         if (i == 26)      { return       "From"; }
         else {return headers[i-1] ;}
    public int getColumnCount() { return colCount; }
    public int getRowCount() { return cache.size(); }
    //public Class getColumnClass(int c) {
    // return getValueAt(0, c).getClass();
    // overloaded isCellEditable method so that it returns true
    // in reference to a cell being editable.
    public boolean isCellEditable(int row, int col) { return true; }
    // overloaded setValyeAt which updates the data Vector and
    // calls the fireTableRowsUpdated() to notify any listeners
    // that data has changed and they need to redraw.
    public void setValueAt(Object value, int row, int col) {
    ((String[])cache.elementAt(row))[col] = (String)value;     
         fireTableRowsUpdated(row,row);     
    public void getInfo () {
    System.out.println("Row Count is : " + cache.size());
         System.out.println("Value at 0,0 is : " + getValueAt(0,0));
    //     boolean res = isCellEditable(0,0);
    //     System.out.println("The value of the Boolean result is : " + res);
    public Object getValueAt(int row, int col) {
    return ((String[])cache.elementAt(row))[col];
    // All the real work happens here!
    // In a real application, we'd probably perform the query in a separate thread.
    public void setQuery() {
    cache = new Vector();
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    conn = DriverManager.getConnection ("jdbc:odbc:c3-erp","s3","s3");
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("select a.email_no,a.email_ln_no,b.cust_no,null customer_name,null cdate,a.batch_no,b.purch_ord_no,a.user_part_no,null part_desc,a.user_upgraded_part_no,null prod_id,a.qty,a.price,a.encrypted_sum_id,a.decrypted_sum_id,a.approval_key,a.status_cd,decode(a.status_cd,'APPROVED','true','ERROR','false','PROCESSED','true') approved,null end_cust,null sales_ord,null so_line,null sales_ord_cust,null shipment ,null sales_end_cust_name ,null shipment_line,a.note,null fromcust from upgrade_req_key_s3 a,upgrade_req_s3 b where a.email_no = b.email_no order by a.email_no,a.email_ln_no");
    ResultSetMetaData meta = rs.getMetaData();
    colCount = meta.getColumnCount();
    String[] record = new String[27];      
    // Now we must rebuild the headers array with the new column name
    headers = new String[27];
    for (int h=0; h < 27; h++) {
    // headers[h-1] = meta.getColumnName(h);
         headers[h] = getColumnName(h);
    // and file the cache with the record from our query. This would
    // be practical if we were expecting a few million records to our
    // response query, but we are not so we can do this.
    while(rs.next()) {
         for (int i=0; i < colCount; i++) {
         record[i] = rs.getString(i + 1);
         cache.addElement(record);
         // Get the FIRST column of the table tableView
    // TableColumn column0 = table.getColumn(cache.elementAt(0));
    // Set the cell editor as non editable.
    // column0.setCellEditor(new EditableCellEditor(new JComboBox(), true));
    fireTableChanged(null); // notify everyone the we had a new table.
    catch (Exception e) {
    cache = new Vector(); // blank it out and keep going.
         e.printStackTrace();
    public static void main(String[] args) {
    VasuTest frame = new VasuTest();
    frame.pack();
    frame.setVisible(true);
    }

    When you click on the save button, you need to go through the model and retrieve the values getValueAt().
    Convert to whatever type you want since getValueAt() returns type Object and update the DB.

  • How to create database from .sql file

    how to create database from .sql file..?? i put the sintax query in a sql file.. and i want to call it in java code..
    ho to do it..??

    why do you want to do this from java?
    i just don't see the point.
    find your dba and have him/her run it for you

  • How To Migrate Databases From Windows 2003 32 bit to windows 2003 64 bit?

    Hi,
    How To Migrate Databases From Windows 2003 32 bit to windows 2003 64 bit?
    Db Version: 10.2.0.2
    Thanks,
    Yusuf

    Also see MOS Doc 403522.1 (How to Migrate Oracle 10.2 32bit to 10.2 64bit on Microsoft Windows)
    HTH
    Srini

  • How to insert data from JTable to mysql Table....

    hello everybody
    i need help about how to insert data from JTable to mysql table... i know about how to create Table model...facing problem about how to insert data from JTable to mysql table....any helping link or code ... ill be thankfulll....for giving me solution...

    table1.getValueAt(table1.getSelectedRow(),0)you are getting the value of a selected row... or if you want you can just use a loop..
    for(.....){
    table1.getValueAt(x,y);
    }I think you know INSERT STATEMENT.. here on it just string concat
    sample e.g. (This not insert)
    "delete from accrule " +
                    "where ruleid= " + tblRA.getValueAt(tblRA.getSelectedRow(),0)+
                    " and accountname='"+tblRA.getValueAt(tblRA.getSelectedRow(),1)+"'"

  • How to migrate  database from oracle10g to mysql

    how to migrate database from oracle10g to mysql

    Assuming you're actually using any of the features of Oracle at present, this will be an impossible task, since MySql has such narrower set of supported SQL.

  • How to migrate database from oracle9i on solaris to windows Itanium?

    How step I can do?
    I try to use export tool of oracle 9i export full database from solaris.
    by use command:
    export ORACLE_SID=dbtest
    export NLS_LANG=AMERICAN_AMERICA.TH8TISASCII
    exp system/password@dbtest full=y file= /u02/dump/dbtestfull.dmp log=/u02/dump/exp_dbtest.log
    My result is "Export terminated successfully without warnings."
    I had ftp dump file in binary mode from solaris to windows.
    create same database name on widnows (dbca --general purpose) set oracle_sid and NLS_lang
    and then import database by use command:
    imp system/password@dbtest file=e:\dumpfile\dbtestfull.dmp log=e:\dumpfile\imp_dbtestfull.log full=y
    I got error:
    "CREATE TABLESPACE "DRSYS" BLOCKSIZE 8192 DATAFILE '/u01/app/oracle/oradata"
    "/dbtest/drsys01.dbf' SIZE 20971520 AUTOEXTEND ON NEXT 655360 MAXSIZE"
    " 32767M EXTENT MANAGEMENT LOCAL AUTOALLOCATE ONLINE PERMANENT NOLOGGING "
    "SEGMENT SPACE MANAGEMENT AUTO"
    IMP-00015: following statement failed because the object already exists:
    "CREATE TABLESPACE "EXAMPLE" BLOCKSIZE 8192 DATAFILE '/u01/app/oracle/orada"
    "ta/dbtest/example01.dbf' SIZE 156631040 AUTOEXTEND ON NEXT 655360 MA"
    "XSIZE 32767M EXTENT MANAGEMENT LOCAL AUTOALLOCATE ONLINE PERMANENT NOLOG"
    "GING SEGMENT SPACE MANAGEMENT AUTO"
    IMP-00015: following statement failed because the object already exists:
    "CREATE TABLESPACE "INDX" BLOCKSIZE 8192 DATAFILE '/u01/app/oracle/oradata/"
    "dbtest/indx01.dbf' SIZE 26214400 AUTOEXTEND ON NEXT 1310720 MAXSIZE "
    "32767M EXTENT MANAGEMENT LOCAL AUTOALLOCATE ONLINE PERMANENT NOLOGGING S"
    "EGMENT SPACE MANAGEMENT AUTO"
    IMP-00015: following statement failed because the object already exists:
    "CREATE TABLESPACE "ODM" BLOCKSIZE 8192 DATAFILE '/u01/app/oracle/oradata/d"
    "btest/odm01.dbf' SIZE 20971520 AUTOEXTEND ON NEXT 655360 MAXSIZE 327"
    "67M EXTENT MANAGEMENT LOCAL AUTOALLOCATE ONLINE PERMANENT NOLOGGING SEGM"
    "ENT SPACE MANAGEMENT AUTO"
    IMP-00015: following statement failed because the object already exists:
    "CREATE TABLESPACE "TOOLS" BLOCKSIZE 8192 DATAFILE '/u01/app/oracle/oradata"
    "/dbtest/tools01.dbf' SIZE 10485760 AUTOEXTEND ON NEXT 327680 MAXSIZE"
    " 32767M EXTENT MANAGEMENT LOCAL AUTOALLOCATE ONLINE PERMANENT NOLOGGING "
    "SEGMENT SPACE MANAGEMENT AUTO"
    IMP-00015: following statement failed because the object already exists:
    "CREATE TABLESPACE "USERS" BLOCKSIZE 8192 DATAFILE '/u01/app/oracle/oradata"
    "/dbtest/users01.dbf' SIZE 26214400 AUTOEXTEND ON NEXT 1310720 MAXSIZ"
    "E 32767M EXTENT MANAGEMENT LOCAL AUTOALLOCATE ONLINE PERMANENT NOLOGGING"
    " SEGMENT SPACE MANAGEMENT AUTO"
    IMP-00015: following statement failed because the object already exists:
    "CREATE TABLESPACE "XDB" BLOCKSIZE 8192 DATAFILE '/u01/app/oracle/oradata/d"
    "btest/xdb01.dbf' SIZE 39976960 AUTOEXTEND ON NEXT 655360 MAXSIZE 327"
    "67M EXTENT MANAGEMENT LOCAL AUTOALLOCATE ONLINE PERMANENT NOLOGGING SEGM"
    "ENT SPACE MANAGEMENT AUTO"
    IMP-00017: following statement failed with ORACLE error 1119:
    "CREATE TABLESPACE "TESTTBS" BLOCKSIZE 8192 DATAFILE '/u01/app/oracle/orada"
    "ta/dbtest/testtbs.dbf' SIZE 33554432 AUTOEXTEND ON NEXT 33554432 MAX"
    "SIZE 2048M EXTENT MANAGEMENT LOCAL AUTOALLOCATE ONLINE PERMANENT NOLOGGI"
    "NG"
    IMP-00003: ORACLE error 1119 encountered
    ORA-01119: error in creating database file '/u01/app/oracle/oradata/dbtest/testt
    bs.dbf'
    ORA-27040: skgfrcre: create error, unable to create file
    OSD-04002: unable to open file
    O/S-Error: (OS 3) The system cannot find the path specified.
    IMP-00015: following statement failed because the object already exists:
    "CREATE USER "OUTLN" IDENTIFIED BY VALUES '4A3BA55E08595C81' TEMPORARY TABLE"
    "SPACE "TEMP" PASSWORD EXPIRE ACCOUNT LOCK"
    IMP-00015: following statement failed because the object already exists:
    "CREATE USER "DBSNMP" IDENTIFIED BY VALUES 'E066D214D5421CCC' TEMPORARY TABL"
    "ESPACE "TEMP""
    IMP-00015: following statement failed because the object already exists:
    "CREATE USER "WMSYS" IDENTIFIED BY VALUES '7C9BA362F8314299' TEMPORARY TABLE"
    "SPACE "TEMP" PASSWORD EXPIRE ACCOUNT LOCK"
    IMP-00015: following statement failed because the object already exists:
    "CREATE USER "ANONYMOUS" IDENTIFIED BY VALUES 'anonymous' DEFAULT TABLESPACE"
    " "XDB" TEMPORARY TABLESPACE "TEMP" PASSWORD EXPIRE ACCOUNT LOCK"
    IMP-00015: following statement failed because the object already exists:
    "CREATE USER "WKSYS" IDENTIFIED BY VALUES '69ED49EE1851900D' DEFAULT TABLESP"
    "ACE "DRSYS" TEMPORARY TABLESPACE "TEMP" PASSWORD EXPIRE ACCOUNT LOCK"
    IMP-00015: following statement failed because the object already exists:
    "CREATE USER "WKPROXY" IDENTIFIED BY VALUES 'B97545C4DD2ABE54' DEFAULT TABLE"
    "SPACE "DRSYS" TEMPORARY TABLESPACE "TEMP" PASSWORD EXPIRE ACCOUNT LOCK"
    IMP-00015: following statement failed because the object already exists:
    "CREATE USER "ODM" IDENTIFIED BY VALUES 'C252E8FA117AF049' DEFAULT TABLESPAC"
    "E "ODM" TEMPORARY TABLESPACE "TEMP" PASSWORD EXPIRE ACCOUNT LOCK"
    IMP-00015: following statement failed because the object already exists:
    "CREATE USER "ODM_MTR" IDENTIFIED BY VALUES 'A7A32CD03D3CE8D5' DEFAULT TABLE"
    "SPACE "ODM" TEMPORARY TABLESPACE "TEMP" PASSWORD EXPIRE ACCOUNT LOCK"
    IMP-00015: following statement failed because the object already exists:
    "CREATE USER "OLAPSYS" IDENTIFIED BY VALUES '3FB8EF9DB538647C' DEFAULT TABLE"
    "SPACE "CWMLITE" TEMPORARY TABLESPACE "TEMP" PASSWORD EXPIRE ACCOUNT LOCK"
    IMP-00015: following statement failed because the object already exists:
    "CREATE USER "HR" IDENTIFIED BY VALUES '6399F3B38EDF3288' DEFAULT TABLESPACE"
    " "EXAMPLE" TEMPORARY TABLESPACE "TEMP" PASSWORD EXPIRE ACCOUNT LOCK"
    IMP-00015: following statement failed because the object already exists:
    "CREATE USER "OE" IDENTIFIED BY VALUES '9C30855E7E0CB02D' DEFAULT TABLESPACE"
    " "EXAMPLE" TEMPORARY TABLESPACE "TEMP" PASSWORD EXPIRE ACCOUNT LOCK"
    IMP-00015: following statement failed because the object already exists:
    "CREATE USER "PM" IDENTIFIED BY VALUES '72E382A52E89575A' DEFAULT TABLESPACE"
    " "EXAMPLE" TEMPORARY TABLESPACE "TEMP" PASSWORD EXPIRE ACCOUNT LOCK"
    IMP-00015: following statement failed because the object already exists:
    "CREATE USER "SH" IDENTIFIED BY VALUES '9793B3777CD3BD1A' DEFAULT TABLESPACE"
    " "EXAMPLE" TEMPORARY TABLESPACE "TEMP" PASSWORD EXPIRE ACCOUNT LOCK"
    IMP-00015: following statement failed because the object already exists:
    "CREATE USER "QS_ADM" IDENTIFIED BY VALUES '991CDDAD5C5C32CA' DEFAULT TABLES"
    "PACE "EXAMPLE" TEMPORARY TABLESPACE "TEMP" PASSWORD EXPIRE ACCOUNT LOCK"
    IMP-00015: following statement failed because the object already exists:
    "CREATE USER "QS" IDENTIFIED BY VALUES '8B09C6075BDF2DC4' DEFAULT TABLESPACE"
    " "EXAMPLE" TEMPORARY TABLESPACE "TEMP" PASSWORD EXPIRE ACCOUNT LOCK"
    IMP-00015: following statement failed because the object already exists:
    "CREATE USER "QS_WS" IDENTIFIED BY VALUES '24ACF617DD7D8F2F' DEFAULT TABLESP"
    "ACE "EXAMPLE" TEMPORARY TABLESPACE "TEMP" PASSWORD EXPIRE ACCOUNT LOCK"
    IMP-00015: following statement failed because the object already exists:
    "CREATE USER "QS_ES" IDENTIFIED BY VALUES 'E6A6FA4BB042E3C2' DEFAULT TABLESP"
    "ACE "EXAMPLE" TEMPORARY TABLESPACE "TEMP" PASSWORD EXPIRE ACCOUNT LOCK"
    IMP-00015: following statement failed because the object already exists:
    "CREATE USER "QS_OS" IDENTIFIED BY VALUES 'FF09F3EB14AE5C26' DEFAULT TABLESP"
    "ACE "EXAMPLE" TEMPORARY TABLESPACE "TEMP" PASSWORD EXPIRE ACCOUNT LOCK"
    IMP-00015: following statement failed because the object already exists:
    "CREATE USER "QS_CBADM" IDENTIFIED BY VALUES '7C632AFB71F8D305' DEFAULT TABL"
    "ESPACE "EXAMPLE" TEMPORARY TABLESPACE "TEMP" PASSWORD EXPIRE ACCOUNT LOCK"
    IMP-00015: following statement failed because the object already exists:
    "CREATE USER "QS_CB" IDENTIFIED BY VALUES 'CF9CFACF5AE24964' DEFAULT TABLESP"
    "ACE "EXAMPLE" TEMPORARY TABLESPACE "TEMP" PASSWORD EXPIRE ACCOUNT LOCK"
    IMP-00015: following statement failed because the object already exists:
    "CREATE USER "QS_CS" IDENTIFIED BY VALUES '91A00922D8C0F146' DEFAULT TABLESP"
    "ACE "EXAMPLE" TEMPORARY TABLESPACE "TEMP" PASSWORD EXPIRE ACCOUNT LOCK"
    IMP-00015: following statement failed because the object already exists:
    "CREATE USER "SCOTT" IDENTIFIED BY VALUES 'F894844C34402B67' TEMPORARY TABLE"
    "SPACE "TEMP""
    IMP-00015: following statement failed because the object already exists:
    "CREATE USER "APITHA" IDENTIFIED BY VALUES '71B848C6F0AAC4F6' DEFAULT TABLES"
    "PACE "TESTTBS" TEMPORARY TABLESPACE "TEMP""
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "SELECT_CATALOG_ROLE""
    IMP-00015: following statement failed because the object already exists:
    "REVOKE "SELECT_CATALOG_ROLE" FROM SYSTEM"
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "EXECUTE_CATALOG_ROLE""
    IMP-00015: following statement failed because the object already exists:
    "REVOKE "EXECUTE_CATALOG_ROLE" FROM SYSTEM"
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "DELETE_CATALOG_ROLE""
    IMP-00015: following statement failed because the object already exists:
    "REVOKE "DELETE_CATALOG_ROLE" FROM SYSTEM"
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "RECOVERY_CATALOG_OWNER""
    IMP-00015: following statement failed because the object already exists:
    "REVOKE "RECOVERY_CATALOG_OWNER" FROM SYSTEM"
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "GATHER_SYSTEM_STATISTICS""
    IMP-00015: following statement failed because the object already exists:
    "REVOKE "GATHER_SYSTEM_STATISTICS" FROM SYSTEM"
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "LOGSTDBY_ADMINISTRATOR""
    IMP-00015: following statement failed because the object already exists:
    "REVOKE "LOGSTDBY_ADMINISTRATOR" FROM SYSTEM"
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "AQ_ADMINISTRATOR_ROLE""
    IMP-00015: following statement failed because the object already exists:
    "REVOKE "AQ_ADMINISTRATOR_ROLE" FROM SYSTEM"
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "AQ_USER_ROLE""
    IMP-00015: following statement failed because the object already exists:
    "REVOKE "AQ_USER_ROLE" FROM SYSTEM"
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "GLOBAL_AQ_USER_ROLE" IDENTIFIED GLOBALLY "
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "OEM_MONITOR""
    IMP-00015: following statement failed because the object already exists:
    "REVOKE "OEM_MONITOR" FROM SYSTEM"
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "HS_ADMIN_ROLE""
    IMP-00015: following statement failed because the object already exists:
    "REVOKE "HS_ADMIN_ROLE" FROM SYSTEM"
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "WKUSER""
    IMP-00015: following statement failed because the object already exists:
    "REVOKE "WKUSER" FROM SYSTEM"
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "WM_ADMIN_ROLE""
    IMP-00015: following statement failed because the object already exists:
    "REVOKE "WM_ADMIN_ROLE" FROM SYSTEM"
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "JAVAUSERPRIV""
    IMP-00015: following statement failed because the object already exists:
    "REVOKE "JAVAUSERPRIV" FROM SYSTEM"
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "JAVAIDPRIV""
    IMP-00015: following statement failed because the object already exists:
    "REVOKE "JAVAIDPRIV" FROM SYSTEM"
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "JAVASYSPRIV""
    IMP-00015: following statement failed because the object already exists:
    "REVOKE "JAVASYSPRIV" FROM SYSTEM"
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "JAVADEBUGPRIV""
    IMP-00015: following statement failed because the object already exists:
    "REVOKE "JAVADEBUGPRIV" FROM SYSTEM"
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "EJBCLIENT""
    IMP-00015: following statement failed because the object already exists:
    "REVOKE "EJBCLIENT" FROM SYSTEM"
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "JAVA_ADMIN""
    IMP-00015: following statement failed because the object already exists:
    "REVOKE "JAVA_ADMIN" FROM SYSTEM"
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "JAVA_DEPLOY""
    IMP-00015: following statement failed because the object already exists:
    "REVOKE "JAVA_DEPLOY" FROM SYSTEM"
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "CTXAPP""
    IMP-00015: following statement failed because the object already exists:
    "REVOKE "CTXAPP" FROM SYSTEM"
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "XDBADMIN""
    IMP-00015: following statement failed because the object already exists:
    "REVOKE "XDBADMIN" FROM SYSTEM"
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "AUTHENTICATEDUSER""
    IMP-00015: following statement failed because the object already exists:
    "REVOKE "AUTHENTICATEDUSER" FROM SYSTEM"
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "OLAP_DBA""
    IMP-00015: following statement failed because the object already exists:
    "REVOKE "OLAP_DBA" FROM SYSTEM"
    IMP-00015: following statement failed because the object already exists:
    "CREATE ROLE "SALES_HISTORY_ROLE""
    IMP-00015: following statement failed because the object already exists:
    "REVOKE "SALES_HISTORY_ROLE" FROM SYSTEM"
    IMP-00017: following statement failed with ORACLE error 3113:
    "BEGIN "
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.CREATE_EVALUATIO"
    "N_CONTEXT_OBJ, 'SYS',TRUE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.CREATE_EVALUATIO"
    "N_CONTEXT_OBJ, 'DBA',TRUE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.CREATE_EVALUATIO"
    "N_CONTEXT_OBJ, 'AQ_ADMINISTRATOR_ROLE',TRUE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.CREATE_EVALUATIO"
    "N_CONTEXT_OBJ, 'MDSYS',TRUE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.CREATE_EVALUATIO"
    "N_CONTEXT_OBJ, 'CTXSYS',FALSE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.CREATE_EVALUATIO"
    "N_CONTEXT_OBJ, 'WKSYS',FALSE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.CREATE_ANY_EVALU"
    "ATION_CONTEXT, 'SYS',TRUE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.CREATE_ANY_EVALU"
    "ATION_CONTEXT, 'DBA',TRUE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.CREATE_ANY_EVALU"
    "ATION_CONTEXT, 'MDSYS',TRUE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.CREATE_ANY_EVALU"
    "ATION_CONTEXT, 'CTXSYS',FALSE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.CREATE_ANY_EVALU"
    "ATION_CONTEXT, 'WKSYS',FALSE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.ALTER_ANY_EVALUA"
    "TION_CONTEXT, 'SYS',TRUE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.ALTER_ANY_EVALUA"
    "TION_CONTEXT, 'DBA',TRUE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.ALTER_ANY_EVALUA"
    "TION_CONTEXT, 'MDSYS',TRUE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.ALTER_ANY_EVALUA"
    "TION_CONTEXT, 'CTXSYS',FALSE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.ALTER_ANY_EVALUA"
    "TION_CONTEXT, 'WKSYS',FALSE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.DROP_ANY_EVALUAT"
    "ION_CONTEXT, 'SYS',TRUE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.DROP_ANY_EVALUAT"
    "ION_CONTEXT, 'DBA',TRUE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.DROP_ANY_EVALUAT"
    "ION_CONTEXT, 'MDSYS',TRUE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.DROP_ANY_EVALUAT"
    "ION_CONTEXT, 'CTXSYS',FALSE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.DROP_ANY_EVALUAT"
    "ION_CONTEXT, 'WKSYS',FALSE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.EXECUTE_ANY_EVAL"
    "UATION_CONTEXT, 'SYS',TRUE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.EXECUTE_ANY_EVAL"
    "UATION_CONTEXT, 'DBA',TRUE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.EXECUTE_ANY_EVAL"
    "UATION_CONTEXT, 'MDSYS',TRUE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.EXECUTE_ANY_EVAL"
    "UATION_CONTEXT, 'CTXSYS',FALSE);"
    "SYS.DBMS_RULE_ADM.GRANT_SYSTEM_PRIVILEGE(SYS.DBMS_RULE_ADM.EXECUTE_ANY_EVAL"
    "UATION_CONTEXT, 'WKSYS',FALSE);"
    "COMMIT; END;"
    IMP-00003: ORACLE error 3113 encountered
    ORA-03113: end-of-file on communication channel
    IMP-00003: ORACLE error 3114 encountered
    ORA-03114: not connected to ORACLE
    How to solve this problem?
    I want to migrate whole database, it'can be?

    Hi
    I was able to find only two types of error in this.
    1)
    IMP-00015: following statement failed because the object already exists:Use ignore=y along with import because the tablespace for which it failed already exist in the database. So with ignore=y it would ignore the objects which already exist and would go to next step.
    2)
    IMP-00003: ORACLE error 1119 encounteredThis is because full export do include tablespace defination also. Since the tablespaces which it is trying to create does not exist in the system and the source database from where the exp dump was taken was Unix flavour so the file structure between them was different and as a result it was not able to create it.
    Suggestion.: Manually create the tablespace at your desired location. And then run the imp again with ignore=y
    Regards
    Anurag

  • How to clone database from backup without access to original DB

    I want to create a new database from existing backup files and rolling forward some of the archivelogs (preferably with a new name and with different directory layout).
    How can I achieve the task on a separate test server (without access to the original database)? I found a lot of sources ( e.g. http://www.oracle-base.com/articles/11g/DuplicateDatabaseUsingRMAN_11gR2.php ) but all with connection to original DB (e.g. entries in tnsanmes.ora)
    Backup runs a simple
    BACKUP DATABASE PLUS ARCHIVELOG;
    DB Version is 11.2.0.2 on Linux.

    Many thanks to your help. Finally I was able to restore the DB. The steps I used (similiarly also mentioned in some of the links above).
    1.) Copy backup (backupset, autobackup, archivelog) to the new server into directories
    /export/restore/autobackup/2012_03_01
    /export/restore/autobackup/2012_03_02
    /export/restore/archivelog/2012_03_01
    /export/restore/backupset/2012_03_01
    2.) create pfile initDBREST.ora
    DB_NAME=DBREST
    3.) Mount DB
    ORACLE_SID=DBREST; export ORACLE_SID
    sqlplus / as sysdba
    STARTUP NOMOUNT;
    4.) Connect to auxiliary DB
    ORACLE_SID=DBREST; export ORACLE_SID
    rman AUXILIARY /
    5.) Create directories for new DB for datafiles in e.g. /export/oradata/DBREST/
    6.) Duplicate DB and reset parameter if necessary (e.g. memory_max as test server is lower on RAM)
    DUPLICATE DATABASE TO DBREST
    until time "to_date('02.03.2012 15:00:00','DD.MM.YYYY hh24:mi:ss')"
    DB_FILE_NAME_CONVERT '/export/fs1/oradata/oldDB/','/export/oradata/DBREST/', '/export/fs2/oradata/oldDB/','/export/oradata/DBREST/'
    SPFILE
    SET MEMORY_TARGET '2G'
    SET MEMORY_MAX_TARGET '2G'
    SET db_recovery_file_dest '/export/oradata/'
    SET db_recovery_file_dest_size '100G'
    BACKUP LOCATION '/export/restore'
    NOFILENAMECHECK;
    7.) create temporary tablespace

  • How to edit news from DW side, html editor?

    Anybody know how to edit the news fro the DW side, html editor?

    Hi Liam,
    Thanks for the quick respond.
    No, I don't mean news template which you can import to your desktop along
    with entire site.
    Imean the content,
    since it's an html page i wish to import it to my desktop along with my
    site, edit the comtent via DW on my desktop, simply because I like to use
    the DW html editor localy and then update the BC server With "put" (on
    right pane) dream weaver editor, just like youwould do with any html page.
    I understand that in order to push live it have to be done from BC, server
    side, but this discussion is all about editing the html news page, not the
    news template, and not pushing it live. only editing it via DW editor on
    your local site.
    You did not understand my question, please allow me to try asking again.
    Thanks
    Avi Gombinsky
    917-520-7370
    On Sun, Jul 6, 2014 at 1:44 AM, Liam Dilley <[email protected]>

  • How to export database from oracle 9.2 and 10g

    Hi,
    I want export the database from oracle 9i and 10g.
    i tried like....... start button--->run--->exp--->
    then it asked password. I have no password to my local database only scott/tiger. i given this, but in one attempt window has closed.
    pls guide me how to export data.
    Thanks and regards,
    Venkat.

    I have no password to my local database only scott/tigerThen use OS authentication :
    C:\>set ORACLE_SID=<your SID>
    C:\>exp \"/ as sysdba\" <options>or change passwords, e.g.
    C:\>set ORACLE_SID=<your SID>
    C:\>sqlplus "/ as sysdba"
    SQL> alter user system identified by <new password>;

  • How connect to database from javascript

    Hello friends
    This is sudhakar, working as a developer in indian based company, present we are developing one web based application for this purpose i am creating one dynamic menu.
    my problem is:
    how can i connect to the database from javascript, for this purpose is there any configuration please reply and also send me sample code on for creating dynamic menus depending on the database values using javascript
    regards.
    sudhakar
    [email protected]

    Copy the code in to new HTML File then open the file with IE
    <html>
    <SCRIPT LANGUAGE=javascript>
    <!--
    function ConDB()
         var conn = new ActiveXObject("ADODB.Connection") ;
         var connectionstring="Provider=SQLOLEDB;Password=;User ID=;Initial Catalog=;Data Source=;"
         conn.Open(connectionstring);
         var rs = new ActiveXObject("ADODB.Recordset");
         rs.Open("SELECT * FROM YourTablename ", conn);
         rs.MoveFirst
         while(!rs.eof)
         document.write( yourtablefieldname);
         rs.movenext;
         rs.close;
         conn.close;
    }       //-->
    </SCRIPT>
    <body OnLoad="javascript:ConDB()"></body>
    </html>

  • How to edit database table in jsf

    Hi all!
    Can anyone give me some clue or link on editing database table in jsf, i have got the database table values shown using h:dataTable but i'm unable to edit and save them in database,i also want to perform jsf validation while editing so that illegal values may not be entered?
    Thanks in advance.

    Tougher than what? I suggest you try again. It is all there, including sample code, which is a lot more than you're ever going to get here. If you have a specific question, ask it. But just bleating that it's all too hard isn't going to get you anywhere, here as in life.

  • Editing MySQL Database from JTable

    Hello everyone, I would like to ask your help on how we can edit JTable cells that would be reflected into the database, or how do we change the database via a JTable.
    I have the installer of an application which I made with Java SE called FuelStation.exe
    My class files are ready for sharing along with its source files.
    I have placed it in this location in my website:
    http://www.apachevista.com/alphaprojects/runfiles/
    It is complete with full details about databases, proposed mysql embed, and so on. Please see the file and notify me at [email protected]
    Here is my sample code:
    // DisplayQueryResults.java
    // Display the contents of the Authors table in the
    // Books database.
    import java.awt.BorderLayout;
    import java.awt.event.ActionListener;
    import java.awt.event.ActionEvent;
    import java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.sql.SQLException;
    import javax.swing.JFrame;
    import javax.swing.JTextArea;
    import javax.swing.JScrollPane;
    import javax.swing.ScrollPaneConstants;
    import javax.swing.JTable;
    import javax.swing.JOptionPane;
    import javax.swing.JButton;
    import javax.swing.Box;
    import javax.swing.JInternalFrame;
    import java.util.*; // for the Bundle
    import javax.swing.event.InternalFrameEvent;
    import javax.swing.event.InternalFrameListener;
    import javax.swing.event.InternalFrameAdapter;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import javax.swing.ListSelectionModel;
    import javax.swing.event.ListSelectionEvent;
    import javax.swing.event.ListSelectionListener;
    import javax.swing.event.*; // step 1
    import javax.swing.table.TableModel; // step 1
    public class DisplayQueryResults extends JInternalFrame implements TableModelListener { // step 2
    // JDBC driver, database URL, username and password
    ResourceBundle bundle = ResourceBundle.getBundle("Accounting");
    final String JDBC_DRIVER = bundle.getString("Driver");
    final String DATABASE_URL = bundle.getString("URL");
    final String USERNAME = bundle.getString("User");
    final String PASSWORD = bundle.getString("Password");
    // default query retrieves all data from authors table
    //static final String DEFAULT_QUERY = "SELECT authors.lastName, authors.firstName, titles.title, titles.editionNumber FROM titles INNER JOIN (authorISBN INNER JOIN authors ON authorISBN.authorID=authors.authorID) ON titles.isbn=authorISBN.isbn";
    final String DEFAULT_QUERY = bundle.getString("Query");
    private ResultSetTableModel tableModel;
    private JTextArea queryArea;
    static final int xOffset = 0, yOffset = 200;
    private boolean ALLOW_COLUMN_SELECTION = false;
    private boolean ALLOW_ROW_SELECTION = true;
    // create ResultSetTableModel and GUI
    public DisplayQueryResults() {  
    super("Sales of the Day",
    true, //resizable
    true, //closable
    true, //maximizable
    false);//iconifiable
    //...Create the GUI and put it in the window...
    //Set the window's location.
    setLocation(xOffset, yOffset);
    // create ResultSetTableModel and display database table
    try {
    // create TableModel for results of query SELECT * FROM authors
    tableModel = new ResultSetTableModel(JDBC_DRIVER, DATABASE_URL,
    USERNAME, PASSWORD, DEFAULT_QUERY);
    // set up JTextArea in which user types queries
    queryArea = new JTextArea(DEFAULT_QUERY, 1, 100);
    queryArea.setWrapStyleWord(true);
    queryArea.setLineWrap(true);
    JScrollPane scrollPane = new JScrollPane(queryArea,
    ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
    ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    // set up JButton for submitting queries
    JButton submitButton = new JButton("Submit Query");
    // create Box to manage placement of queryArea and
    // submitButton in GUI
    Box box = Box.createHorizontalBox();
    box.add(scrollPane);
    box.add(submitButton);
    // create JTable delegate for tableModel
    JTable resultTable = new JTable(tableModel);
    resultTable.setFillsViewportHeight(true); // Makes the empty space heights white
    resultTable.setRowSelectionAllowed(true);
    resultTable.getModel().addTableModelListener(this); // step 3
    // place GUI components on content pane
    add(box, BorderLayout.NORTH);
    add(new JScrollPane(resultTable), BorderLayout.CENTER);
    // create event listener for submitButton
    submitButton.addActionListener(
    new ActionListener()
    // pass query to table model
    public void actionPerformed(ActionEvent event)
    // perform a new query
    try
    tableModel.setQuery(queryArea.getText());
    } // end try
    catch ( SQLException sqlException)
    JOptionPane.showMessageDialog(null,
    sqlException.getMessage(), "Database error",
    JOptionPane.ERROR_MESSAGE);
    // try to recover from invalid user query
    // by executing default query
    try {
    tableModel.setQuery(DEFAULT_QUERY);
    queryArea.setText(DEFAULT_QUERY);
    } // end try
    catch (SQLException sqlException2) {
    JOptionPane.showMessageDialog(null,
    sqlException2.getMessage(), "Database error",
    JOptionPane.ERROR_MESSAGE);
    // ensure database connection is closed
    tableModel.disconnectFromDatabase();
    System.exit(1); // terminate application
    } // end inner catch
    } // end outer catch
    } // end actionPerformed
    } // end ActionListener inner class
    ); // end call to addActionListener
    //...Then set the window size or call pack...
         setSize(750,300);
    setVisible(true); // display window
    } // end try
    catch (ClassNotFoundException classNotFound) {
    JOptionPane.showMessageDialog(null,
    "MySQL driver not found", "Driver not found",
    JOptionPane.ERROR_MESSAGE);
    System.exit(1); // terminate application
    } // end catch
    catch (SQLException sqlException) {
    JOptionPane.showMessageDialog(null, sqlException.getMessage(),
    "Database error", JOptionPane.ERROR_MESSAGE);
    // ensure database connection is closed
    tableModel.disconnectFromDatabase();
    System.exit(1); // terminate application
    } // end catch
    // dispose of window when user quits application (this overrides
    // the default of HIDE_ON_CLOSE)
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);
    // ensure database connection is closed when user quits application
    addInternalFrameListener(
    new InternalFrameAdapter() {
    // disconnect from database and exit when window has closed
    public void windowClosed(WindowEvent event) {
    tableModel.disconnectFromDatabase();
    System.exit(0);
    } // end method windowClosed
    } // end WindowAdapter inner class
    ); // end call to addWindowListener
    } // end DisplayQueryResults constructor
    public void tableChanged(TableModelEvent e) { // step 4
    int row = e.getFirstRow();
    int column = e.getColumn();
    TableModel model = (TableModel)e.getSource();
    String columnName = model.getColumnName(column);
    Object tableModel = model.getValueAt(row, column);
    // Do something with the data...
    System.out.println(tableModel);
    System.out.println("data");
    // execute application
    public static void main(String args[]) {
    new DisplayQueryResults();
    } // end main
    } // end class DisplayQueryResults
    My question is in lines 177-187:
    public void tableChanged(TableModelEvent e) { // step 4
    int row = e.getFirstRow();
    int column = e.getColumn();
    TableModel model = (TableModel)e.getSource();
    String columnName = model.getColumnName(column);
    Object tableModel = model.getValueAt(row, column);
    // Do something with the data...
    System.out.println(tableModel);
    System.out.println("data");
    Why is my listener not working or why is it not implemented when I click the cells in the JTable and why is it not reflected into the JTable or into the console?
    If this is Flash, Things can be done easily, but this is Java, and I dont know much about this language. I admit that I am new to this -intirely new.
    PS:
    When you have solved the problem, please notify me with the code that's changed
    and please share it to others if you like so.
    Best Wishes: Oliver Bob Lagumen
    Email: [email protected]
    website: www.apachevista.com
    Oliver Bob Lagumen
    Edited by: Oliverbob on Jan 24, 2008 9:03 PM

    This is a follow up on the code I have posted above.
       public void tableChanged(TableModelEvent e) { // step 4
            int row = e.getFirstRow();
            int column = e.getColumn();
            TableModel model = (TableModel)e.getSource();
            String columnName = model.getColumnName(column);
            Object tableModel = model.getValueAt(row, column);
            // Do something with the data...
            System.out.println(tableModel);
            System.out.println("data");
        }the tableChanged doesnt get called when I would click the cells. The cells are all editable, but as soon as you edit it and press enter, it snaps back to the old data.
    How do we make them editable and how do we notify java that the a cell has changed so that we can send it to the database on that specific column of that specific row?
    Thanks in advance
    Bob

  • How to 'move' databases from one server to another

    Hi there
    Here is a brief description of my assignment.
    We have two Redhat Linux 4 64-bit server where two Oracle 10.2.0.4 64-bit database are running (one on each server).
    <li>DB on server1 is using Filesystem for storage.
    <li>DB on 2nd server is using ASM.
    <li>Size of both is between 75-80GB.
    <li>I have to move both the databases to new servers (same platform) with minimum downtime.
    <li>There is no upgrade required during this move/migration. Both DBs have to be brought over as-is.
    <li>The new servers may be on VMWare - I am not sure it at the moment. But please let me know if that will make any difference.
    I would highly appreciate if someone could please provide me with some high-level guidelines to perform this move.
    Best regards

    Hi Srini
    Thank you so much for sharing the valuable URLs.
    I am reading through "Cloning An Existing Oracle10g Release 2 (10.2.0.x) RDBMS Installation Using OUI [ID 559304.1]" and I have few questions.
    <li> This MOS says:
    NOTE: This note should only be used for cloning single-instance (non-RAC) homes. It should not be used for cloning RAC, CRS or ASM homes.If that is the case, how should I clone ASM-Home?
    One of the environments that I have to migrate to a new server has ASM installed as well. And couple of oracle databases (10.2.0.5) on that server are using ASM for storage.
    <li>If were to do a fresh installation of 10gR2 RDBMS and ASM homes (on Redhat Linux 64-bit), I guess I need to contact Oracle Support (open an SR) to access the software, right?
    <li>How to check from existing installation which patches I need to download and apply to this fresh installation in order to make it same as the existing installation? "opatch lsinventory" gives me a long list of number/fixes - I don't know which patch(es) to download.
    Please advise!
    Best regards
    Edited by: user130038 on May 22, 2013 3:48 AM
    Edited by: user130038 on May 22, 2013 3:55 AM

  • How to remove text from JTable ...........

    AOA
    How to remove the text from cells of JPanel. Just to refresh the GUI.
    regards

    How to provide meaningful subject?
    The subject of this thread does not match what you are asking in the body.
    To set the value of a cell in a JTable, you can simply call setValueAt().
    Read the API to find the method parameters.

Maybe you are looking for

  • How do i back up my itunes metadata?

    I'm wondering if anybody could please help me. I've got over 25000 songs on my itunes and they're all located on my external harddrive (i cant fit them all on my computer's harddrive). I'm just worried that if anything happens to my laptop then i've

  • Problem in Service ticket

    HI all, Iam are working on CRM version 5.0, CIC webclient support package 07, we are creating a employee help desk scenario profile,for which have created a new profile by copying the standard "help desk" profile . while we creating a service ticket

  • One Line Item for More than one Ship to Party

    Dear Friends In one sales order which has only one Line Items for example P-101 qty-40 pcs. That 40pcs should shipt to my 4 ship-to-party. How I end user to do it. in one Line item in One Sales Order. Kindly Regards Arun

  • Left to right alingment issue when showing the report in arabic language

    Hi, Now am working in Arabic reports, Everything working fine, but the problem is with the alignment only. In development of report (report builder) the alignment is right to left but in pdf the alignment changed to left to right. I am using Oracle R

  • Delete everything in Sharepoint 2013 and start from a begining

    How do you delete all the settings, databases in Sharepoint 2013 and start from a begining. We have some problems that PictureURL is wrong and some other thing ain't working right. Because Sharepoint 2013 is in our test environment we would like to d