Returning a Date from a method

in class we have a lab that uses a method to return a Date.
The Date is printed out to the console when the driver class calls it. I tried using dateCreated.getDate() but it says it cannot convert from int to Date.
here is some snippets from my code
private Date dateCreated;
protected Date getDateCreated()
              return dateCreated;
}//this method does nothing yet (returns Null)any suggestions?
thanks!

I want the date to be displayed upon the driver class calling it.
Currently, when the driver class calls the method getDateCreated()
it returns a null to System.out.println
I don't want a null I want the date
if this is still unclear please let me know I awill post more code in hopes that it will be more clear on what I am trying to do.
Thanks!

Similar Messages

  • How to return a object from a method in a java program to a C++ call (JNI )

    Sir,
    I am new to java and i have been assigned a task to be done using JNI.
    My question is,
    How can i return an object from a method in a java program to a call for the same method in a C++program using JNI.
    Any help or suggesstions in this regard would be very useful.
    Thanking you,
    Anjan Kumar

    Hello
    I would like to suggest that JNI should be your last choice and not your first choice. JNI is hard to get right. Since the JNI code is executing in the same address space as the JVM, any problems (on either side) will take down the entire process. It dilutes the Write Once Run Anywhere (WORA) value proposition because you need to provide the JNI component for all hardware/OS platforms. If you can keep your legacy code(or whatever you feel you need to do in JNI) in a separate address space and communicate via some inter-process channel, you end up with a system that is more flexible, portable, and scalable.
    Having said all that, head over to the Java Native Interface: Programmer's Guide and Specification web page:
    http://java.sun.com/docs/books/jni/
    Scroll down to the Download the example code in this book in ZIP or tar.gz formats. links and download the example source. Study and run the example sources. The jniexamples/chap5/MyNewString demo creates a java.lang.String object in native code and returns it to the Java Language program.

  • Return multiple values from a method

    For a school project I have to make a parameter-less constructor that can input values from the keyboard and calculate those values. Now that I have the values how do I return them? I need to return 3 values from this parameter-less method.
    I hoope someone can help.

    Qwertyfshag wrote:
    Here is the wording of the assignment. I have copied and pasted it word for word:
    "Declare and use a no-argument (or "parameter-less") constructor to input the data needed, and to do the calculations."
    Any advice???Find a teacher who isn't an idiot. That sentence is vague ("to input the data needed"? Does that mean that it's supposed to query the user (which is terrible) or that it's supposed to encapsulate the data as hardcoded values, or what?) and is a bad design. Constructors shouldn't do this sort of thing.
    Ok I have done that part and now I want to retrieve the values of the calculations. How can I get those values out of that method What do you mean "that method"? Constructors aren't methods, and they don't return values.
    I suppose you could define a class whose constructor queries the user, and which would have a method to return values. That could be pretty simple; the method signature would be like this:
    Set<Integer> getValues();
    This seems like an advanced problem.It's not advanced; it's just garbage.
    I can't post the code in hear because that may constitute cheating. I am allowed to discuss it verbally but I cannot share code, sorry.You can't get a lot of help then. We can't psychically see what you've done so far.
    In conclusion: I have to have two methods. One method is a constructorConstructors aren't methods. If your teacher told you that they are, then he/she doesn't know what he/she is doing.
    that has NO parameters that will get input from the keyboard (done) and do the calculations (done). The other method must print that values to the screen on separate lines (not done). I don't know how to get the values out of the method.If they're two methods in the same class, then the constructor just needs to store the user input into a field of the class, and the other method can read the values in that field.

  • Returning a ResultSet from a method

    I have wrote a method that opens a database connection, peroforms a sql query and then closes the connection. It then returns the ResultSet.
    My problem is I get this error "ResultSet is closed" when i try to work on the data from the ResultSet.
    any idea?

    A ResultSet object is automatically closed when the Statement object that generated it is closed, re-executed, or used to retrieve the next result from a sequence of multiple results.
    Try to leave the database connection and the statement through which you got the resultset open, but this is not a good way.
    You may want to use CachedRowSet instead of ResultSet.
    A CachedRowSet class�a disconnected rowset that caches its data in memory; not suitable for very large data sets, but an ideal way to provide thin Java clients, such as a Personal Digital Assistant (PDA) or Network Computer (NC), with tabular data.
    Refer to the following pages for more info on CachedRowSet
    http://developer.java.sun.com/developer/technicalArticles/javaserverpages/cachedrowset/
    http://developer.java.sun.com/developer/Books/JDBCTutorial/chapter5.html
    http://developer.java.sun.com/developer/earlyAccess/crs/

  • What is the best approach to return Large data from Stored Procedure ?

    no answers to my original post, maybe better luck this time, thanks!
    We have a stored proc (Oracle 8i) that:
    1) receives some parameters.
    2)performs computations which create a large block of data
    3) return this data to caller.
    compatible with both ASP (using MSDAORA.Oracle), and ColdFusion (using Oracle ODBC driver). This procedure is critical in terms of performance.
    I have written this procedure as having an OUT param which is a REF CURSOR to a record containing a LONG. In order to make this work, at the end of the procedure I have to store the working buffer (an internal LONG variable) into a temp table, and then open the cursor as a SELECT from the temp table.
    I have tried to open the cursor as a SELECT of the working buffer (from dual) but I get the error "ORA-01460: unimplemented or unreasonable conversion requested"
    I suspect this is taking too much time; any tips about the best approach here? is there a resource with REAL examples on returning large data?
    If I switch to CLOB, will it speed the process, be compatible with callers, etc ? all references to CLOB I saw use trivial examples.
    Thanks for any help,
    Yoram Ayalon

    Create a new farm in the secondary Data Center at the same patch level with the desired configuration. Replicate the databases using the method of choice (Mirroring, AlwaysOn, etc.). Create a downtime window where you can then attach the databases to the
    new farm's Web Application(s)/Service Application(s).
    Trevor Seward
    Follow or contact me at...
    &nbsp&nbsp
    This post is my own opinion and does not necessarily reflect the opinion or view of Microsoft, its employees, or other MVPs.

  • Discoverer report returns no data from a certain time

    Using Discoverer 10g,a discoverer report which returned data normally last month gets to return no data now.
    We have four same environments, and two of them has this problem, two is OK.
    And the SQL of the discoverer of the four environments are the same.
    We have no any changment of this discoverer and related EUL for more than one year....
    How should we investigate into this issue.
    For example ,a point we should notice or something...
    Could somebody give us a suggestion?
    Thank you.

    Thanks for your qiuck reply.
    1.empty table that is joined in the query.The four environments has almost the same data,it is not the cause.
    2.security issue with the data, maybe the security definitions are different from one environment to another.we are now invesgate into this cause.
    and there is a sql of the discoverer's EUL which shows no data in a enviroment(in this enviroment discoverer report gets no data), but in another enviroment data can show.
    the sql is as following.
    =============
    SELECT loc_bu.org_id
    ,loc_bu.location_id building_id
    ,loc_bu.building building_name
    ,loc_bu.location_code building_number
    ,loc_fl.location_id floor_id
    ,loc_fl.location_code floor_number
    ,loc_fl.floor floor_name
    ,loc_of.location_id office_id
    ,loc_of.location_code office_number
    ,loc_of.office office_name
    ,loc_of.suite office_suite
    ,loc_of.location_alias office_alias
    ,loc_of.assignable_area office_assignable_area
    ,loc_of.space_type_lookup_code office_space_type_code
    ,lst.meaning office_space_type
    ,loc_of.function_type_lookup_code office_function_type_code
    ,fun.meaning office_function_type
    ,(SELECT ffv.description
    FROM fnd_flex_values_vl ffv
    ,fnd_flex_value_sets ffvs
    WHERE ffv.flex_value = loc_of.attribute1
    AND ffv.flex_value_set_id = ffvs.flex_value_set_id
    AND ffvs.flex_value_set_name = 'MB_PN_ON') occupancy_exception_flag
    ,loc_of.active_start_date
    ,loc_of.active_end_date
    --ADD BY KEVIN 2008/6/26 START
    ,loc_of.attribute7 division_code_office
    ,(SELECT ffv.description
    FROM fnd_flex_values_vl ffv
    ,fnd_flex_value_sets ffvs
    WHERE ffv.flex_value = loc_of.attribute7
    AND ffv.flex_value_set_id = ffvs.flex_value_set_id
    AND ffvs.flex_value_set_name = 'MB_PN_DIVISION') division_description_office --ヌヨ-ホ・ヒオテ・
    --ADD BY KEVIN 2008/6/26 END 
    FROM pn_locations loc_bu
    ,pn_locations loc_fl
    ,pn_locations loc_of
    ,fnd_lookups fun
    ,fnd_lookups lst
    WHERE loc_bu.location_id = loc_fl.parent_location_id
    AND loc_bu.location_type_lookup_code IN ('LAND', 'BUILDING')
    AND nvl(loc_bu.attribute6, '99') <> '01'
    AND loc_fl.location_id = loc_of.parent_location_id
    AND loc_fl.location_type_lookup_code IN ('FLOOR', 'PARCEL')
    AND nvl(loc_fl.attribute6, '99') <> '01'
    AND loc_of.location_type_lookup_code IN ('OFFICE', 'SECTION')
    AND nvl(loc_of.attribute6, '99') <> '01'
    AND loc_of.function_type_lookup_code = fun.lookup_code(+)
    AND fun.lookup_type(+) = 'PN_FUNCTION_TYPE'
    AND loc_of.space_type_lookup_code = lst.lookup_code(+)
    AND lst.lookup_type(+) = decode(loc_of.location_type_lookup_code,
    'OFFICE',
    'PN_SPACE_TYPE',
    'SECTION',
    'PN_PARCEL_TYPE')
    AND nvl(loc_of.space_type_lookup_code,'99') <> '07';
    ====================
    Ps.before excute this sql, we always first excute following command.
    ====
    begin
    fnd_client_info.set_org_context(117);
    end;
    ====
    The analyst of our team is not very good at the security problem, could you help us?
    Thanks a lot.

  • Returning multiple values from a method

    I have to return a string and int array from a method (both are only of size 5 for a total of 10) What would be considered the best manner in which to do this ?
    Dr there's 10 points in it for you or whoever gives me the best idea ;-P

    hey here it is easy that you can return many things
    what ever you want from a single method man....
    you know the main thing what you have to do is.....
    Just create a VECTOR or LIST object, then add all the
    values what ever you want to return like string and
    int array like etc...
    Then make the method return type is VECTOR and after
    getting the Vector you can Iterate that and you can
    get all the values from that method what ever you
    want....
    jus try this,,,,,,,,,,
    Its really work......
    reply me..but it relies purely on trust that the returned collection would contain exactly the right number and type of arguments

  • Returning XML Data from a database

    Ok, just got the new DW CS3 and really want to begin using
    the built in Spry capabilitites. All of the examples I've seen for
    populating the datasets with XML data are based on referencing a
    static XML file. I want to query my database and return XML data to
    a Spry Table. How do I accomplish this? I know how to perform the
    query and retrun the data in an XML format (ColdFusion) but I can't
    tell the spry dataset to use this. HELP!!

    Well, that's the trick... I can't point to a testing server
    (i.e. Application interface) because we aren't permitted to have
    the RDS login where I work. (They haven't bothered to configure the
    CF server for restricting access) I have to manually create all
    connections and queries. I'm currenlty using the exact format in
    the example page you provided to return the data in an XML format
    but when I point to that file as my datasource I get nothing
    displayed on the page. The file that performs the query and returns
    the data is in a separate file from the one I'm trying to use the
    Spry table in. When I use this same query file for an Ajax call to,
    say, populate a listbox or pulldown menu it works fine, but I can't
    get it to work with the Spry dataset.

  • URGENT : Return Bulk data from Stored Procedure

    Hi,
    Tell me, how do I return a bulk of data which
    does not exist in the data base
    but is concluded while the Stored Procedure is executed
    from the Stored procedure
    to the C++ program.
    For Example:
    Table ABC
    Field1 Field2 Field3
    A 1 3
    B 1 5
    C 2 10
    Table DEF
    Field1 Field2 Field3
    D 10 24
    E 3 16
    F 8 19
    SP_TESTING
    Depending on the values in both the tables
    for some range of conditions,
    a conclusion X is derived for each range value of the
    condition range.
    Now I need to return this bulk of data X with the
    condition they belong to
    back to the C++ code calling it....
    NOTE : A stored procedure is requited as there is a lot
    of processing
    required before we conclude the result X for each value
    in the condition range.
    If I execute this code from C++ instead of Stored
    procedure
    it is very slow and speed is a prime requirement of my
    system.
    Also i'm not using any MFC class to access database.
    I'm using ConnectionPtr, RecordsetPtr and _CommandPtr
    from msado15.dll for database access...
    One solution to this could be use of Temp tables.
    As this process is used by a lot of different stored
    procedures having a common
    temp table to all will need something like 50 NUMERIC
    fields, 50 VARCHAR fields
    and so on, which doesn't seem like a very good solution
    to this problem.
    Sounds like something I would have done while in school,
    implement a dumb solution.
    So, please suggest me a solution as to how do I return
    bulk data in the form
    of recordsets from stored procedure.
    Regards
    Shruti

    Use Out parameter mode
    SQL> CREATE OR REPLACE procedure a1 (x  OUT NUMBER, y  OUT NUMBER) AS
      2  BEGIN
      3        x:= 1;
      4        y:= 2;
      5  END;
      6  .
    SQL> /
    Procedure created.
    SQL> SET SERVEROUTPUT ON
    SQL> DECLARE
      2   a NUMBER :=3;
      3   b NUMBER :=4;
      4  BEGIN
      5   a1 (a,b);
      6      DBMS_OUTPUT.PUT_LINE( 'a = ' || a );
      7      dbms_output.put_line( 'b = ' || b );
      8  END;
      9  .
    SQL> /
    a = 1
    b = 2
    PL/SQL procedure successfully completed.By default parameters are copied to the OUT parameter mode .
    COPY hint in PLSQL don’t send a pointer to calling program unit but NOCOPY
    does.
    Khurram

  • Return a string from a method: a problem in C++ but is it a problem in java

    I have a method which return a String from it as:
    String pattern(short i)
    String s="":
    if (i==1)
    s = "test1";
    else
    s = "test2";
    return s;
    Since s is a local vaariable to pattern(), does the code above
    create problems? I know it is a problem for C++ since the local
    variable memory address will be reused by others and thus the
    returned value may take other values sometime later or not
    readable.

    Actually, this is not a problem in C++ either if you
    just use the string class instead of the old-style
    char* from C.True, I was assuming he/she meant (in C++):
    char mylocalbuf[80];
    // put stuff in mylocalbuf here
    return mylocalbuf;
    which would be very very bad to do indeed.

  • EJB 3.0 - EntityManager.find() not returning latest data from DB

    I have to restart the app server (using 10g embedded server) to get an EntityManager find to work propoerly. Basically if I update the DB directly (using dbvisualiser) and do a find using an entiy bean in JDev with embedded container the find return old data.
    Very new to this.
    any ideas ?

    The persistence provider for our EJB 3.0 implementation is TopLink and uses TopLink's object cache for the retrieved entities. By default it is configured to aggresively cache. You can customize the caching by using TopLink configuration files. I briefly described the process in this EJB3: Mapping a Boolean.
    I would recommend using entityManager.refresh(entity) or use the vendor hint on the query:
    Customer customer = (Customer)entityMgr.
                                        createNamedQuery("findCustomerBySSN").
                                        setParameter("SSN", "123-12-1234").
                                        setHint("refresh", Booelan.TRUE).
                                        getSingleResult();Doug

  • How to return course  data  from different tables from a procedure

    I have a procedure which must return information from two tables:
    The sturcture of tables is as below:
    Table 1:
    id,
    name,
    property,
    type
    Table 2:
    id1
    id2 ,
    property.
    id1 of table2 refers to id attribute of table1. ie id is the foreign key for table2.
    the tables are defined such that for corresponding to each id in table1 there would
    be two or more rows in table2.
    Now in the procedure given the id, i need to retrieve information from table1 and also all the rows in table2 which refers to id2.I want to return a cursor.How can i do this.
    eg:
    if table 1 has an entry with id 2
    and table 2 has three entries with id1 referring to id(i.e id1=2)..I need to return the table1 entry with id=2 and three entires from table2 with id1=2.
    If cursors are not appropriate, what other alternative methods can be used.
    Any suggestions would be of great help.

    thanks for the reply,
    The result set would be returned to the client .....which would do further processing.The client does not even know that the data is organized in two tables..Therefore given an id, client would expect to have all the information...i.e the info from table 1 and info from table 2 where the relation ship between id and other ids are stored.
    i.e say client has id=6.This id has property,name,etc stored in table1.
    This id can further be related to any number other of ids.It can be related 2,5,100,or may be even 10000s of other ids.This mapping between the original id and other ids..are stored in table2.
    So given the id by the client , i would want to return property of the ids itself along with all the ids that it is related to .
    I want to achieve this.....

  • JCO not returning Table Data from RFC

    Hi,
    I have written a RFC in ABAP having ..
    1) One Import parameter.
    2) NO EXPORT Parameter.
    3) One Table. (Returning 'n' rows of data field 'WA').
    I am calling the RFC using JCO.
    No output is displayed. The ABAP functions is working fine
    when tested using SE37.
    How call function with this combination?
    Regards.

    Milind,
    This is how I have done.
    I pass the parameter to import parameter list. The abap code looks if any import parameter is added. Then it fills one of the tables with data values. Then I call the table and display the results and set the import parameter to something else.
    JCO.Field import = function.getImportParameterList().getField("<Field Name>");
    import.setValue("<Field Value1>");
    Table1=function.getTableParameterList().getTable("<Table Name>");
    Table2=function.getTableParameterList().getTable("<Table Name>");
    mConnection.execute(function);
    Then I get the table values from the required table1 and table2. Then Finnaly before exiting from the connection
    I reset the value of Import parameter
    JCO.Field import = function.getImportParameterList().getField("<Field Name>");
    Con2.setValue("<FieldValue2>");
    mConnection.execute(function);
    mConnection.disconnect();
    Hope this helps to understand from J2ee perspective what is happening. So accordingly you can write the ABAP code to change the table values based on the values that you get in the import Parameters.
    Ravi

  • Returning the data from Time Capsule to the laptop

    Dear Sir,
    Kindly be informed that we have four Macbook laptops and a time capsule machine at our office in order to have back up o our data which are really important to us.
    Now we have some problem with returning one of laptops data after installing Mac OS.
    The software department has informed me that the data is available on the time capsule but they were unable to return it to the laptop. They tried it during the installment, after that and also with migration assistant.
    We would be thankful to receive your kind advise regarding our problem via my e-mail: [email protected]
    For further information, please do not hesitate to contact us.
    Thanks and best regards,
    Mahshid Darabi
    Commercial Manager
    Tooska Khorasan
    Trading & Engineering Group
    No.1005, Lufthansa Tower,
    Dr. Beheshti Ave.
    Tehran-Iran
    Tel: +9821 8874 9370-3
    +9821 8851 5706-13
    Mobile: +98912 633 9114
    e-mail: [email protected]
    website: www.tooskaco.com

    found this:
    "The process to restore backups is unbelievably easy, and takes few clicks to start. When booted from the OS X DVD, (put the install disk in the drive, and restart the computer - holding down the "c" key) click the Utilities menu, and choose “Restore from Time Machine backup”. Select the hard drive on which your backups are located, choose the destination drive, and choose which backup you wish to restore. Hit “Start”, and walk away. The restore process can take anywhere between 1 and 2 hours, so it’s best you walk away from your Mac for a bit. Your Mac will reboot, and depending on what backup you chose to restore, you’ll be right back where you left off."

  • How to return binary data from a servlet?

    This is my problem:
    I have a table (generated from a database), and I would like the user to be able to select a one of the items in the table. When the user clicks the link I would like to transfer a piece of binary data stored in my database.
    I am quite new to Creator and web apps, so I don't really know the best solution to implement this. I have one requirement: I must log the file transfer in the database (the web-servers log is not good enough...)
    Any help would really be appreciated...
    Trond

    Hi Trond,
    Please have a look at the following thread.
    http://swforum.sun.com/jive/thread.jspa?forumID=123&threadID=46410
    It discusses how to display an image stored in the database table. This discussion may provide you with useful information.
    Hope this helps
    Cheers
    Giri :-)
    Creator Team

Maybe you are looking for

  • Flash SWF file within Swing JFrame

    I was wondering whether its possible to open a Flash swf file within a JFrame I am looking for a solution similar to the usage of Flash Activex control in .NET thanks in advance Vikas

  • Automator workflow for Quicktime "Save As... reference movie"

    I need just to "Save As (a reference movie)" from within Quicktime... I have tried using the "Compress using most recent settings" but that still tries to make it "self-contained," whereas i need specifically to Save As a Reference Movie. Any thought

  • Ovi apps

    If I put in my phone model, Ovi says Opera is available for the C6. Opera's site doesn't list the phone, and Opera usually has a browser for everything. So who's right? I don't like to use OVI as I don't want the item billed to my carrier. It's too o

  • About the use of transaction

    Hi expert I use Berkeley DB with lots of short transactions. It seems the performance is limited because commit will cause disk flush/sync. To improve performance I commit several sequential transactions with NOSYNC flag, then commit last transaction

  • Profit Center / Cost Center Distribution

    Hello, I'm trying to send Profit Centers / Cost Centers via IDoc.  I can create the master records with PRCMAS01 / COSMAS01, but I'm not sure how to do the assignment to a company code via IDoc.  Can anyone shed some light? Thanks, Harrison