Method first() JDBC

Help
i trying to put my recorset at teh firts record
i use this connection in a jsp file
<%
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection Con =DriverManager.getConnection("jdbc:microsoft:sqlserver://192.168.232.35;user=x;password=x");     
String Sql= "SELECT car_id.car_dsc FROM CARS"
CallableStatement Cs = Con.prepareCall(SqlT1);     
ResultSet RsTabla1 =Cs.executeQuery();
%>
AND THEN WHEN I USE THIS INTRUCTION
<%RsTabla1.first();%>
THE BROWSER SEND ME THIS MESSAGE
[SQLServer 2000 Driver for JDBC]Unsupported method: ResultSet.first
help PLIS....
I use this recordset and want to go to the fisrt again...

You need to call the overloaded prepareStatement() method to get a scrollable ResultSet. If your driver does not support these, you will not be able to use the first() method. Check if you can just use the next() method in such case.

Similar Messages

  • Issue in my first JDBC pgm

    Hi All,
    This is my first JDBC Pgm...
    I got the driver mysql driver and placed the same in the lib of the jdk...
    when i compile teh java file without the Statement and Resultset it compiles fine.. but when i compile tis file,
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import javax.sql;
    public class LoadDriver {
    public static void main(String[] args) {
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/employee?user=root&password=admin");
    Statement stmt = conn.createStatement();
    String query = "SELECT NAME FROM employee";
    ResultSet rs = stmt.executeQuery(query);
    while (rs.next()) {
              String s = rs.getString("COF_NAME");
              float n = rs.getFloat("PRICE");
              System.out.println(s + " " + n);
    catch (Exception ex) {
    // handle the error
    I am gettting compile error.. sttien that unknown symbol statemetn and resultset..
    Do I miss any import statemet ??
    Thanks,
    Udhan
    I got struck here can any one help me..

    No, adding the mysql driver jar to the JDK lib folder does not help. In fact, it is not a good practice to add third-party JARs to the JDK installation.
    Place the JAR in some convenient location like C:\myjars. Let's assume it is renamed to mysql.jar
    While executing, you need to set this JAR in the runtime classpath so that your program is able to use the driver classes.
    java -cp "C:\myjars\mysql.jar;." LoadDriverThis is not an issue at compile time because you do not make use of {or import} driver specific classes anywhere in the code, but at runtime, this class needs to be available in the classpath for loading.

  • Dynamic Approval Group with Voting Method  First Responder Wins

    Hi all,
    i create new Approver Group with type: Dynamic, and Voting Method: First Responder Wins. and i write the query to get user_id.
    The query return the correct users, but in the approval list in the wf, it requires approval from all users in my dynamic approver group !!
    i need only one first user to approve (First Responder Wins), then must go to next approver group.
    please help me to solve this problem
    thanks all ..
    hedaya

    With Dynamic approval First Responder wins does not work, We have to use Roles in HR Manager.
    Refer Configuring Parallel Approvers Notification (Doc ID 471125.1)

  • Please help in my first jdbc code

    hi,
    in this code i want to get author book name from my database
    but the problem that : the compiler give error on these lines :
    statement= connection.createStatement();
    ResultSet resultset = statement.executeQuery("");
    statement.close();
    please see my code and help me
    import java.awt.Container;
    import java.beans.Statement;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.ResultSetMetaData;
    import java.sql.SQLException;
    import javax.swing.JFrame;
    import javax.swing.JOptionPane;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    public class DisplayAuthors extends JFrame {
        static final String JDBC_DRIVER = "";
        static final String DATABASE_URL="JDBC:db2j:library";
        private Connection connection;
        private Statement statement;
        public DisplayAuthors(){
            try{
                System.setProperty("db2j.system.home", "C:/Documents and Settings/beshoy/My Documents/NetBeansProjects/JDBC");
                Class.forName(JDBC_DRIVER);
                connection=DriverManager.getConnection(DATABASE_URL);
                statement=  (Statement) connection.createStatement();
                ResultSet resultset/*=statement.executeQuery("")*/;
                StringBuffer results= new StringBuffer();
                ResultSetMetaData metadata=resultset.getMetaData();
                int numberofcol=metadata.getColumnCount();
                for(int i=0;i<numberofcol;++i){
                    results.append(metadata.getCatalogName(i)+"\t");
                results.append("\n");
                while(resultset.next()){
                    for(int i=1;i<=numberofcol;++i){
                        results.append(resultset.getObject(i)+"\t");
                    results.append("\n");
                JTextArea area=new JTextArea(results.toString());
                Container container=getContentPane();
                container.add(new JScrollPane(area));
                setSize(300,100);
                setVisible(true);
            catch(ClassNotFoundException classnotfound){
                JOptionPane.showMessageDialog(null,classnotfound.getMessage(),"Database error",JOptionPane.ERROR_MESSAGE);
                System.exit(1);
            catch(ClassNotFoundException classnotfound){
                JOptionPane.showMessageDialog(null,classnotfound.getMessage(),"Driver not found", JOptionPane.ERROR_MESSAGE);
                System.exit(1);
            finally{
                try{
                    statement.close();
                    connection.close();
                catch(SQLException sqlexception){
                    JOptionPane.showMessageDialog(null, sqlexception.getMessage(),"Database error",JOptionPane.ERROR_MESSAGE);
                    System.exit(1);
        public static void main(String[]args){
            DisplayAuthors window=new DisplayAuthors();
            window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }thanks in advance

    beshoy wrote:
    Compiling 1 source file to C:\Documents and Settings\beshoy\My Documents\NetBeansProjects\JDBC\build\classes
    C:\Documents and Settings\beshoy\My Documents\NetBeansProjects\JDBC\src\project\DisplayAuthors.java:30: incompatible types
    found : java.sql.Statement
    required: java.beans.Statement
    statement= connection.createStatement();You declared 'statement' as java.beans.Statement instead of java.sql.Statement. The Connection#createStatement() returns java.sql.Statement, not java.beans.Statement.
    How did you miss this one in the JDBC tutorial? [http://java.sun.com/docs/books/tutorial/jdbc/index.html]
    C:\Documents and Settings\beshoy\My Documents\NetBeansProjects\JDBC\src\project\DisplayAuthors.java:31: cannot find symbol
    symbol : method executeQuery(java.lang.String)
    location: class java.beans.Statement
    ResultSet resultset = statement.executeQuery("");This one will solve itself if you fix the first error.
    C:\Documents and Settings\beshoy\My Documents\NetBeansProjects\JDBC\src\project\DisplayAuthors.java:68: cannot find symbol
    symbol : method close()
    location: class java.beans.Statement
    statement.close();This one will solve itself if you fix the first error.

  • Equity method - First cons

    There is a requirement that
    as per local GAAP , units following equity method
    ( non consolidated units ) , should identify ( not post )
    the goodwill / negative Goodwill which arise out of First
    consolidation. as notes to Financial statements.
    However during subsequent cons I can post equity holding
    adjustments to this investment.
    But the problem is system is posting the euity adjustments
    as  susbsequent consolidation.
    So , I want to avoid the First consolidation , but still
    be able to post subsequent consolidation.
    Please share with me any best posiible way out.

    we used the statistical investment and equity items in AFD.
    If we use statistical items , then system does First
    consolidation. It will not post any document in FC.
    However equity adjustments postings will happen as per the
    investment account given in equity method postings.

  • Cancel method in JDBC!

    Has anyone ever implemented the "cancel" method on the Statement class in JDBC?
    On that has anyone cancelled the Connection or the Statement object while carrying out the cancel?

    Alternatively you could just close the connection from another thread.

  • Calling setString() method in JDBC

    Hello,
    I have a java class which I used for database activities.
    I have a method called
    setStrValues(int position, String strValue)  {
    callablestmt.setString(position, strValue);
    }Now I need to generalize this method so that I can use setStrValues method to use for preparestatement.setString(position, strValue) besides callablestmt.setString(position, strValue).
    How can I acheive this? Without creating another method I need to use both for preparedstatement and callable statement.
    Any help is highly appreciable.
    Thanks

    I'm don't follow you. I imagine you have something like this.
    PreparedStatement ps = new ......
    CallableStatement cs = new ......
    setStrValues(ps, 2, "hello");
    setStrValues(cs, 1, "world");
    private void setStrValues(PreparedStatement statement, int position, String StrValue) {
        statement.setString(position, strValue);
    }Note: this is a highly contrived example but you should be able to do this with your code.

  • Unsupported method: ResultSet.first()

    hi,
    when i get tables info using the getTables() method of DatabaseMetaData class and then when i try to use the method first() on that ResultSet (rsTables), i get SQLException (Unsupported method: ResultSet.first).
    As i have seen in few other forums, my problem is not the cursor type (ResultSet.TYPE_SCROLL_INSENSITIVE), bcoz sometimes i get the expected result (i.e. sometimes the method first() works).
    I'm using Java RMI and in the application client is trying to get information from the server ( method first() is used in the server in extracting tables info).
    code is:
    try {
         if(rsTables.first()) {
               for(int j=0;j<rs_count;j++) {
                     tables[i] = tables[i] + "," + rsTables.getString(3);
                     rsTables.next();
                tables[i] = tables.substring(5);
    catch(SQLException ex) {
    ex.printStackTrace();
    thanks.
    - Prasad

    hi,
    I'm still having this problem. To serve rest of the application, 'SelectionMethod' of the the connection is set to 'cursor'.
    jdbc.url=jdbc:microsoft:sqlserver://ceyit\\general;SelectMethod=cursorHow can I change the cursor type of the ResultSet given by the method DatabaseMetadata.getTables() locally?
    Thanks.
    - Prasad

  • Jdbc abstract Jtable model problem

    Hi,
    I am trying to write a program that displays the content of a database in a jtable.
    So far the displaying is working, but Im having trouble with adding, deleting and modifying the jtable.
    Im working on the add method first. Its supposed to add a blank row, but it just adds the last row instead.
    Heres the source:
    // new class. This is the table model
    import javax.swing.table.*;
    import java.sql.*;
    import java.util.Vector;
    import javax.swing.JTable;
    public class MyTableModel extends AbstractTableModel {
    Connection con;
    Statement stat;
    ResultSet rs;
    int li_cols = 0;
    Vector allRows;
    Vector row;
    Vector newRow;
    Vector blankRow;
    Vector colNames;
    String dbColNames[];
    String pkValues[];
    String tableName;
    ResultSetMetaData myM;
    String pKeyCol;
    Vector deletedKeys;
    Vector newRows;
    boolean ibRowNew = false;
    boolean ibRowInserted = false;
    MyTableModel(){
    try{
    Class.forName("com.mysql.jdbc.Driver");
    catch (ClassNotFoundException e){
    System.out.println("Cannot Load Driver!");
    try{
    String url = "jdbc:mysql://localhost:3306/aubrey?";
    con = DriverManager.getConnection(url,"Dude1", "supersecret");
    stat = con.createStatement();
    rs = stat.executeQuery("SELECT * from COFFEES");
    deletedKeys = new Vector();
    newRows = new Vector();
    myM = rs.getMetaData();
    tableName = myM.getTableName(1);
    li_cols = myM.getColumnCount();
    dbColNames = new String[li_cols];
    for(int col = 0; col < li_cols; col ++){
    dbColNames[col] = myM.getColumnName(col + 1);
    allRows = new Vector();
    while(rs.next()){
    newRow = new Vector();
    for(int i = 1; i <= li_cols; i++){
    newRow.addElement(rs.getObject(i));
    } // for
    allRows.addElement(newRow);
    } // while
    catch(SQLException e){
    System.out.println(e.getMessage());
    public Class getColumnClass(int col){
    return getValueAt(0,col).getClass();
    public boolean isCellEditable(int row, int col){
    if (ibRowNew){
    return true;
    if (col == 0){
    return false;
    } else {
    return true;
    public String getColumnName(int col){
    return dbColNames[col];
    public int getRowCount(){
    return allRows.size();
    public int getColumnCount(){
    return li_cols;
    public Object getValueAt(int arow, int col){
    row = (Vector) allRows.elementAt(arow);
    return row.elementAt(col);
    public void setValueAt(Object aValue, int aRow, int aCol) {
    Vector dataRow = (Vector) allRows.elementAt(aRow);
    dataRow.setElementAt(aValue, aCol);
    fireTableCellUpdated(aRow, aCol);
    public void updateDB(){}
    public void addRow(){
         newRow.addElement(blankRow);
         int rowNumber = allRows.size();
         allRows.addElement(newRow);
         ibRowNew = true;
         this.isCellEditable(allRows.size(),0);
         System.out.println(allRows.size());
         fireTableRowsInserted(rowNumber,rowNumber);
    public void deleteRow(int i){}
    }And here is the code for the GUI:
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    import javax.swing.event.*;
    import javax.swing.table.*;
    public class MyTableApp extends JFrame{
    JTable myTable;
    JButton update;
    JButton insert;
    JButton delete;
    JPanel p;
    MyTableModel tm;
    JScrollPane myPane;
    MyTableApp(){
    try{
    UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
    catch(Exception e){
    System.out.println("Error on look and feel");
    update = new JButton("Update");
    insert = new JButton("Add");
    delete = new JButton("Delete");
    p = new JPanel();
    tm = new MyTableModel();
    myTable = new JTable(tm);
    myPane = new JScrollPane(myTable,
    JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
    JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    myTable.setSelectionForeground(Color.white);
    myTable.setSelectionBackground(Color.red);
    myTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    p.add(myPane);
    p.add(update);
    p.add(insert);
    p.add(delete);
    update.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e){
    tm.updateDB();
    insert.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e){
    tm.addRow();
    myTable.setEditingRow(tm.getRowCount());
    myTable.setRowSelectionInterval(tm.getRowCount()-1,tm.getRowCount()-1);
    delete.addActionListener(new ActionListener(){
    public void actionPerformed(ActionEvent e){
    int rowToDelete = myTable.getSelectedRow();
    tm.deleteRow(rowToDelete);
    myTable.setEditingRow(rowToDelete -1);
    myTable.setRowSelectionInterval(rowToDelete -1,rowToDelete -1);
    this.addWindowListener(new WindowAdapter(){
    public void windowClosing(WindowEvent e){
    System.exit(0);
    }); // end windowlistener
    this.setContentPane(p);
    this.setVisible(true);
    this.pack();
    } // constructor
    public static void main (String args[]){
    new MyTableApp();
    } // main
    } //class

    When adding a row to a JTable, one should manipulate the table model. There are many examples of this on the web. Google is your friend.
    Good luck.
    Filestream

  • Errors using weblogic sql driver: "No JDBC connection can be made because the transaction state is marked rollback"

    One of our customers starts to encounter this error message recently.
    We checked our log files. It seems that the error happens when
    to obtain a jdbc connection. Have anyone seen similar problems
    and knows how to fix it? thanks in advance.
    We are using weblogic server 6.1sp2, and weblogic sql type 4 driver.
    The functions that invoke the jdbc calls are stateless session bean
    methods with their transaction attributes marked as Required.
    There is no nested calls of these methods.
    A partial stack trace we obtained is as following:
    java.sql.SQLException: No JDBC connection can be made
    because the transaction state is
    Marked Rollback
         at weblogic.jdbc.jts.Connection.getOrCreateConnection(Connection.java:586)
         at weblogic.jdbc.jts.Connection.prepareStatement(Connection.java:115)
         at weblogic.jdbc.rmi.internal.ConnectionImpl.prepareStatement(ConnectionImpl.java:135)
         at weblogic.jdbc.rmi.SerialConnection.prepareStatement(SerialConnection.java:76)
    lixin

    Joseph Weinstein <[email protected]> wrote:
    >
    >
    YuanHui Liu wrote:
    Joe,
    We got the exact same error message. The error came after we got theJDBC connection,
    and trying to create statement off it.
    It occurs intermitently when we are running another standalone JAVAapp to do
    some end of day work, which results in the DB Server being very busy(90+%CPU
    usage) for about 5 minutes. We see a surge of requests to the WLSJDBC Connection
    pool. This would sometimes result in all our subsequent DB requeststo fail and
    lead to a crash.
    We are using WLS6.0SP1. I do not think there's a 30 seconds wait leadingto a
    connection timeout that caused this(rather it is the end effect).
    Can you give us a more detailed explanation? Is there a miscommunicationbetween
    our DB(Sybase12) and WLS?Hi. It looks to you like it's after you get the connection, but really
    it's when the server is
    gettng the pool connection. For performance/synchronization reasons we
    do a clever
    delay: When your code asks for a pool connection we quickly give you
    the pool wrapper,
    but we delay actually reserving the real underlying DBMS connection until
    your first
    real need for a connection, at your first JDBC call, such as createStatement()
    etc.
    It is while waiting for a pool connection long enough for the transaction
    coordinator
    to have timed you out before you ever get a chance. It's nothing to do
    with the
    DBMS or even JDBC, I believe. I think the weblogic server either has
    too few execute-threads
    and/or too few CPU cycles to do the work load.
    Okay, so there's a lazy initialization of the connection.
    From reading our log I believe our failur is immediate rather
    than waiting for 30+ seconds(the default setting) from the DB,
    the timeout occurred later as a result. At the time either because the DB Server
    is very busy.
    Since we are running WLS6.0 we have only one connection pool,
    we have defined a max of 150 threads in the pool. While this
    is happening the DB Server is being pinned by an overnight job,
    but the WLS Server is not busy at all. The DB and WLS resides
    on different physical boxes.
    We also have a thread dump from the WLS console when we rebooted the server, it
    showed that we are hanging on to the thread & jdbc
    connections after these exceptions has occurred instead of releasing them, note
    "16083"(~4.5 hours) seconds has passed:
    142 116222 Retry rollback request for tx: 'transaction=(IdHash=2963855,Name =
    [EJB UserManagerBeanImpl.signalICUserServletHeartBeat()],Xid=30643:8f3838f3709bf53d,Status=Rolling
    Back. [Reason = Unknown],numRepliesOwedMe=0,numRepliesOwedOthers=0,seconds since
    begin=16083,seconds left=10,ServerResourceInfo[weblogic.jdbc.jts.Connection]=(state=started,assigned=server),SCInfo[server]=(state=active),properties=({weblogic.jdbc=t3://159.55.158.25:8005,
    weblogic.transaction.name=[EJB UserManagerBeanImpl.signalICUserServletHeartBeat()]}))'
    Scheduled Trigger
    So I would argue this problem actually chewed up resources on the WLS server.
    -Yuanhui Liu
    >>
    >>
    Thanks.
    -YuanHui Liu
    Joseph Weinstein <[email protected]> wrote:
    lixin wrote:
    One of our customers starts to encounter this error message recently.
    We checked our log files. It seems that the error happens when
    to obtain a jdbc connection. Have anyone seen similar problems
    and knows how to fix it? thanks in advance.
    We are using weblogic server 6.1sp2, and weblogic sql type 4 driver.
    The functions that invoke the jdbc calls are stateless session bean
    methods with their transaction attributes marked as Required.
    There is no nested calls of these methods.
    A partial stack trace we obtained is as following:
    java.sql.SQLException: No JDBC connection can be made
    because the transaction state is
    Marked Rollback
    at weblogic.jdbc.jts.Connection.getOrCreateConnection(Connection.java:586)Hi. This sounds like a JVM thread starvation issue, and/or a server
    load
    issue. What is
    happening is that the transaction is started, and times out beforethe
    SSB even gets to
    the first JDBC work. I would first verify that the customer is using
    the very latest JVM
    available for the machine.
    Joe Weinstein
    at weblogic.jdbc.jts.Connection.prepareStatement(Connection.java:115)
    at weblogic.jdbc.rmi.internal.ConnectionImpl.prepareStatement(ConnectionImpl.java:135)
    at weblogic.jdbc.rmi.SerialConnection.prepareStatement(SerialConnection.java:76)
    lixin

  • No JDBC connection can be made (transaction state is Committing)

     

    Hi. This seems to be a case where your EJB transaction has obtained a jts
    JDBC connection, but done no JDBC at all by the time the transaction is committing.
    Is this possible? Nevertheless our EJB code is calling commit on on the jts
    connection. Any first JDBC call on a jts connection is the one which actually
    obtains the underlying pool connection, but this is being disallowed because
    the tx is already being committed. I remember this being fixed a while ago,
    so this may be a regression. Do file an official tech support case. Meanwhile,
    I'll look into it.
    Joe
    Chetan Desai wrote:
    >
    Even we get these messages after a while the WL server is up and running. We are
    using ver.6.1
    Any help/suggestions?
    -Chetan.
    Joseph Weinstein <[email protected]> wrote:
    Hi Roman. What version of our product are you using?
    Joe
    Roman Puttkammer wrote:
    after some (presumably unrelated?) code changes, the weblogic server
    seems to be
    unable to open a connection to the database while calling an EJB method.
    Even though
    previously established connections already exist.
    The exact error message text is
    java.sql.SQLException: No JDBC connection can be made because the
    transaction
    state is Committing
    The complete stack trace follows below. Does anybody have an idea what
    we're
    doing wrong?
    any help is appreciated!
    roman
    java.sql.SQLException: No JDBC connection can be made because the
    transaction state is Committing
    at
    weblogic.jdbcbase.jts.Connection.openConnectionIfNecessary(Connection.java:536)
    at weblogic.jdbcbase.jts.Connection.commit(Connection.java:465)
    at
    weblogic.jdbcbase.jts.TxConnection.commitOnePhase(TxConnection.java:53)
    at
    weblogic.jts.internal.CoordinatorImpl.commitSecondPhase(CoordinatorImpl.java:403)
    at
    weblogic.jts.internal.CoordinatorImpl.commit(CoordinatorImpl.java:306)
    at weblogic.jts.internal.TxContext.commit(TxContext.java:228)
    at
    weblogic.ejb.internal.StatefulEJBObject.postInvokeOurTx(StatefulEJBObject.java:204)
    at
    weblogic.ejb.internal.BaseEJBObject.postInvoke(BaseEJBObject.java:285)
    at
    com.multex.EJB.security.ListedSecurityEJBEOImpl.getSecurityTypeCode(ListedSecurityEJBEOImpl.java:198)
    at
    com.multex.EJB.security.FinancialInstrumentFacade.getSecurityTypeCode(FinancialInstrumentFacade.java:88)
    at
    com.multex.beans.security.FinancialInstrumentFunctorBuilder.createFinancialInstrumentFunctor(FinancialInstrumentFunctorBuilder.ja
    va:43)
    at
    com.multex.beans.security.FinancialInstrumentFunctorBuilder.createFinancialInstrumentFunctor(FinancialInstrumentFunctorBuilder.ja
    va:73)
    at
    com.multex.beans.portfolio.HoldingFunctorBuilder.createHoldingFunctor(HoldingFunctorBuilder.java:86)
    at
    com.multex.beans.portfolio.HoldingFunctorBuilder.createHoldingFunctors(HoldingFunctorBuilder.java:140)
    at
    com.multex.beans.portfolio.AccountFunctorBuilder.setUpHoldingFunctors(AccountFunctorBuilder.java:46)
    at
    com.multex.beans.portfolio.AccountFunctorBuilder.createAccountFunctor(AccountFunctorBuilder.java:67)
    at
    com.multex.beans.portfolio.AccountFunctorBuilder.createAccountFunctors(AccountFunctorBuilder.java:93)
    at
    com.multex.beans.portfolio.PortfolioFunctorBuilder.setUpAccountFunctors(PortfolioFunctorBuilder.java:78)
    at
    com.multex.beans.portfolio.PortfolioFunctorBuilder.createPortfolioFunctor(PortfolioFunctorBuilder.java:100)
    at
    com.multex.beans.portfolio.PortfolioFunctorBuilder.createPortfolioFunctors(PortfolioFunctorBuilder.java:61)
    at
    com.multex.beans.portfolio.PortfolioUserFunctorBuilder.createPortfolioUserFunctor(PortfolioUserFunctorBuilder.java:90)
    at
    com.multex.beans.portfolio.PortfolioApp.createPortfolioUserFunctor(PortfolioApp.java:208)
    at
    com.multex.beans.portfolio.PortfolioApp.setUserId(PortfolioApp.java:41)
    at
    com.multex.beans.portfolio.MinPortfolioApp.setUserId(MinPortfolioApp.java:94)
    at
    com.multex.beans.session.UserSession.init(UserSession.java:168)
    at
    com.multex.beans.session.UserSession.<init>(UserSession.java:51)
    at
    com.multex.EJB.session.UserSessionEJB.createSession(UserSessionEJB.java:226)
    at
    com.multex.EJB.session.UserSessionEJB.ejbLoad(UserSessionEJB.java:157)
    at
    weblogic.ejb.internal.EntityEJBContext.load(EntityEJBContext.java:130)
    at
    weblogic.ejb.internal.EntityEJBContext.afterBegin(EntityEJBContext.java:165)
    at
    weblogic.ejb.internal.StatefulEJBObject.getContextForInvoke(StatefulEJBObject.java:115)
    at
    weblogic.ejb.internal.BaseEJBObject.preInvoke(BaseEJBObject.java:174)
    at
    com.multex.EJB.session.UserSessionEJBEOImpl.isNew(UserSessionEJBEOImpl.java:196)
    at
    com.multex.EJB.session.UserSessionFacadeEJB.isNew(UserSessionFacadeEJB.java:128)
    at com.multex.servlets.session.Servlet.doGet(Servlet.java:158)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:715)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:840)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:75)
    at
    weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:286)
    at
    weblogic.servlet.internal.ServletContextImpl.invokeServlet(ServletContextImpl.java:238)
    at
    weblogic.socket.MuxableSocketHTTP.invokeServlet(MuxableSocketHTTP.java:501)
    at
    weblogic.socket.MuxableSocketHTTP.execute(MuxableSocketHTTP.java:260)
    at weblogic.t3.srvr.ExecuteThread.run(ExecuteThread.java:106)--
    The Weblogic Application Server from BEA
    JavaWorld Editor's Choice Award: Best Web Application Server
    Java Developer's Journal Editor's Choice Award: Best Web Application
    Server
    Crossroads A-List Award: Rapid Application Development Tools for
    Java
    Intelligent Enterprise RealWare: Best Application Using a Component Architecture
    http://weblogic.beasys.com/press/awards/index.htm

  • Jdbc 8.1.5 and segmentation violation

    I am using the Oracle 8i client libs on a Unix box to connect to a Oracle 7.3.4 database on NT using the JDBC oci driver.
    The application server we are running manages a pool of db connections that is used by clients . When the app server starts, it connects to the Oracle database, reads some config tables, and is fine. To grab a connection from the pool the client calls a reserve method of the app server. This reserve method first tries to execute a simple query to check that the connection is good. However, it takes a "segmentation violation" trying to create a jdbc statement object, which is weird since the app server actually uses the same reserve method to call the database during initialization (and it works just fine).
    It could be something flakey with the Oracle 8i JDBC or client
    libraries, as we never saw this happen with the 8.0.5 client libs. The same app server code runs just fine.
    Any ideas on what could be causing this?

    I am also using JDK 1.3.1_02 but am using the classes12 library. Is there a classes13 library?
    New at this...thanks

  • Creating view to get first row for each table !!

    I am having tables(more than 10) which are related using foreign key and primary key relationship.
    Example:
    Table1:
    T1Prim T1Col1 T1Col2
    Table2
    T2For T2Prim T2Col1 T2Col2 T2Col3
    (here T2For will have value same as T1Prim and in my design it has same column name i.e. T1Prim)
    Table3
    T3For T3Prim T3Col1 T3Col2 T3Col3
    (here T3For will have value same as T2Prim)
    and so on.
    The data in the tables is like For table1 there will be one record, for table2 there will be one record and for table 3 there are more than one records.
    Can i view either the first record for each of them or all records from each of them by writing the following view.
    I have written a view like this:
    Create or replace view test (T1Prim,T1Col1, T1Col2,T2Prim,T2Col1 T2Col2, T2Col3, T3Prim,T3Col1, T3Col2, T3Col3)
    As
    Select
    Table1.T1Prim,
    Table1.T1Col1,
    Table1.T1Col2,
    Table2.T2Prim,
    Table2.T2Col1,
    Table2.T2Col2,
    Table2.T2Col3,
    Table3.T3Prim,
    Table3.T3Col1,
    Table3.T3Col2,
    Table3.T3Col3
    From
    Table1,
    Table2,
    Table3
    where
    Table1.Prim = Table2.For
    and Table2.Prim = Table3.For
    When i ran the select statement on the view I am not getting any data. Whereas there is data when select is ran on individual table.
    Can someone please tell me where i am goofing.
    Thanks in the anticipation that i will get some hint to solve this.
    Eagerly waiting for reply.
    Thanks !!

    I mean use a collection :
    Collection Methods
    A collection method is a built-in function or procedure that operates on collections and is called using dot notation. The methods EXISTS, COUNT, LIMIT, FIRST, LAST, PRIOR, NEXT, EXTEND, TRIM, and DELETE help generalize code, make collections easier to use, and make your applications easier to maintain.
    EXISTS, COUNT, LIMIT, FIRST, LAST, PRIOR, and NEXT are functions, which appear as part of an expression. EXTEND, TRIM, and DELETE are procedures, which appear as a statement. EXISTS, PRIOR, NEXT, TRIM, EXTEND, and DELETE take integer parameters. EXISTS, PRIOR, NEXT, and DELETE can also take VARCHAR2 parameters for associative arrays with string keys. EXTEND and TRIM cannot be used with index-by tables.
    For more information, see "Using Collection Methods".
    Syntax
    Text description of the illustration collection_method_call.gif
    Keyword and Parameter Description
    collection_name
    This identifies an index-by table, nested table, or varray previously declared within the current scope.
    COUNT
    COUNT returns the number of elements that a collection currently contains, which is useful because the current size of a collection is not always known. You can use COUNT wherever an integer expression is allowed.
    For varrays, COUNT always equals LAST. For nested tables, normally, COUNT equals LAST. But, if you delete elements from the middle of a nested table, COUNT is smaller than LAST.
    DELETE
    This procedure has three forms. DELETE removes all elements from a collection. DELETE(n) removes the nth element from an index-by table or nested table. If n is null, DELETE(n) does nothing. DELETE(m,n) removes all elements in the range m..n from an index-by table or nested table. If m is larger than n or if m or n is null, DELETE(m,n) does nothing.
    EXISTS
    EXISTS(n) returns TRUE if the nth element in a collection exists. Otherwise, EXISTS(n) returns FALSE. Mainly, you use EXISTS with DELETE to maintain sparse nested tables. You can also use EXISTS to avoid raising an exception when you reference a nonexistent element. When passed an out-of-range subscript, EXISTS returns FALSE instead of raising SUBSCRIPT_OUTSIDE_LIMIT.
    EXTEND
    This procedure has three forms. EXTEND appends one null element to a collection. EXTEND(n) appends n null elements to a collection. EXTEND(n,i) appends n copies of the ith element to a collection. EXTEND operates on the internal size of a collection. So, if EXTEND encounters deleted elements, it includes them in its tally. You cannot use EXTEND with index-by tables.
    FIRST, LAST
    FIRST and LAST return the first and last (smallest and largest) subscript values in a collection. The subscript values are usually integers, but can also be strings for associative arrays. If the collection is empty, FIRST and LAST return NULL. If the collection contains only one element, FIRST and LAST return the same subscript value.
    For varrays, FIRST always returns 1 and LAST always equals COUNT. For nested tables, normally, LAST equals COUNT. But, if you delete elements from the middle of a nested table, LAST is larger than COUNT.
    index
    This is an expression that must yield (or convert implicitly to) an integer in most cases, or a string for an associative array declared with string keys.
    LIMIT
    For nested tables, which have no maximum size, LIMIT returns NULL. For varrays, LIMIT returns the maximum number of elements that a varray can contain (which you must specify in its type definition).
    NEXT, PRIOR
    PRIOR(n) returns the subscript that precedes index n in a collection. NEXT(n) returns the subscript that succeeds index n. If n has no predecessor, PRIOR(n) returns NULL. Likewise, if n has no successor, NEXT(n) returns NULL.
    TRIM
    This procedure has two forms. TRIM removes one element from the end of a collection. TRIM(n) removes n elements from the end of a collection. If n is greater than COUNT, TRIM(n) raises SUBSCRIPT_BEYOND_COUNT. You cannot use TRIM with index-by tables.
    TRIM operates on the internal size of a collection. So, if TRIM encounters deleted elements, it includes them in its tally.
    Usage Notes
    You cannot use collection methods in a SQL statement. If you try, you get a compilation error.
    Only EXISTS can be applied to atomically null collections. If you apply another method to such collections, PL/SQL raises COLLECTION_IS_NULL.
    You can use PRIOR or NEXT to traverse collections indexed by any series of subscripts. For example, you can use PRIOR or NEXT to traverse a nested table from which some elements have been deleted.
    EXTEND operates on the internal size of a collection, which includes deleted elements. You cannot use EXTEND to initialize an atomically null collection. Also, if you impose the NOT NULL constraint on a TABLE or VARRAY type, you cannot apply the first two forms of EXTEND to collections of that type.
    If an element to be deleted does not exist, DELETE simply skips it; no exception is raised. Varrays are dense, so you cannot delete their individual elements.
    PL/SQL keeps placeholders for deleted elements. So, you can replace a deleted element simply by assigning it a new value. However, PL/SQL does not keep placeholders for trimmed elements.
    The amount of memory allocated to a nested table can increase or decrease dynamically. As you delete elements, memory is freed page by page. If you delete the entire table, all the memory is freed.
    In general, do not depend on the interaction between TRIM and DELETE. It is better to treat nested tables like fixed-size arrays and use only DELETE, or to treat them like stacks and use only TRIM and EXTEND.
    Within a subprogram, a collection parameter assumes the properties of the argument bound to it. So, you can apply methods FIRST, LAST, COUNT, and so on to such parameters. For varray parameters, the value of LIMIT is always derived from the parameter type definition, regardless of the parameter mode.
    Examples
    In the following example, you use NEXT to traverse a nested table from which some elements have been deleted:
    i := courses.FIRST; -- get subscript of first element
    WHILE i IS NOT NULL LOOP
    -- do something with courses(i)
    i := courses.NEXT(i); -- get subscript of next element
    END LOOP;
    In the following example, PL/SQL executes the assignment statement only if element i exists:
    IF courses.EXISTS(i) THEN
    courses(i) := new_course;
    END IF;
    The next example shows that you can use FIRST and LAST to specify the lower and upper bounds of a loop range provided each element in that range exists:
    FOR i IN courses.FIRST..courses.LAST LOOP ...
    In the following example, you delete elements 2 through 5 from a nested table:
    courses.DELETE(2, 5);
    In the final example, you use LIMIT to determine if you can add 20 more elements to varray projects:
    IF (projects.COUNT + 20) < projects.LIMIT THEN
    -- add 20 more elements
    Related Topics
    Collections, Functions, Procedures
    http://download-west.oracle.com/docs/cd/B10501_01/appdev.920/a96624/13_elems7.htm#33054
    Joel P�rez

  • Confusion about get/set method not working

    Hi
    Hopefully someone can point out the elementary mistake I have made in my code. I have created a get/set method to hold a value"total" so that I can then get it to display it further down my code in an HTML page. I am setting the value as I can check this by printing it out (line 102) but when I try to use it again it displays 0.0. What have I done wrong?
    class ReportListener implements ActionListener
         Context context;
         ResultSet resultAll;
         ResultSet resultTotal;
         JFrame frame;
         int daysInMonth;
         int i;
         DisplayCurrencyOnBills d;
         DateFormatSymbols symbols;
         String[] newWeekday;
         Date theDate;
         String date;
         ReportListener (Context theContext)
              context = theContext;
         public void actionPerformed(ActionEvent e)
           try
              printWeeklyReport();
              //countDaysInMonth();
              getReportMoneyTotal();
         catch (SQLException s)
                   s.printStackTrace();
         public void countDaysInMonth()
         public void getReportMoneyTotal() throws SQLException
              Calendar todayTotal =Calendar.getInstance() ;
               SimpleDateFormat reportDateFormat = new SimpleDateFormat("dd MM yyyy");
              PreparedStatement preparedT =context.getConnection().prepareStatement(
                   "SELECT Sum(tblSession.Fee) AS Total, Count(tblBooking.BookingID) AS CountOfBookingID FROM tblSession INNER JOIN "+
                   "(tblBooking INNER JOIN tblCustomer_Booking ON tblBooking.BookingID = tblCustomer_Booking.BookingID) ON tblSession.SessionID = tblBooking.SessionID "+
                   "WHERE (((tblBooking.EventDate)>DateAdd('m',-1,#"+reportDateFormat.format(todayTotal.getTime())+"#)) AND ((tblSession.Session)='Morning' Or (tblSession.Session)='Evening')) OR (((tblSession.Session)='Afternoon') AND ((tblBooking.Extension)=Yes))"
              ResultSet resultTotal =preparedT.executeQuery();
              resultTotal.next();
              double total =resultTotal.getDouble("Total");     
              context.setReportIncomeTotal(total);
              System.out.println("Line 102 "+context.getReportIncomeTotal());
              preparedT.close();
         public void printWeeklyReport() throws SQLException
              Calendar today =Calendar.getInstance() ;
               SimpleDateFormat reportDateFormat = new SimpleDateFormat("dd MM yyyy");
              PreparedStatement prepared =context.getConnection().prepareStatement(
                   "SELECT tblBooking.EventDate, tblSession.Session, tblBooking.Extension, tblSession.Fee, Count(tblBooking.BookingID) AS CountOfBookingID "+
                   "FROM tblSession INNER JOIN (tblBooking INNER JOIN tblCustomer_Booking ON tblBooking.BookingID = tblCustomer_Booking.BookingID) ON "+
                   "tblSession.SessionID = tblBooking.SessionID GROUP BY tblBooking.EventDate, tblSession.Session, tblBooking.Extension, tblSession.Fee "+
                   "HAVING (((tblBooking.EventDate)>DateAdd('m',-1,#"+reportDateFormat.format(today.getTime())+"#)) AND ((tblSession.Session)='Morning' Or "+
                   "(tblSession.Session)='Evening')) OR (((tblSession.Session)='Afternoon') AND ((tblBooking.Extension)=Yes))"
              ResultSet resultAll =prepared.executeQuery();
              resultAll.next();
              System.out.println("Line 123 "+context.getReportIncomeTotal());
                        PrintWriter printWriter;
                        try
                             JFileChooser fc=new JFileChooser();
                             int returnVal = fc.showSaveDialog(frame);
                             if (returnVal != JFileChooser.APPROVE_OPTION)
                                  return;
                             FileOutputStream outputStream=
                                  new FileOutputStream(fc.getSelectedFile());
                             OutputStreamWriter writer=
                                  new OutputStreamWriter(outputStream,"UTF-8");
                             printWriter=new PrintWriter(writer);     
                           printWriter.println("<html><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><body><h1>Monthly Usage Statistics</h1>");
                           printWriter.println("<table width='100%' border='1'><tr><td width='100%' colspan='8'><h2 align='center'>Monthly Summary</h2></td></tr>");
                         System.out.println("Line 152 "+context.getReportIncomeTotal());
                         int count = 0;
                             while ( resultAll.next() )
                              count++;
                              String session = resultAll.getString("Session");
                              Double fee= resultAll.getDouble("Fee");
                           // display currency correctly
                         //double d=Double.parseDouble(fee);
                         Locale locale = new Locale("GBP");
                         NumberFormat gbpFormat = NumberFormat.getCurrencyInstance(locale);
                             symbols = new DateFormatSymbols(new Locale("en"));
                         newWeekday =symbols.getWeekdays();
                             SimpleDateFormat formatter = new SimpleDateFormat("EEEE",symbols);
                             Date theEventDate = new Date();
                             theEventDate=resultAll.getDate("EventDate");
                             date = formatter.format(theEventDate);
                             // set date for Usage Report
                             Calendar reportDate = Calendar.getInstance();
                             Calendar reportToday =Calendar.getInstance();
                             reportDate.add(Calendar.MONTH,-1);
                             SimpleDateFormat reportFormat = new SimpleDateFormat("EEEE ,dd MMM yyy");     
                             //setDecimalFormat for report total
                             DecimalFormat decFormat = new DecimalFormat(".##");
                             printWriter.println(
                             "<tr><td width='100%' colspan='8'>For month from "+reportFormat.format(reportDate.getTime())+" to "+reportFormat.format(reportToday.getTime())+"</td></tr><tr><td width='100%' colspan='8'>Total amount of income from occasional bookings "+decFormat.format(context.getReportIncomeTotal())+"</td>"+
                               "</tr><tr><td width='100%' colspan='8'>Percentage use for all bookings</td></tr><tr><td width='8%'></td><td width='8%'>MON</td><td width='9%'>TUES</td>"+
                            "<td width='9%'>WEDS</td><td width='9%'>THURS</td><td width='9%'>FRI</td><td width='9%'>SAT</td><td width='9%'>SUN</td></tr><tr><td width='8%'>AM</td><td width='8%'></td>"+
                            "<td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td></tr><tr><td width='8%'>PM</td><td width='8%'></td>"+
                            "<td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td></tr><tr><td width='8%'>EVE</td><td width='8%'></td>"+
                            "<td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td><td width='9%'></td></tr>"
                             System.out.println(count);
                             printWriter.println("</table>");
                             printWriter.println("</body></html>");
                             printWriter.close();
                             prepared.close();
                             JDialog reportDialog=new JDialog(frame);
                             reportDialog.setSize(800,600);
                             JEditorPane editorPane=new JEditorPane(fc.getSelectedFile().toURL());
                             editorPane.setContentType("text/html; charset=UTF-8");
                             reportDialog.getContentPane().add(editorPane);
                             reportDialog.setVisible(true);
                        catch (IOException exception)
                             exception.printStackTrace();
         This code finds data from a database(this works as it also prints a report). Here is the extraxt of my get/set method which is located in a "context" class.
    public void setReportIncomeTotal(double total)
              this.total=total;
         public double getReportIncomeTotal()
              return total;
         }I'd be grateful for any help.

    but when I try to use it again it displays 0.0This seems to mean that either the value has been reset or you are calling the method on another (new) ReportListener.
    It's hard to say, as you didn't provide us with the code sample that illustrate the corresponding scenario (did you?.)
    Note that I didn't get into details, but I just noticed that your actionPerformed method first print weekly report, and then get the money total. (Shouldn't it be the opposite order?)

  • Missing method body or declare abstract error

    Hi!
    I have been working on this simple Java 1.3.1 program for three days now and cannot figure out what I am doing wrong. If anyone has done the "Building an Application" tutorial in the New to Java Programming Center, you might recognize the code. I am trying to set up a frame with panels first using the BorderLayout and then the FlowLayout within each section of the BorderLayout. It will have textfields and checkboxes. I am working on the code to retrieve the user input from the text boxes and also to determine which checkbox the user has checked. Here is my code: (ignore my irrelivent comments!)
    import java.awt.*;
    import javax.swing.*;
    import java.io.*;
    import java.awt.event.*;
    import java.awt.Color.*;
    import java.awt.Image.*;
    //Header Comment for a Routine/Method
    //This method gathers the input text supplied by the user from five text fields on the Current
    //Purchase tab of the tabbed pane of the MPGLog.java program. The way it gathers the text
    //depends on the current processing state, which it retrieves on its own. It saves the text to
    //a text file called textinput.txt.
    public class CollectTextInput extends JPanel implements ActionListener
    { // Begin class
         //Declare all the objects needed first.
         // These are the text fields
         private JTextField currentMileage;
         private JTextField numofGallonsBought;
         private JTextField dateofPurchase;
         private JTextField pricePerGallon;
         private JTextField gasBrand;
         // Declaring the Labels to go with each TextField
         private JLabel lblcurrentMileage;
         private JLabel lblnumofGallonsBought;
         private JLabel lbldateofPurchase;
         private JLabel lblpricePerGallon;
         private JLabel lblgasBrand;
         // Declaring the Checkboxes for the types of gas bought
         private JCheckBox chbxReg;
         private JCheckBox chbxSuper;
         private JCheckBox chbxUltra;
         private JCheckBox chbxOther;
         private JCheckBox chbxHigher;
         private JCheckBox chbxLower;
         // Declaring the Buttons and images needed
         private JButton enter;
         private JButton edit;
         //private JButton report; //Will be used later
         private JLabel bluecar;          //Used with the ImageIcon to create CRV image
         private JPanel carimage;     //Used in buildImagePanel method
         private JPanel datum;          //Used in buildDatumPanel method
         private JPanel gasgrade;     //Used in buildGasTypePanel method.
         //Declaring the Panels that need to be built and added
         //to the border layout of this panel.
         //private JPanel panlimages;
         //private JPanel panltextinputs;
         //private JPanel panlchkBoxes;
         // Class to handle functionality of checkboxes
         ItemListener handler = new CheckBoxHandler();
         // This is where you add the constructor for the class - I THINK!!
         public CollectTextInput()
         { // Opens collectTextInput constructor
              // Must set layout for collectTextInput here
              // Choosing a BorderLayout because we simply want to
              // add panels to the North, Center and South borders, which, by
              // default, will fill the layout with the three panels
              // we are creating
              setLayout(new BorderLayout());
              //Initialize the objects in the constructor of the class.
              //Initialize the textfields
              currentMileage = new JTextField();
              numofGallonsBought = new JTextField();
              dateofPurchase = new JTextField();
              pricePerGallon = new JTextField();
              gasBrand = new JTextField();
              // Initialize the labels that go with each TextField
              lblcurrentMileage = new JLabel("Enter the mileage at the time of gas purchase: ");
              lblnumofGallonsBought = new JLabel("Enter the number of gallons of gas bought: ");
              lbldateofPurchase = new JLabel("Enter the date of the purchase: ");
              lblpricePerGallon = new JLabel("Enter the price per gallon you paid for the gas: ");
              lblgasBrand = new JLabel("Enter the brand name of the gas: ");
              //Initialize the labels for the checkboxes.
              chbxReg = new JCheckBox("Regular ", true);
              chbxSuper = new JCheckBox("Super ");
              chbxUltra = new JCheckBox("Ultra ");
              chbxOther = new JCheckBox("Other: (Choose one from below) ");
              chbxHigher = new JCheckBox("Higher than Ultra ");
              chbxLower = new JCheckBox("Lower than Ultra ");
              //Initialize the buttons that go on the panel.
              enter = new JButton("Save Data");
              edit = new JButton("Edit Data");
              //Initialize the image that oges on the panel.
              bluecar = new JLabel("2002 Honda CR-V", new ImageIcon("CRVBlue.jpg"),JLabel.CENTER);
              // Now bring it all together by calling the other methods
              // that build the other panels and menu.
              buildImagePanel();
              buildDatumPanel();
              buildGasTypePanel();
              // Once the methods above build the panels, this call to add
              //  them will add the panels to the main panel's border
              // layout manager.
              add(datum, BorderLayout.NORTH);
              add(carimage, BorderLayout.EAST);
              add(gasgrade, BorderLayout.CENTER);
         } // Ends the constructor.
            // This method creates a panel called images that holds the car image.
         public void buildImagePanel();
         { // Opens buildImagePanel.
              // First, create the Panel
              carimage = new JPanel();
              //Second, set the color and layout.
              carimage.setBackground(Color.white);
              carimage.setLayout(new FlowLayout());
              // Third, add the image to the panel.
              carimage.add(bluecar);
         }// Closes buildImagePanel
         //This method creates a panel called datum that holds the text input.
         public void buildDatumPanel();
         { //Opens buildDatumPanel
              // First, create the Panel.
              datum = new JPanel();
              //Second, set the background color and layout.
              datum.setBackground(Color.white);
              datum.setLayout(new GridLayout(2, 4, 20, 20));
              //Third, add the textfields and text labels to the panel.
              datum.add(lblcurrentMileage);
              datum.add(currentMileage);
              datum.add(lblnumofGallonsBought);
              datum.add(numofGallonsBought);
              datum.add(lbldateofPurchase);
              datum.add(dateofPurchase);
              datum.add(lblpricePerGallon);
              datum.add(pricePerGallon);
              datum.add(lblgasBrand);
              datum.add(gasBrand);
              //Optionally - Fourth -set a border around the panel, including
              // a title.
              datum.setBorder(BorderFactory.createTitledBorder("Per Purchase Information"));
              //Fifth - Add listeners to each text field to be able to
              //  know when data is input into them.
              currentMileage.addActionListener(this);
              numofGallonsBought.addActionListener(this);
              dateofPurchase.addActionListener(this);
              pricePerGallon.addActionListener(this);
              gasBrand.addActionListener(this);
         }// Closes buildDatumPanel
         // This method builds a panel called gasTypePanel that holds the checkboxes.
         public void buildGasTypePanel()
         { // Opens buildGasTypePanel method
              // First, create the panel.
              gasgrade = new JPanel();
              // Second, set its background color and its layout.
              gasgrade.setBackground(Color.white);
              gasgrade.setLayout(new GridLayout(5, 1, 10, 20));
              // Third, add all the checkboxes to the panel.
              gasgrade.add(chbxReg);
              gasgrade.add(chbxSuper);
              gasgrade.add(chbxUltra);
              gasgrade.add(chbxOther);
              gasgrade.add(chbxHigher);
              gasgrade.add(chbxLower);
              //Optionally, - Fourth - set a border around the panel, including
              // a title.
              gasgrade.setBorder(BorderFactory.createTitledBorder("Gas Type Information"));
              // Fifth - CheckBoxes require a CheckBox Handler.
              // This is a method created separately
              // outside of the method where the checkboxes are added to
              // the panel or where the checkboxes are even created.
              // This method (CheckBox Handler) implements and ItemListener
              // and is a self-contained method all on its own. See
              // the CheckBox Handler methods following the
              // actionPerformed method which follows.-SLM
         } // Closes the buildGasTypePanel method
    // Create the functionality to capture and react to an event
    //   for the checkboxes when they are checked by the user and
    //   the text fields to know when text is entered. Also to react to the
    //   Enter button being pushed and the edit button being pushed.
    public void actionPerformed(ActionEvent evt)
    { // Opens actionPerformed method.
         if((evt.getSource() == currentMileage) || (evt.getSource() == enter))
              { // Opens if statement.
                // Retrieves the text from the currentMileage text field
                //  and assigns it to the variable currentMileageText of
                //  type String.
                String currentMileageText = currentMileage.getText();
                lblcurrentMileage.setText("Current Mileage is:    " + currentMileageText);
                // After printing text to JLabel, hide the text field.
                currentMileage.setVisible(false);
           } // Ends if statement.
          if((evt.getSource() == numofGallonsBought) || (evt.getSource() == enter))
              { // Opens if statement.
                // Retrieves the text from the numofGallonsBought text field
                //  and assigns it to the variable numofGallonsBoughtText of
                //  type String.
                String numofGallonsBoughtText = numofGallonsBought.getText();
                lblnumofGallonsBought.setText("The number of gallons of gas bought is:    " + numofGallonsBoughtText);
                // After printing text to JLabel, hide the text field.
                numofGallonsBought.setVisible(false);
           } // Ends if statement.
           if((evt.getSource() == dateofPurchase) || (evt.getSource() == enter))
                     { // Opens if statement.
                       // Retrieves the text from the dateofPurchase text field
                       //  and assigns it to the variable dateofPurchaseText of
                       //  type String.
                       String dateofPurchaseText = dateofPurchase.getText();
                       lbldateofPurchase.setText("The date of this purchase is:    " + dateofPurchaseText);
                       // After printing text to JLabel, hide the text field.
                       dateofPurchase.setVisible(false);
           } // Ends if statement.
           if((evt.getSource() == pricePerGallon) || (evt.getSource() == enter))
                            { // Opens if statement.
                              // Retrieves the text from the pricePerGallon text field
                              //  and assigns it to the variable pricePerGallonText of
                              //  type String.
                              String pricePerGallonText = pricePerGallon.getText();
                              lblpricePerGallon.setText("The price per gallon of gas for this purchase is:    " + pricePerGallonText);
                              // After printing text to JLabel, hide the text field.
                              pricePerGallon.setVisible(false);
           } // Ends if statement.
           if((evt.getSource() == gasBrand) || (evt.getSource() == enter))
                       { // Opens if statement.
                         // Retrieves the text from the gasBrand text field
                         //  and assigns it to the variable gasBrandText of
                         //  type String.
                         String gasBrandText = gasBrand.getText();
                         lblgasBrand.setText("The Brand of gas for this purchase is:    " + gasBrandText);
                         // After printing text to JLabel, hide the text field.
                         gasBrand.setVisible(false);
           } // Ends if statement.
           // This provides control statements for the Edit button. If the
           //  Edit button is clicked, then the text fields are visible again.
           if(evt.getSource() == edit)
           { // Opens if statement.
             // If the edit button is pressed, the following are set to
             //  visible.
                currentMileage.setVisible(true);
                numofGallonsBought.setVisible(true);
                dateofPurchase.setVisible(true);
                pricePerGallon.setVisible(true);
                gasBrand.setVisible(true);
         }// Closes if statement.
    } // Closes actionPerformed method.
         private class CheckBoxHandler implements ItemListener
         { // Opens inner class
              public void itemStateChanged (ItemEvent e)
              {// Opens the itemStateChanged method.
                   JCheckBox source = (JCheckBox) e.getSource();
                        if(e.getStateChange() == ItemEvent.SELECTED)
                             source.setForeground(Color.blue);
                        else
                             source.setForeground(Color.black);
                        }// Closes the itemStateChanged method
                   }// Closes the CheckBoxHandler class.
    } //Ends the public class collectTextInput classThe error I keep receiving is as follows:
    C:\jdk131\CollectTextInput.java:128: missing method body, or declare abstract
         public void buildImagePanel();
    ^
    C:\jdk131\CollectTextInput.java:142: missing method body, or declare abstract
         public void buildDatumPanel();
    ^
    2 errors
    I have looked this error up in three different places but the solutions do not apply to what I am trying to accomplish.
    Any help would be greatly appreciated!! Thanks!
    Susan

    C:\jdk131\CollectTextInput.java:128: missing methodbody, or declare ?abstract
    public void buildImagePanel();^
    C:\jdk131\CollectTextInput.java:142: missing methodbody, or declare abstract
    public void buildDatumPanel();Just remove the semicolons.
    Geesh! If I had a hammer I would be hitting myself over the head with it right now!!! What an obviously DUMB newbie mistake!!!
    Thanks so much for not making me feel stupid! :-)
    Susan

Maybe you are looking for

  • Adding new elements to a Master Page and sharing them to existing pages

    I need to include new navigation elements on the master page and I want it to show up on pages I've already created. I've added the new elements on a layer of their own which is part of the master page, but the Share Layer to Pages... option is dimme

  • MacBook Pro not compatible to Apple TV?

    Every time I try to play a video or movie thru airplay using my mac bookpro I get rediculous lag and freezing.  Have updated and reset and am fed up with the whole thing.

  • BUDGET PLAN VALUE AND DISTRIBUTABLE VALUE ERROR

    Hey Experts, We have user Investment management for Budgeting process. We have been using this for last 5 years. After creating the AR and assigning them to the Budget program, we use IM34 to do the rollup of the plan values. After that to allocate t

  • How do I open my website in a new iweb program

    I've got a new computer and new iweb. How can I open and edit my website created in an older version of iweb?

  • Urgent..Please..setting node as selected programmatically

    Hi, Can somebody tell me how to set a tree node as selected programmatically?.. i.e. I have tree in which all the nodes bear a name of the color. I have a thread which keeps changing the selected node, and based on the selection the color will be dis