CachedRowSet

I am new to java but I am trying to use a CachedRowSet. I have downloaded the jdbc2_0-stdext-src.zip file and extracted the files and have installed JavaTM 2 SDK, Enterprise Edition 1.3.1 but my IDE (NetBeans IDE 3.4.1) is complaining that the "import sun.jdbc.rowset.*;" package does not exist and it appears that that is what is missing, (It doesn't appear in the java hiearchy either), and that it cannot resolve symbol CachedRowSet. Can you give me any hints as to why it may be doing this
import java.sql.*;
import java.io.*;
import javax.sql.RowSet.*;
import sun.jdbc.rowset.*;
class DBConnect
Connection con;
Statement statement;
private static String dbName = null;
private static String dbPass = null;
int nCtry = 0;
int sites[];
String sPages[];
boolean DBConnect()
String sURL;
// This is a test comment.
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
sURL = "jdbc:odbc:TestDB";
con = DriverManager.getConnection(sURL, dbName, dbPass);
statement = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
return true;
catch (ClassNotFoundException e)
System.err.println(e);
return false;
catch (SQLException sqle)
System.err.println(sqle);
return false;
void getCountries(int dbCtryID[])
int nCtry = 0;
String ssql = "SELECT country_id, active FROM sites WHERE active = True;";
try
CachedRowSet cacheRS = new CachedRowSet();
Thanks in advance
Lyell

Hi,
The jdbc2_0-stdext-src.zip fileyou are using does contain the classes that implement cachedrowset features.
you need to download jar from http://developer.java.sun.com/developer/earlyAccess/crs/
Its a zip file rowset-1_0-ea4.zip .Extract rowset.jar file from that zip file.
Mount rowset.jar in your netbeans IDE.(To mount right click the filesystem node,select archive files,select the rowset.jar file)
Hope this helps.

Similar Messages

  • CachedRowSet displaying 5 records at a time

    hi all,
    Iam working on CachedRowSet is it possible to records in groups of 5 from a whole lot of 100 records?? pls let me know...
    thanks in advance
    Karthik

    <Statement>.setMaxRows(5);

  • Error while running CachedRowSet Example

    I am getting the following error when I try to the CachedRowSet example. Any help would would be greatly appreciated.
    ERROR:
    Request URI:/test548_html/untitled2.jsp
    Exception:
    java.lang.NoClassDefFoundError: javax/naming/Referenceable
    CODE EXAMPLE AS IN JSP DEVELOPERS GUIDE:
    <%@ page import="java.sql.*, javax.sql.*, oracle.jdbc.pool.*" %>
    <!------------------------------------------------------------------
    * This is a JavaServer Page that uses Connection Caching at Session
    * scope.
    --------------------------------------------------------------------!>
    <jsp:useBean id="ods" class="oracle.jdbc.pool.OracleConnectionCacheImpl"
    scope="session" />
    <HTML>
    <HEAD>
    <TITLE>
    ConnCache 3 JSP
    </TITLE>
    </HEAD>
    <BODY BGCOLOR=EOFFFO>
    <H1> Hello
    <%= (request.getRemoteUser() != null? ", " + request.getRemoteUser() : "") %>
    ! I am Connection Caching JSP.
    </H1>
    <HR>
    <B> Session Level Connection Caching.
    </B>
    <P>
    <%
    try {
    ods.setURL((String)session.getValue("connStr"));
    ods.setUser("scott");
    ods.setPassword("tiger");
    Connection conn = ods.getConnection ();
    Statement stmt = conn.createStatement ();
    ResultSet rset = stmt.executeQuery ("SELECT ename, sal " +
    "FROM scott.emp ORDER BY ename");
    if (rset.next()) {
    %>
    <TABLE BORDER=1 BGCOLOR="C0C0C0">
    <TH WIDTH=200 BGCOLOR="white"> <I>Employee Name</I> </TH>
    <TH WIDTH=100 BGCOLOR="white"> <I>Salary</I> </TH>
    <TR> <TD ALIGN=CENTER> <%= rset.getString(1) %> </TD>
    <TD ALIGN=CENTER> $<%= rset.getDouble(2) %> </TD>
    </TR>
    <% while (rset.next()) {
    %>
    <TR> <TD ALIGN=CENTER> <%= rset.getString(1) %> </TD>
    <TD ALIGN=CENTER> $<%= rset.getDouble(2) %> </TD>
    </TR>
    <% }
    %>
    </TABLE>
    <% }
    else {
    %>
    <P> Sorry, the query returned no rows! </P>
    <%
    rset.close();
    stmt.close();
    conn.close(); // Put the Connection Back into the Pool
    } catch (SQLException e) {
    out.println("<P>" + "There was an error doing the query:");
    out.println ("<PRE>" + e + "</PRE> \n <P>");
    %>
    </BODY>
    </HTML>
    null

    Hi,
    Goto Project Properties:
    Search for the following in left pane:
    Oracle Applications -> Runtime Connection
    DBC file : Choose the correct dbc file from your local machine. You have to get it from your dba and paste it in this path: jdevhome\jdev\dbc_files\secure\*.dbc
    User Name: Application User Name
    Password : Application password
    Responsibilty Key:
    Goto Application Developer --> Responsibility --> Define -- >
    Query for the available responsibility for the given user. Say for example: "Order Management Super User"
    Application: Order Management
    Responsibilty Key: ORDER_MGMT_SUPER_USER
    Application Short Name:
    Goto Application Developer --> Application --> Register -- >
    Query for the given application " Order Management"
    Short Name: ONT
    Responsibility Key and Application Short Name depends upon the object you are developing.
    Regards.

  • Maximum Open Cursors with the CachedRowSet

    Hi all,
    I have a simple task that is cause significant headaches. I'm using the CachedRowSet to process records from an Oracle 8.1.6 database. The code simply populates the row set with records, makes changes to 2 or 3 fields in each record, then calls the acceptChanges().
    When I process about 200 records, everything works fine. If I try to process 300 records, I get the error
    "ORA-01000: maximum open cursors exceded".
    Right before the acceptChanges is called, there is only 1 cursor opened ( I'm checking this via the V$OPEN_CURSOR table). After the acceptChanges is called, it throws the error. Inside my catch block, I put a loop in to print the open cursors. All but two of them is from my app and showing the exact same SQL, update table set name ....
    I have tried populating it directly and through a ResultSet, neither work. When I do a similar process using a ResultSet by itself, it is fine.
    If anyone could please suggest what I might be overlooking I would appreciate it. Also, I would also like to know if there is someway to examine the specific SQL that is being sent to the database if possible.

    we've had similar problems with Oracle creating and not destroying its own cursors("under the covers"). There is relevant info at the following link:
    http://forums.java.sun.com/thread.jsp?forum=48&thread=135291
    quick checklist:
    1. close all statements/preparedstatements/resultsets explicitly and immediately after you are finished with them
    2. increase your number of open_cursors in init.ora file
    -->we had to increase ours to over 700 at one point.
    3. commit/rollback explicitly when finished transactions.
    hope this helps
    Jamie

  • Invalid Cursor Position Error on Windows XP using CachedRowSet

    Hello, I don't know if this question lies here, but I thought it would be the well suited place so please pardon me if it isn't. I am trying to access multiple pages from my database on my XP machine but I am getting an "invalid cursor position" error when trying to access the next page. I don't know how this error is coming about because it works well on a Vista machine with no errors. I don't know if it is my drivers or something that brings about the problem. I am using mysql connecter 5.1.10, JRE 1.6.0_02 and windows XP SP2
    Below is a simple code that brings the error.
    package Admin; import javax.sql.rowset.CachedRowSet; import com.sun.rowset.CachedRowSetImpl; public class test { public void table() { try { CachedRowSet crs=new CachedRowSetImpl(); crs.setUrl("jdbc:mysql://host:3306/database");         crs.setUsername("User");         crs.setPassword("password"); crs.setCommand("select * from myTable"); int[] keys = {1}; crs.setKeyColumns(keys); crs.execute(); crs.last(); if(crs.getRow()>500){ //new overLimit(); } crs.setPageSize(3); crs.execute(); while (crs.next()) { System.out.print("page one----"); System.out.println(crs.getString(1)); } while(crs.nextPage()){ System.out.println("page two---"); while (crs.next()) { System.out.println("in page two"); System.out.println(crs.getString(1)); } } } catch (Exception e) { e.printStackTrace(); } } public static void main(String []args){ new test().table(); } }

    Yes I am running the same code on both machines. The output I get on the XP machine is shown below. I modified the code I posted earlier and replaced the "page two" text with "page (then page number)" and also omitted the "in page two" text for better readability---------PAGE 0---------
    DB09140110
    DU35463010
    EX29201810
    ---------PAGE 1---------
    EX38341510
    EX40471810
    KZ280299
    ----------PAGE 2---------
    LA130299
    LC130299
    MC081009
    ----------PAGE 3---------
    RZ300502
    VA130299
    VI020209
    ----------PAGE 4---------
    YX101008
    ZE220299
    ZF231105and vista....
    ----------PAGE 0---------
    EX38341510
    EX40471810
    KZ280299
    ----------PAGE 1---------
    LA130299
    LC130299
    MC081009
    ----------PAGE 2---------
    RZ300502
    VA130299
    VI020209
    ----------PAGE 3---------
    YX101008
    ZE220299
    ZF231105

  • Problem when perform acceptChanges method on CachedRowset twice

    Hi,
    i'm using a CachedRowSet in my application.
    All goes fine, when i retrieve data from database. But when i'm trying to update my data more than once, a SyncProviderException occur.
    This is my code:
    crset.updateRow();
    crset.acceptChanges(DBProperties.getInstance().getConn());
    crset.updateString("first_name", "new val");
    crset.updateRow();
    crset.acceptChanges(DBProperties.getInstance().getConn());
    The first call of acceptChanges work fine, but the second call to the same method throw a SyncProviderException.
    What's wrong with this code?
    Message was edited by:
    zorgz

    >
    How Can I loop through a piece of code, as if I am running that code for the first time. (i.e. How can I clear all the variables and data and start a new clean instance).
    >
    Simple - the scope of variables is limited to the block that the variable is in
    1. define a new block for that piece of code using { and }.
    2. inside the block reinitialize the variables that the code in the block uses
    3. don't use any variables that are NOT initialized at the start of the block
    This sample code should show you the concept. It has a variable 'j' that is used outside the block to contain the loop iteration number and is used inside the block to contain the value 47.
    Note that setting the variable to 47 inside the block has no effect on the value that was set outside the block.
    public class Test3 {
        public static void main(String[] args) {
            for (int i = 0; i < 5; i++)
                int j;
                j = i;
                System.err.println("Outside j = " + j);
                {   // this begins a new block
                    j = 47;  // initialize ALL variables used inside the block here - don't use ANY vars that are not initialized at the block start
                    System.err.println("Inside j = " + j);
                }   // this ends the new block - the 'inside' value of 'j' no longer exists
    Outside j = 0
    Inside j = 47
    Outside j = 1
    Inside j = 47
    Outside j = 2
    Inside j = 47
    Outside j = 3
    Inside j = 47
    Outside j = 4
    Inside j = 47

  • Problem on CachedRowset with RMI

    Hello,
    I wanted to transfer some database tables to another machine, thus I used RMI. I found there was a class called CachedRowset which could be serialized. So, I decided to use this.
    However, when I wrote the following code in an rmi method and ran, problem occurred.
    CachedRowSet crs= new CachedRowSetImpl();
    A NullPointerException was thrown:
    java.lang.NullPointerException
         at java.util.Properties$LineReader.readLine(Unknown Source)
         at java.util.Properties.load0(Unknown Source)
         at java.util.Properties.load(Unknown Source)
         at javax.sql.rowset.spi.SyncFactory.initMapIfNecessary(Unknown Source)
         at javax.sql.rowset.spi.SyncFactory.getInstance(Unknown Source)
         at com.sun.rowset.CachedRowSetImpl.<init>(Unknown Source)
    However, when I put the code into a non-rmi method, it will be ok.
    I could not figure out the reason. Who can help me?
    Thanks.

    Hi @hamidjoon , and welcome to the HP Forums!
    I see you are having copy issues.  I'd like to help!
    Before we get started, I need a little info:
     I am linking a few HP Support documents below that will show you how to find which operating system you are using. Also, if you're using Windows, please include whether your operating system is 32-bit or 64-bit.
    Mac OS X: How Do I Find Which Mac OS X Version Is on My Computer?
    Which Windows operating system am I running?
    Is the Windows Version on My Computer 32-bit or 64-bit?
    Please let me know what you find.  Thanks for posting on the HP Forums!
    Please click “Accept as Solution " if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the right to say “Thanks" for helping!
    Jamieson
    I work on behalf of HP
    "Remember, I'm pulling for you, we're all in this together!" - Red Green.

  • Cachedrowset acceptchanges()  NOT updating to database

    i wrote this code so that "cachedrowset -- crs" (i got from the "resultset -- rs") can be changed according to the condn specified and the modified cachedrowset will be updated in the oracle database.
    condn. is when " name=sanjiv" it will change it to "rajiv" both in cachedrowset and database , it is changed in the cachedrowset (according to output below) but NOT changed in the database.
    the output is
    //start
    tushar--100000
    sanjiv--890000
    rajesh--790000
    tushar--100000
    rajiv--7900
    rajesh--790000
    //end
    // code start
    import java.sql.*;
    import javax.sql.RowSetMetaData;
    import javax.sql.rowset.RowSetMetaDataImpl;
    import com.sun.rowset.CachedRowSetImpl;
    public class rowsetter {
    public static void main(String[] args) throws Exception {
    Connection conn=null;
    Statement stmt=null;
    ResultSet rs=null;
    CachedRowSetImpl crs = new CachedRowSetImpl();
    try{
    conn = DriverManager.getConnection("jdbc:odbc:mydatasource","scott","tiger");
    stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
    rs=stmt.executeQuery("select * from salary");
    ResultSetMetaData rsmd = rs.getMetaData();
    int rsmdcolcount = rsmd.getColumnCount();
    crs.populate(rs);
    RowSetMetaData rsmd1 = (RowSetMetaData)crs.getMetaData();
    int rsmd1colcount = rsmd1.getColumnCount();
    crs.setMetaData(rsmd1);
    rsmd1.setColumnName(1,"name"); rsmd1.setColumnType(1,Types.VARCHAR);
    rsmd1.setColumnName(2,"salary"); rsmd1.setColumnType(2,Types.VARCHAR);
    crs.setTableName("salary");
    while(crs.next()){
    System.out.println(crs.getString(1)+"--"+crs.getInt(2));
    if(crs.getString(1).trim().equals("sanjiv")){
    crs.moveToCurrentRow(); crs.updateString(1,"rajiv"); crs.updateInt(2,7900);
    crs.acceptChanges(conn);
    crs.beforeFirst();
    while(crs.next()){
    System.out.println(crs.getString(1)+"--"+crs.getInt(2));
    conn.close();
    catch(SQLException sqle){
    System.out.println("Exception Occured SQLE"+sqle);
    catch(Exception ex){
    System.out.println("Exception Occured "+ex);
    //code end

    Hi Marc,
    In EXIT_SAPMM06E_018 do as follows:
    e_ci_ekpo = ekpo_ci.
    The append structure CI_EKPODB is included in ekpo_ci. Moreover the screen fields should be created with reference to ekpo_ci.
    This will update the database table with values for the custom field.
    Hope this helps.
    Regards,
    Abhisek.

  • CachedRowSet problem in Weblogic 6.1 and Oracle thin driver 9.0.1

    Has anyone used the CachedRowSet class successfully? (this classes are
    new and from the JDBC extension pack)
    I am experiencing "Not in a transaction" errors when executing
    cachedrowset.populate(resultset), even though I'm inside a correct
    ut.begin and ut.commit transaction.
    Note I don't have these problems when I don't use the CachedRowSet
    classes.
    If I remove the setFetchSize(50) line, then I receive the ORA-01002:
    fetch out of sequence error, which is discussed in another post on
    this newsgroup.
    I don't have any of these problems at all, if I use the Oracle Thin
    Driver directly (i.e. not using Weblogic 6.1).
    -H
    Example of code:
    stmt = getConnection().createStatement();
    stmt.setFetchSize(50);
    stmt.executeQuery("SELECT * FROM ASSET");
    rs = stmt.getResultSet();
    crs = new CachedRowSet();
    crs.populate(rs);

    Hi Arturo,
    What kind of a problem do you have? Any stacktraces?
    Regards,
    Slava Imeshev
    "Arturo Fernandez" <[email protected]> wrote in message
    news:[email protected]..
    Hi! I have a problem with CLOB column in Oracle 8.1.7. My enviroment
    is:
    Windows 2000, BEA WLS 6.1 and Oracle 8.1.7. I'm trying to use
    'classes12.zip' provided by Oracle. I added 'classes12.zip' to
    CLASSPATH after than 'weblogic.jar' in my startup server script, but
    it fails when trying to retrieve a CLOB data from database. Script
    includes:
    setCLASSPATH=.\classes12_01.zip;.;.\lib\weblogic_sp.jar;.\lib\weblogic.jar;
    >
    But this driver and the code runs sucessfully with the same database
    and weblogic 5.1. I'm interesting in use this driver and this code
    because i'm trying to migrate two applications from WLS 5.1 to WLS 6.1
    I cannot find a solution.
    Can everybody help me, please? It's urgent for me...

  • CachedRowSet Pagination

    Section 10.0 of the javadoc for CachedRowSet has this example.
    CachedRowSet crs = new CachedRowSetImpl();
    crs.setPageSize(5);
    crs.execute(conHandle);
    Did they forget to set the command? I assume that is the case. What is not clear is how the connection handle is managed. I think it's safe to assume we close the connection handle. The bigger question is pagination. This makes no sense to me:
    To access the next page (chunk of data), an application calls the method nextPage. This method creates a new CachedRowSet object and fills it with the next page of data.I have the saame CachedRowSet object. I assume they mean it repopulates itself?
    The data from the first CachedRowSet object will no longer be in memory because it is replaced with the data from the second CachedRowSet object.The data is replaced, NOT the CachedRowSet object, right? Nothing in the example shows the object reference being replaced.
    Big question: where is it getting the next page from? That all-important issue is not even discussed. If the CachedRowSet has one page in memory and you call pageNext, WHERE does it get the data? Is it keeping my connection open? If so then I cannot close it, right? Maybe it's keeping the data in a temp file and paging that?
    The CachedRowSet documentation is clear as mud. Any clarification would be greatly appreciated.

    Writing raw Java code with the JDBC API in a JSP file instead of a Java class and having problems with the JDBC API doesn't make it a JSP problem. Get rid of that scriptlet clutter and just put it all nicely in a Java class and test it independently as a Java application using main().
    There's a JDBC forum around for problems with the JDBC API.

  • How can I instantiate and load a new CachedRowSet object from a non-JDBC so

    How can I instantiate and load a new CachedRowSet object from a non-JDBC source?
    cheers

    webrowset reads whole data;
    I would rather need to get data line by line

  • Problem in querying synonym using cachedRowSet & cachedDataProvider

    Hi....
    I have some trouble using cachedRowSet and cachedDataProvider combination. The problem was occured when I refreshed chachedDataProvider, my table component in pages show "No items found.", whereas... i'm sure there is nothing wrong with my query.
    here the detail
    i have cachedRowSet in my SessionBeans1 named globalRowSet
    globalRowSet.setDataSourceName("java:comp/env/jdbc/MIMSOE_Oracle");
    globalRowSet.setCommand("SELECT EQUIP_NO, ORIGINATOR_ID FROM ELLIPSE.MSF620 WHERE EQUIP_NO LIKE ?");
    globalRowSet.setFetchSize(100);
    globalRowSet.setMaxRows(100);
    globalRowSet.setPageSize(100);and then i have data provider in my pages (TestPage.jsp), linked to globalRowSet, named cachedRowSetDataProvider1
    cachedRowSetDataProvider1.setCachedRowSet((javax.sql.rowset.CachedRowSet) getValue("#{SessionBean1.globalRowSet}"));Note that in globalRowSet SQL command, there is a parameter (marked by '?'), so i put this code in init() method.
    getSessionBean1().getGlobalRowSet().setObject(1, "%MUA21%");that code replace '?' in my query with '%MUA21%'. so in the first time i open the page, my table in TestPage.jsp dont display empty data. this code was worked.
    then i put a button and a textfield in TestPage.jsp. I put them for dynamically changes my query parameter.
    public String button1_action() {
    try {
    getSessionBean1().getGlobalRowSet().setObject(1, this.textField1.getText().toString());
    this.cachedRowSetDataProvider1.refresh();
    } catch (SQLException ex) {
    Logger.getLogger(TestPage.class.getName()).log(Level.SEVERE, null, ex);
    return null;
    }I ran my webpages, i hit the button, and i saw anomalies.
    before i hit the button, my table shows a lot of records. but after i hit, my table shows nothing but "No items found." displayed in table body.
    I debugged my code, and found nothing wrong with my query. I executed my query in separated sql editor and it works flawlessly,
    I truncated my code line by line for debugging, and found this line of code was the main reason for that problem
    this.cachedRowSetDataProvider1.refresh();I'm not sure why this line of code didnt work in my project. maybe this is because of my globalRowSet querying data from ORACLE synonym. please note that 'MSF620' in my query (SELECT EQUIP_NO, ORIGINATOR_ID FROM ELLIPSE.MSF620) is not a table, but synonym. I made same version but use oracle table (not synonym) and work fine...
    can anyone help give me a solution for this issue? ...
    please help..
    i have no progression for last 2 weeks because of this issue.......

    Hi Tushar,
    In your SELECT you select only record for record and you put the result into the header line of the table.
    Try:
    SELECT posnr
          FROM RESB
          INTO TABLE IRESB
         WHERE VORNR = '0010'
           AND AUFNR = '720000100'.
    Then you can loop over your internal table!.
    Regards,
    John.

  • Query SQL database using JSF problem!! Using CachedRowSet

    I'm using JSF and want to query data from SQL by using CachedRowSet like this,
    rowset.setCommand("SELECT * FROM dbo.SomeTable WHERE SomeField='"+ xyz +"'");
    then check if the record does exist by using
    *if(rowset.next()) {/ do something with the retrieved data}*
    but i get SQLException telling that execute() never called.
    Anyone can tell me what i'm missing? or is there any better way to check the existence of a record ?
    Thanks in advance :-)

    Hi grzegorz,
    1. If your sap application server is unix/aix
      (and not a microsoft OS),
    2. then this kind of secondary databse connection,
       to MS SQL (which is microsoft system),
       is at present not possible.
      (BCOS the required system files, for such
       cross - platform connection is not delivery by sap)
    regards,
    amit m.

  • Help on CachedRowSet with setDataSourceName for Oracle needed

    Hello users,
    I am using WL6.1. and SUN's CachedRowSet. It works fine with setURL and it is very
    fast with Oracle's oci thin driver. One more time for BEA people: oracle.jdbc.driver.OracleDriver
    is more than 3 times faster than weblogic.jdbc.oci.Driver. Of course when I do setURL,
    it bypasses WL and go directly to the database. And it is not using any connection
    pool manager such as WL.
    I would like to use WL's datasource. However, the problem is when I do CachedRowSet.setDataSourceName(jndiname)
    with proper JNDI name, Sun's CachedRowset could not figure out what WLInitialContextFactory
    is (it must have its own hard-coded context factory which I don't know what it is
    therefore it can not create a connection from it). The exception thrown says "(JNDI)
    Unable to connect".
    Can anyone tell me how to make it work? (How to use setDataSourceName for CachedRowSet
    for WL). The key is what ContextFactory to use.
    Thanks in advance.
    L.W.X.

    I am assuming there is some reverse proxy web server with OAM WebGate which is fronting the tomcat and JBoss servers. Also, assuming you are using FQDNs throughout.
    Is the ObSSOCookie sent when you access the external applications after logging into portal? It should help to look through the HTTP headers. Also, it could be an issue with authentication levels/IP validation failure - these should show up in the WebGate logs.
    -Vinod

  • Want know about CachedRowSet ?

    hi everybody,
    I wnat to know about CachedRowSet and exaple related to it.
    and also want to know why do we use the DTO,DAO and VO in project.
    Can anyone tell me about it, where i could get the details about these.

    I wnat to know about CachedRowSet and exaple related to it.Simply read it's API documentation ... http://java.sun.com/j2se/1.5.0/docs/api/javax/sql/rowset/CachedRowSet.html
    and also want to know why do we use the DTO,DAO and VO in project.Separation of the Data, Business and Presentation tiers.

  • Updating a JTable using CachedRowSet data

    Hello, I would like to know how I can update my already created JTable receiving data from a CachedRowSet without creating a new table model (this is the method I have been using). I have read about using the fireTableDataChanged() method but I cant figure out how to use this works. Maybe an explanation on how the information in the CachedRowSet is updated in the JTable when notifiers are used will help.
    Any help will be appreciated

    camickr wrote:
    table.setAutoCreateColumnsFromModel( false );
    Perfect. This works well for my issue. I can now use the setModel() method without having the columns reordered.Damn camickr, that is a bloody good thing to know (it's often so much easier to recreate the table model, here's a very neat solution to one of the pitfalls)! Thanks :)
    Since this is solved, I still want to know how I can use the fireTableDataChanged() method and AbstractTableModel interface with CachedRowSet (just out of curiosity). I have been looking through jduprez's suggestion to figure this out too. I am currently faced with the issue,
    I have two classes, one for the CachedRowSet and the other with the table implementationsAs you describe it, I don't think that's a good approach: what I meant wad an implementation of TableModel , not a subclass of JTable : the stock JTable already knows how to work with any model implementation, as long as it implements TableModel .
    Where do I need to use the AbstractTableModel interface?It is a class, not an interface: it implements TableModel and provides useful defaults for some methods (at least, the management of the list of TableModelListener )
    My suggestion was that you define a custom class that extends AbstractTableModel , and uses its fireXxx judiciously.
    here is an example:
    public class RowSetAwareTableModel extends AbstractTableModel {
        public void setUpdateddata(RowSet newData) {
            this rowSet = newdata;
            super.fireTabledataChanged();
        /** Implementation of TableModel */
        public int getRowCount() {
            return rowset.getMaxRows();
        // etc...
    }

Maybe you are looking for

  • MXF OP1a Master file converted to Blu Ray in AME to .m4v showa up in Encore as Untranscoded

    Just started creating Blu Ray DVDs from MXF OP1a AVC-I 100 Master files. I use AME to convert to BR matching the settings of the master. It converts successfully creating  video .m4v and PCM files. When I import them into Encore 6.02, the Project win

  • I get  green screen when playing videos in itunes

    Hi I get a green screen when I play videos in itunes even in the store when i try to see previews. Any ideas what is wrong. I have quicktime installed.

  • Vintage retro text effect

    Hi, I'm looking to do this text effect in Photoshop , Could you please tell me how can I do that ? Thank you

  • N70 app installation issues

    Hi, i have some issues with my n70. The problem here is that any applications I install into the mmc, although successful, will not appear on the 'My Own' folder, and also won't show up on the 'Manager' program. If I select 'Phone Memory' as the loca

  • Where to buy charger for hp mini 210 - 104OSL

    i'm a hp mini 210-1040SL owner, my charger was not functioning anymore. I just want to know where can i avail a new one. I'm from the Philipinnes.  I'll wait for your response, thank you.