Trouble sorting a database

My program is supposed to sort a database based upon whatever key is supplied by the user. The database has 4 parts to each entry, so say the user were to enter the key as 1, the database would sort according to the first part of the entry.
As my program stands now i have key set to 1 without any user input...however I am having trouble with my sort method.
I appreciate anyone willing to take a look
import java.io.*;
import java.util.*;
public class Prog8
     final static int BIG = 16;
     final static int MAX = 4;
     static int count = 0;//# of records
     public static void main(String[] asd)
          DataBase[] dv = new DataBase[BIG];
          readArray(dv);
          System.out.println("before sort");
          printArray(dv);
          System.out.println();
          sort(dv, 2);
          System.out.println("after sort");
          printArray(dv);          
     public static void readArray(DataBase[] dv)
          String line;
          FileStringReader f = new FileStringReader("db.txt");
          DataBase db;//must be instantiated in the loop
          do
               line = f.readLine();
               if(line != null && line.trim().length() != 0)
                    db = new DataBase();
                    readRecord(line, db);
                    dv[count] = db;
                    System.out.println(line+ "|"+count);
                    count++;
          }while( line != null);                    
          System.out.println("final count "+ count);     
     public static void readRecord(String line, DataBase db)
          int j = 0;
          StringTokenizer toke = new StringTokenizer(line);
          while(toke.hasMoreTokens() )
               db.item[j] = toke.nextToken();
               j++;
     public static void printRecord( DataBase db)
          for(int k = 0; k < MAX; k++)
               System.out.print(db.item[k] + " ");
          System.out.println();
     public static void printArray(DataBase[] dv)
          for(int j = 0; j < count; j++)
//               System.out.println("j = "+j);
               printRecord(dv[j] );
     public static void sort(Comparable[] x, int key)
     boolean sorted = false;
     int n = x.length;
     Comparable Database;
     while(!sorted)
          n--;
          sorted = true;
          for(int j = 0; j < n; j++)
               if(x[j].item[key].compareTo(x[j+1].item[key])>0)
                    Database = x[j];
                    x[j] = x[j+ 1];
                    x[j+1] = Database;
                    sorted = false;
class Database
     final int MAX = 4;
String[] item = new String[MAX];
my database is:
marin gil 269972639 34
abrams rita 005456788 17
nottobe tobe 029209330 19
backus jim 379228370 23
lucky lady 039470923 57
canada oh 437983890 46
caliper surgical 457474709 18
dante ron 090229292 29
english rum 457090290 35
goto state 507348278 19
home hume 387928783 23
identity crie 236982373 56
jackson andy 109290029 36
korn cob 329480928 25
faulty tower 439287983 12
abrams sol 098337377 54
Message was edited by:
calvinisz

Hi calvin. Please try to enclose your posted code with tags.                                                                                                                                                                                               

Similar Messages

  • Trouble accessing the database

    Hi, am new to java and I am having trouble accessing my database. I have the following code
    import java.sql.Connection;
    import java.sql.Driver;
    import java.sql.DriverManager;
    import java.sql.PreparedStatement;
    import java.sql.CallableStatement;
    import java.sql.ResultSet;
    private static boolean verifyInDB(String username, String password){
    boolean allow = false;
    try {
    Driver d =(Driver)Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    conn = DriverManager.getConnection("jdbc:odbc:SITSDB");
    queryStr = "SELECT username,\"password\" FROM WebAppUsers WHERE username=" + "'" + username + "'" + "AND password=" + "'"+ password + "'" + "AND archive = 'no'";
    myQuery = conn.prepareCall(queryStr);
    //myQuery.setString(1, username);
    //myQuery.setString(2, password);
    rs = myQuery.executeQuery();
    if(rs.next())
    allow = true;
    catch (Exception e) {
    System.out.println("Login::verifyInDB: Error Getting Connection: " + e.toString());
    System.out.println("Login::verifyInDB: QUERY: " + queryStr);
    e.printStackTrace();
    finally{closeConn();}
    return allow;
    I'm almost positive the code it is right however I get an error trying to connect to the database
    Login::verifyInDB: Error Getting Connection: java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'WebAppUsers'.
    Login::verifyInDB: QUERY: SELECT username,"password" FROM WebAppUsers WHERE username='akabeera'AND password='avenash'AND archive = 'no'
    java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'WebAppUsers'.
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
    at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
    at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3150)
    at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute( JdbcOdbcPreparedStatement.java:214)
    at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeQuery( JdbcOdbcPreparedStatement.java:89)
    at com.siac.ManagementReports.Login.verifyInDB(Login.java:43)
    at com.siac.ManagementReports.Login.verify(Login.java:27)
    at org.apache.jsp.doLogin_jsp._jspService(doLogin_jsp.java:60)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
    any suggestions is much appreciated
    Message was edited by:
    ssj_100

    To be clear when you say the command works in query analyzer. Is this the exact string that you are running in query analyzer?
    SELECT username,"password" FROM WebAppUsers WHERE username='akabeera'AND password='avenash'AND archive = 'no'This exact string (the SELECT) looks syntactically incorrect to me, but that doesn't mean your database SQL parser cannot handle it I guess (lack of spaces between quotes keywords), and I'm not sure about the double quotes, but I'm kind of an Oracle guy and all of this could be OK, it just seems messy if nothing else.
    I would recommend using first, a type 4 driver if at all possible (not the JDBC/ODBC bridge), and second To avoid much of this messiness, you should whenever possible use a PreparedStatement rather then Statement for this type (and most types) of queries.

  • Trouble sorting my music in a playlist on my iPhone 5s IOS 8 software.

    Trouble sorting my music in a playlist on my iPhone 5s IOS 8 software.

    You will need to be a little more specific. Can you provide a little more detail? What kind of playlist. What exactly are you trying to do?

  • Sort+logical database using field group and extract

    Hi Folks,
    I have a program which is using Logical database concept and creating a file on application server as below.
    SORT BY
        reguh-zbukr                        "Zahlender Buchungskreis
        reguh-rzawe                        "Payment method
        reguh-ubnks                        "Bankland unserer Bank
        reguh-ubnky                        "Bankkey zur Übersortierung
        reguh-ubnkl                        "Bankleitzahl unserer Bank
        reguh-ubknt                        "Kontonummer bei unserer Bank
        payment_form                       "Brazil: CC, DOC or OP
        regud-xeinz                        "X - Lastschrift
        reguh-zbnks                        "Bankland Zahlungsempfänger
        reguh-zbnky                        "Bankkey zur Übersortierung
        reguh-zbnkl                        "Bankleitzahl Zahlungsempfänger
        reguh-zbnkn                        "Bank-Ktonummer Zahlungsempfänger
        reguh-lifnr                        "Kreditorennummer
        reguh-kunnr                        "Debitorennummer
        reguh-empfg                        "Zahlungsempfänger CPD
        reguh-vblnr                        "Zahlungsbelegnummer
        regup-belnr.  
    LOOP.
    AT NEW reguh-rzawe
    PERFORM store_on_file USING j_1bh1.
    ENDAT
    AT NEW reguh-ubnkl
    PERFORM store_on_file USING j_1bh2.
    ENDAT
    AT NEW reguh-ubnkt
    PERFORM store_on_file USING j_1bh2.
    ENDAT
    AT NEW VBLNR
    PERFORM store_on_file USING j_1bh3.
    AT DATEN
    PERFORM store_on_file USING j_1bh4.
    ENDAT.
    ENDLOOP.
    FORM store_on_file USING daten.
      IF hlp_temse CA par_dtyp.            "Temse
        PERFORM temse_schreiben USING daten.
      ELSE.
        TRANSFER daten TO g_name.
      ENDIF.
    ENDFORM.
    Is Sorting concept different when it comes to logical databases and field groups ?
    I had added a new field in the sort reguh-rzawe.I think due to that it is getting into AT NEW UBNKL and AT NEW UBKNT even though those details are same for the payment methods in the payment run.Even though the house bank number and account number is same for all the payment methods it is getting into AT NEW UBNKL and AT NEW UBKNT for every new payment method in the iteration.
    vblnr-1
    rzawe- A
    ubnkl-12345
    ubnkt-45678
    vblnr-2
    rzawe- A
    ubnkl-12345
    ubnkt-45678
    vblnr-3
    rzawe- B
    ubnkl-12345
    ubnkt-45678
    vblnr-4
    rzawe- B
    ubnkl-12345
    ubnkt-45678
    Can anyone here throw some light on this.
    Thanks,
    K.Kiran.

    Read the documentation for the at-new process.  As I recall the at-new considers the field named, and all the fields to the left of that in the table.  With that in mind, look at how your logic will work.  This could result in more, or fewer, breaks than intended(fewer if, for instance, a field to the left was deleted).

  • Trouble for opening database

    Hi,
    I installed ora cle 10g database on windows XP.Iopened database and perform some operations two days.But now iam facing trouble to start my database and per form recovery.
    while start up Iam getting the following info.
    Enterprise Manager is not able to connect to the database instance
    ORA-28000: the account is locked (DBD ERROR: OCISessionBegin.)

    Hi,
    Can you login to the database using any other user which has a dba privilege?
    If yes login through that user and unlock the user which is getting this error.
    With which user are you trying to access OEM?
    If everything fails for you
    sqlplus / as sysdba
    alter user <userid> account unlock;Regards
    Anurag

  • Trouble doing a database upgrade test for SCCM upgrade from SP1 to SP2

    I'm trying to do this test and am having trouble.  I'm following the instructions in
    http://technet.microsoft.com/en-us/library/bb693648.aspx.  However when I enter the command at a command prompt: setup /testdbupgrade e:\database test\sms_hlb_new I get the message: The setup command line option is not valid on this computer. 
    Any help anyone can provide to get around this problem would be appreciated.  I'm not a SQL admin and haven't done an SCCM upgrade before so any tips for a newbie would be great.  Thanks!

    The procedures are basically the same. You can even attach a copy of the database where ConfigMgr is runnig on (be careful to not /testupgrade the wrong one then). You cannot provide a command line parameter to point to a remote SQL server, but you can
    start setup.exe on any machine (so local to the SQL where the copy of the DP is)Torsten Meringer | http://www.mssccmfaq.de

  • Trouble with ASA9 database

    Hi,
    We've got an ASA9 database that started causing us some trouble yesterday. It appears to not allow any connections to be made to it. Doesn't give any return messages, it just hangs at the client level and never does anything. The service window looks normal. Says the server is started normally, as well as the sharedmemory link, namedpipes link and TCPIP link. Starts on the port and says that it is now accepting requests. Try to connect through our application, scjview, dbisql, dbvalid, etc. all just hang with no response. Go to stop the service, and it just hangs as well. Have to kill all of the processes.
    Had IT get me the backup, and it had the same problem. Had to go back 3 days to get a backup that would actually start and allow connections. I ended up translating the log and applying the sql to the last good backup in order to get us running again. Ran dbvalid against the database and nothing was found to be wrong.
    I'm concerned that there is something else going on. Has anyone seen anything similar? Any thoughts on what the issue could be?
    Thanks!
    John

    Hi John,
    Assuming you still have a copy of the database that hangs, could you try starting it with request level logging enabled?
    dbsrv9 -z -zr ALL -zo C:\path\to\file.txt database.db
    As well as connecting with a client log:
    dbisql -c "UID=DBA;PWD=sql;ENG=database;LOG=C:\path\to\file2.txt"
    Which operating system are you running the server on?
    Thanks,
    Mikel

  • Having Trouble Linking mySQL Database to Website

    I am considering a move of all my websites into Azure and setup a test account this afternoon with the free trial.  I've been able to setup the website; however, I'm having issues with the creation - more specifically the linkage - of a MySQL database
    to the site.  I've tried to link the database in a number of ways including both the existing and preview portals in addition to trying to create the new resource instead of linking. In each scenario the database is created but the linkage fails. 
    The message I keep getting is:
    Could not link resource '>DB Name>' to web site '<Site Name>'.
    Am I doing something wrong?

    hi sir,
    Thanks for you posting!
    Firstly, please make sure your MySQL database in host on Azure, not in your project.
    Secondly, if your database is create on Azure, I suggest you could try those step:
    1.delete the entire website
    2.create a new website and select add the existing MySQL database as a Linked Resource .
    Also, please see this similar issue post:
    http://stackoverflow.com/a/12198776
    Regards,
    Will
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Trouble accessing a database in a deployed application

    I am having difficulty accessing a database on a deployed application.  I am using LV2009, and Windows XP.    I am interfacing with the database via ODBC.  The database is located in the "Shared Documents" folder.  I have no problem accessing the database when logged in as the administrator, but when i use the production login I cannot get to it (I can see it in explorer).  I have given the production login administrative privileges and still cannot access it.  I can save a notepad file to that folder when using the production login.  What do I not have set properly in the database setup?
    Thanks in advance.
    Jim
    Jim
    LV 2013

    Sorry I got the error code mixed up!
    // MessageId: DB_E_CANCELED
    // MessageText:
    //  Operation was canceled.
    #define DB_E_CANCELED                    ((HRESULT)0x80040E4EL)
    This would indicate that there was some operation like a login dialog or similar that was canceled. It could be that you have assigned a username and passowrd in Access to the database file. In that case you do need to specify the correct username and password in the DSN connection settings otherwise the ADO/ODBC driver wants to prompt you with a dialog for this information, but this has to be enabled with the "prompt? (f)" input to the DB Open Connection method. If that parameter is false, all the ADO library can do is to abort the connection.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • Trouble with access database online

    Hello everyone,
    I created an applet that simply inserts data into an access database and then prints it out on the screen the sql insert statement.
    I signed the applet so I can trust it so I wont get any security errors.
    When I upload it to the site it shows the correct insert statement because the primary key auto increments and displays on the screen. I don't get any SQLException errors or SecurityException errors so I assume it is working.
    When I download my database and look at it I dont see the data inserted into it. But when I see it in my browser it displays the insert statement with the primary key so I am really confused.
    I tried in internet explorer and firefox and made sure I cleared my cache. Is there any possible thing that I missed as to why it gets the auto-increment primary key and doesnt get caught in the try catch but when I look at the database I don't see anything.
    Any help would be great.
    Thanks

    Thanks for the advice but this does not really help
    my situation.
    Well it does in that it is not "advice" it is a statement of fact and so it does help you in that you shouldn't waste time pursuing that.
    The reason is, as you are already seeing, that when you update the Access database in your applet you are only actually updating the local copy (downloaded by the Applet) not the copy of the file on the server. So you can make all the changes you want but won't see them.
    I could send data through a url and then program an
    asp page to handle the database stuff.Yes that would be a better way all around.
    >
    If you cant help me with doing the sql in the appletIt's not that I can't help you. It's that is impossible. If you chose another database that was a server it would be possible.
    I mean I can help but I cannot do the impossible.
    can you help me on sending data through a url in a
    java applet.
    Yes. Use the HttpURLConnection class to do what you want. You can send it by GET (aka ASP Request.QueryString) or by POST (aka ASP Request.Form).
    This tutorial shows you how http://java.sun.com/docs/books/tutorial/networking/urls/index.html

  • Trouble creating a database in MySQL using java

    Hi all,
    I am trying to create a program that connects to MySQL and can create databases, tables etc. I can connect to MySQL using the program but I cannot create a database (however if i create the database with the command line i can create tables in the database).
    When I try to create a database i get the error
    com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown database 'persondatabase'Here is the code:
    import java.sql.*;
    class Connect {
    public Connect() {
    public Connection connectToMySQL(String database_name) {
      Connection con = null;
      try {
       Class.forName("com.mysql.jdbc.Driver").newInstance();
       con = DriverManager.getConnection("jdbc:mysql:///persondatabase", "", "");
      catch(ClassNotFoundException e) { System.out.println(e); }
      catch(InstantiationException e) { System.out.println(e); }
      catch(SQLException e) { System.out.println(e); }
      finally {
       return con;
    public void createDatabase(String database_name) {
      Connection con = null;
      Statement stmt = null;
      try {
       con = connectToMySQL(null);  //connect to mysql but not to any one databases
       con.setAutoCommit(false);
       if(!con.isClosed())
        System.out.println("Connected to MySQL. Creating the Database " + database_name);
       String str = "CREATE DATABASE " + database_name;
       stmt = con.createStatement();
       stmt.executeUpdate(str);
       con.commit();
      catch (Exception e2) { }
      finally {
       try {
        stmt.close();
        con.close();
       }catch (Exception e3) { }
    public void createPersonDetailsTable(String database_name, String table_name) {
      Connection con = null;
      Statement stmt = null;
      try {
       con = connectToMySQL(database_name);
       con.setAutoCommit(false);
       if(!con.isClosed())
        System.out.println("Connected to " + database_name + " creating the table " + table_name);
       String str = "CREATE TABLE " + table_name + "(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, first_name VARCHAR(25), last_name VARCHAR(25), address VARCHAR(40), suburb VARCHAR(20), state VARCHAR(3), post_code INT(1), contact_number INT(10), email_address VARCHAR(40));";
       stmt = con.createStatement();
       stmt.executeUpdate(str);
       con.commit();
      catch (Exception e2) { System.out.println(e2); }
      finally {
       try {
        stmt.close();
        con.close();
       }catch (Exception e3) {  }
    }I am wondering if anyone can see where im going wrong? I am currently connecting with an anon account to MySQL.
    Here is the program I am using to test the above:
    class ConnectionTester {
    public ConnectionTester() {
      Connect s = new Connect();
      s.createDatabase("PersonDatabase");  //this throws the error
      //s.createPersonDetailsTable("PersonDatabase", "PersonDetails");
    public static void main(String[] arg) {
      ConnectionTester start = new ConnectionTester();
    }

    you should rethink whether you need to create a database using java. personally i think it's a bad idea. your database should exist and the schema should be ready to go when your app starts. why do you think you need to create one?
    %

  • Problem : SELECT from LTAP table takes much time (Sort in Database layer)

    Guys,
    Im having problem with this select statement. It takes much time just to get single record.
    The problem is with accessing the LTAP table and the ORDER BY DESCENDING statement.
    The objective of this select statement is to get the non blocked storage bin which is used by latest transfer order number.
    If the latest transfer order no storage bin is blocked, then it will loop and get the 2nd latest transfer order no's storage bin and
    checks whether it blocked or not. It will keep looping.
    The secondary index has been created but the it still taking much time (3 minutes for 10K records in LTAP)
    Secondary Indexes:
    a) LTAP_M ->MANDTLGNUM PQUIT MATNR
    b)LTAP_L  ->LGNUM PQUIT VLTYP VLPLA
    Below is the coding.
    ******************Start of DEVK9A14JW**************************
        SELECT ltaptanum ltapnlpla ltap~wdatu INTO (ltap-tanum, ltap-nlpla, ltap-wdatu)
              UP TO 1 ROWS
              FROM ltap INNER JOIN lagp                         "DEVK9A15OA
              ON lagplgnum =  ltaplgnum
              AND lagplgtyp =  ltapnltyp
              AND lagplgpla =  ltapnlpla
                WHERE lagp~skzue = ' '
                AND ltap~pquit = 'X'
                AND ltap~matnr = ls_9001_scrn-matnr
                AND ltap~lgort = ls_9001_scrn-to_lgort
                AND ltap~lgnum = ls_9001_scrn-lgnum
                AND ltap~nltyp = ls_9001_scrn-nltyp
          ORDER BY tanum DESCENDING.
         ENDSELECT.
        IF sy-subrc EQ 0.
          ls_9001_scrn-nlpla = ltap-nlpla.
          EXIT.
        ENDIF.
    ******************End of DEVK9A14JW**************************

    > Im having problem with this select statement. It takes much time just to get single record.
    This is not true. Together with the ORDER BY the UP TO 1 ROWS does not read 1 record but prepare all records, orders them and return one record, i.e. the largest in sort order.
    You must check what you need, either you need the largest record, then this can be your only possible solution.
    If you need only one recoird then the ORDER BY does not make sense.
    If you need the single largest record, then sometimes the aggregate function MAX can be an alternative.
    I did not look at the index support, this can always be a problem.
    Siegfried

  • Trouble connect MySql database on cluster

    Dear Friends
    I am trying to connect the MySql database on our cluster which have ROCKS cluster ebvironment on it. My code is just a test code to connect to the "test" database and i got fallowing exception
    Exception: Data source rejected establishment of connection, message from server: "Host 'chemdynm.chem.ttu.edu' is not allowed to connect to this MySQL server"
    Can anybody help me on this problem.My test code is as fallows
    Thanks
    Nav
    import java.sql.*;
    public class dbtest
         public static void main(String[] args)
         Connection con = null;
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    con = DriverManager.getConnection("jdbc:mysql://chemdynm.chem.ttu.edu/test",
    "root", "secret");
    if(!con.isClosed())
    System.out.println("Successfully connected to " +
    "MySQL server using TCP/IP...");
    } catch(Exception e) {
    System.err.println("Exception: " + e.getMessage());
    } finally {
    try {
    if(con != null)
    con.close();
    } catch(SQLException e) {
              System.out.println("here is the problem " +e);

    Read the MySQL documentation about how to set up permissions. Not only do you have to declare permissions for each user ID, you also have to declare permissions for the hosts they may connect from. This is nothing to do with Java or JDBC.

  • Trouble sorting in alpha-numeric order

    Can someone please help me figure out why iPhoto doesn't know how to sort things alpha-numerically by title?
    For example, I am importing photos from my hard drive. Numbers go 1-200 as they should. However when I get into iphoto (set to sort by title), iphoto decides to go 1, 10, 100, 2, 20, 200, 3, 30, etc. Its very annoying since they are no longer in the right order. 1 should be next to 2, not 10. Computers have been ordering things in number order for ages, why is iPhoto so confused?
    Are there different settings that will import things properly. I know if I was using albums, I could make sure the album is set to sort "manually" prior to importing. Then they will be in their original order. I can't do that when just importing into iphoto/events as far as I know.
    Any suggestions?

    iPhoto sorts jsut fine - soem human had mis-names the photos
    "space" "space" 1 does not sort Alpha-Numerically to the same place a 001 - nor does 1 sort the same as 001
    An Alpha Numeric sort considers both Alphabetic and Numeric characters and therefore if you want the sort to match your expectiations then you need to be sure the characters you are sorting on are correct - the conmputer can not read yoru mind and see that you do not really want an alpha-numeric sort after all
    LN

  • Trouble updating the database

    Hi,
    I using java studio creator 2 update 1. I have two pages. The first page contains a table with hyperlinks in serial_no column. When the user clicks on a hyperlink(serial_no) it redirects to another page which displays the details of the product that can be edited as drop down lists and text areas. I am not able to update the database with the edited values. I have been struggling with this since a week. Please help me. The code in the second page is as follows
    public void prerender() {
    serialNo = (String)getExternalContext().getRequestParameterMap().get("SerialNo");
    try
    getSessionBean1().getTblSampleRowSet4().setCommand("select Username, Problem_Type, Priority , Enhancement, Time, Source_req, Assigned_To,substring_index(Comment,'<END>',-1) as 'userComment', Solution, serial_no from tblSample where serial_no = " + serialNo);
    stUserName.setText(getSessionBean1().getTblSampleRowSet4().getString("Username"));
    ddlProblemType.setSelected(getSessionBean1().getTblSampleRowSet4().getString("Problem_Type"));
    String priority = getSessionBean1().getTblSampeRowSet4().getString("Priority");
    outputText1.setValue(priority);
    ddlPriority.setSelected(getSessionBean1().getTblSampleRowSet4().getString("Priority"));
    // ddlp.setSelected(getSessionBean1().getTblSampleRowSet4().getString("Priority"));
    ddlEnhancement.setSelected(getSessionBean1().getTblSampleRowSet4().getString("Enhancement"));
    ddlTime.setSelected(getSessionBean1().getTblSampleRowSet4().getString("Time"));
    ddlSourceReq.setSelected(getSessionBean1().getTblSampleRowSet4().getString("Source_req"));
    ddlAssignedTo.setSelected(getSessionBean1().getTblSampleRowSet4().getString("Assigned_To"));
    taSolution.setText(getSessionBean1().getTblSampleRowSet4().getString("Solution"));
    taUserComment.setText(getSessionBean1().getTblSampleRowSet4().getString("userComment"));
    catch(Exception e)
    * <p>Callback method that is called after rendering is completed for
    * this request, if <code>init()</code> was called (regardless of whether
    * or not this was the page that was actually rendered). Customize this
    * method to release resources acquired in the <code>init()</code>,
    * <code>preprocess()</code>, or <code>prerender()</code> methods (or
    * acquired during execution of an event handler).</p>
    public void destroy() {
    tblSampleDataProvider4.close();
    // tblSampleDataProvider.close();
    public String btnSave_action() {
    // TODO: Process the button click action. Return value is a navigation
    // case name where null will return to the same page.
    try {
    tblSampleDataProvider4.setValue("tblSample.Problem_Type", ddlProblemType.getSelected());
    tblSampleDataProvider4.setValue("tblSample.Priority", ddlPriority.getSelected());
    tblSampleDataProvider4.setValue("tblSample.Enhancement", ddlEnhancement.getSelected());
    tblSampleDataProvider4.setValue("tblSample.Time", ddlTime.getSelected());
    tblSampleDataProvider4.setValue("tblSample.Source_req", ddlSourceReq.getSelected());
    tblSampleDataProvider4.setValue("tblSample.Assigned_To",ddlAssignedTo.getSelected());
    tblSampleDataProvider4.setValue("tblSample.Comment",taUserComment.getText());
    tblSampleDataProvider4.setValue("tblSample.Solution", taSolution.getText());
    tblSampleDataProvider4.commitChanges();
    tblSampleDataProvider4.refresh();
    } catch (Exception ex) {
    outputText1.setValue("error");
    return null;
    If i use
    getSessionBean1().getTblSampleRowSet4().execute(); after setting the command, it doesnt work. But if i comment it out, data corresponding to the serial no passes gets displayed. But I am not able to update the table with edited data.
    S

    Just a quick comment--
    You won't need rowset.getString(..) and dataprovider.setValue(...) if you bind the components and it could make it much simpler.
    There's a step by step tutorial on how to achieve this:
    http://developers.sun.com/prodtech/javatools/jscreator/learning/tutorials/2/inserts_updates_deletes.html
    If you can zip up the Project and email to me at CreatorFeedback AT sun DOT com, i can take a quick look at it. I would need your schema/SQL script as well.
    HTH,
    Sakthi

Maybe you are looking for

  • Please reply ASAP-Discoverer and BI Publisher

    Hi, Could some one please list the pros and cons from switching from Discoverer to BI Publisher? I know it seems kinda vague but anything you have experienced would be helpful. New to both tools at this moment. Thanks so much!

  • Append Spool to PDF

    Hi I have a requirement to download the report(Customer Credit Limit Change) as a PDF file. I'm calling that report for every customer using SUBMIT in another Z program. So for every customer it is creating a PDF file. I did this using FMs CONVERT_AB

  • Can I use a BlackBerry Playbook with iMovie?

    Hello: Although I reckon I'm going to have to spend quite some familiarising myself with iMovie before making any serious attempts at recording/uploading,etc, I would like to know if I can use thr video- recording  facility that's part of a BlackBerr

  • On receiving jpegs via email, sometimes they get corrupted, and there are horizontal blocks appearing on the image

    On receiving jpegs via email, sometimes they get corrupted, and there are horizontal blocks appearing on the image that distort the image. Help???

  • Asset and expense

    Dear all, May I know what is the reason want to capitalise the asset cost instead of expense it immediately when purchase? thanks