Do EntityManager queries actually query the database?

When I write a method that returns object(s) based on an EntityManager query,
return em.createQuery("select object(o) from Address as o").getResultList();Is that query actually looking at the database and getting the most recent data?
For example, I manually change an address using SQL right in the database, not using the entity manager inside the application. Will the application see that change If I am getting addresses using an entity manager query? Or do I have to restart the server in order to refresh the entity data?

Hi,
It's not guaranteed that you get the data from the database, if the entities with the same PK has been loaded by an entity manager prior to the query. To solve the problem, you'll need to either call em.refresh() on each resulting object, or use persistence-provider specific query hints, or caching options.
Regards,
-marina

Similar Messages

  • Exception when querying the database

    Hi
    I'm using jtds driver to connect to the database, it's been working fine all along and now all of a sudden it's giving exceptions when I query the database and It requires me to logout and login to my application again.
    The exception is as follows
    javax.servlet.ServletException: Could not execute query
            at org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:545)
            at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486)
            at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
            at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
            at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:716)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
            at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
            at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
            at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
            at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
            at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
            at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
            at java.lang.Thread.run(Thread.java:534)
    root cause
    net.sf.hibernate.exception.GenericJDBCException: Could not execute query
            at net.sf.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:80)
            at net.sf.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:69)
            at net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
            at net.sf.hibernate.impl.SessionImpl.convert(SessionImpl.java:4131)
            at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1557)
            at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1531)
            at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1523)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484)
            at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
            at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1480)
            at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:524)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:716)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
            at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
            at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
            at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
            at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
            at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
            at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
            at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
            at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
            at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
            at java.lang.Thread.run(Thread.java:534)
    Caused by: java.sql.SQLException: Invalid state, the Connection object is closed.
            at net.sourceforge.jtds.jdbc.ConnectionJDBC2.checkOpen(ConnectionJDBC2.java:1305)
            at net.sourceforge.jtds.jdbc.ConnectionJDBC2.prepareStatement(ConnectionJDBC2.java:1978)
            at org.apache.commons.dbcp.DelegatingConnection.prepareStatement(DelegatingConnection.java:216)
            at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.prepareStatement(PoolingDataSource.java:323)
            at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:263)
            at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:236)
            at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:67)
            at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:784)
            at net.sf.hibernate.loader.Loader.doQuery(Loader.java:269)
            at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138)
            at net.sf.hibernate.loader.Loader.doList(Loader.java:1063)
            at net.sf.hibernate.loader.Loader.list(Loader.java:1054)
            at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:854)
            at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1554)
            ... 42 moreCan it maybe be the large size of the dabase?
    What can be wrong?

    java.sql.SQLException: Invalid state, the Connection object is closed
    It answers your question to an extent. Check if your connection or recordset object is closed
    cheers,
    Siddhs

  • How to query the database periodically???

    Hi,
    i would like to do a certain task ( like fetching the database, etc) in a particular interval time. For example, my program has to query the database in every 15 mins and display the record if any new record added in the table.
    Any one please help me in this and if possible, please give me a sample code.

    Hi,
    Yes, the delay is 1000 ms ( 1 sec) but the program runs only 12 secs because the main thread sleep only 12000 ms.
    public static void doMain()
    *throws Exception {*
    Timer t = new Timer(true);
    t.schedule(new Ping("Fixed delay")
    *, 0, 1000);*
    Thread.currentThread().sleep(12000);
    After 12000 ms, the program stops running.
    But my requirement is, my program runs continuously for a particular period of time without stops running. ( for example, if i give a period of time is 2 to 6, the program runs in every 1000 ms delay between 2pm to 6pm without stops running).
    Please help me in this.......

  • Queries fired against the database

    Hi everybody,
    I have requirement of this kind.
    I Need to get list of all the queries that hit the database for a day.
    The application team needs the queries that hit the database when they are working with the application.
    database version : 10.2.0.4
    Operating system: HP UX
    Regards,
    khaja

    khaja(DBA) wrote:
    Hi everybody,
    I have requirement of this kind.
    I Need to get list of all the queries that hit the database for a day.
    The application team needs the queries that hit the database when they are working with the application.
    database version : 10.2.0.4
    Operating system: HP UX
    You should have a look at AUDIT feature of oracle.

  • How to query the database in an Entity Object (EO)

    I am using JDeveloper 11.1.2.2.0
    I am Forms developer working in a new ADF project and need some help from the ADF gurus, I am just a ADF beginner.
    Maybe hits question has a easy solution, but I don't know how to implement this:
    I have simplified my scenario, but this is what I Need to do:
    One database table DBTABLE with 3 columns (C1,N1,D1) C1-varchar2; N1-Numeric; D1-Date.
    In the DBTABLE I have the following data:
    ONE; 10; 01/10/2012
    ONE; 20; 02/10/2012
    TWO; 15; 02/10/2012
    ONE; 15; 03/10/2012
    I have created an ADF EO for the DBTABLE with all 3 attributes, then I have created another transient numeric attribute T1.
    My requirement is when I create a new record and set attribute C1=ONE the transient attribute T1 should show sum(N1) from DBTABLE where D1>= 01/10/2012 and D1 < 03/10/2012.
    In this case when I create a new record should the shown in T1 a total of 10+20 = 30.
    I know how to use the EOImpl getters and setters, and how to set the T1 attribute when C1 is set. My problem is how to calculate the total T1.
    How can I implement this in ADF? It is possible to implement this in the EO? It is possible to make the query select sum(N1) from DBTABLE where D1>= 01/10/2012 and D1 < 03/10/2012 and return the value to the EO attribute?
    Thank you in advance

    Hi Peter
    Thank you for your suggestions, both of them are interesting but unfortunately they do not solve my problem, or at least I don’t know how.
    I will try to better explain my problem
    I have te table DBTABLE and another related table called DBDATES with colums(C1,DT1,DT2,TARGET) where I record periods of time and desired target. For instance my DBDATES table could have the following records
    ONE; 01/01/2012; 31/01/2012; 100
    ONE; 01/02/2012; 29/02/2012; 90
    ONE; 01/03/2012; 31/03/2012; 95
    TWO; 01/01/2012; 31/01/2012; 140
    Exist a FK between both tables in the C1 column.
    I have created an EO for the table DBTABLE with the tree persistent attributes (C1, N1, D1) an transient attribute (T1). The (C1,D1) is my DB primary key.
    When I create a new record in the DBTABLE and based in the actual date I need to query the DBDATES table to check which is my TARGET and the valid target dates. For Instance if a record for person ONE is created on February 12, my TARGET is 90 from 01/02/2012 to 29/02/2012.
    At the same moment I need to check the total amount of items record to the person ONE during the full target period.
    Select sum(N1)
    From DBTABLE
    Where D1 between V2 and V3
    And C1= V1;
    Bind variables:
    V1 = ‘ONE’;
    V2 = ‘01/10/2012’ – queried from DBDATES
    V3 = ‘03/10/201’ – queried from DBDATES
    In resume, for a determined person when I create a new record in the DBTABLE I need to know their target for the actual period and how much as been record until now.
    I don't know if is possible to solve this without using the View Objects, because I need to query the DBTABLE for a time frame and with bind variables.
    Thank you in advance for your help.

  • Query the database;

    Hello;
    My application is running the following query:
    SELECT NULL AS pktable_cat,
          p.owner as pktable_schem,
          p.table_name as pktable_name,
          pc.column_name as pkcolumn_name,
          NULL as fktable_cat,
          f.owner as fktable_schem,
          f.table_name as fktable_name,
          fc.column_name as fkcolumn_name,
          fc.position as key_seq,
          NULL as update_rule,
          decode (f.delete_rule, 'CASCADE', 0, 'SET NULL', 2, 1) as delete_rule,
          f.constraint_name as fk_name,
          p.constraint_name as pk_name,
          decode(f.deferrable, 'DEFERRABLE',5 ,'NOT DEFERRABLE',7 , 'DEFERRED', 6 ) deferrability
    FROM all_cons_columns pc,
          all_constraints p,
          all_cons_columns fc,
          all_constraints f
    WHERE 1 = 1 AND
          p.table_name = '?' /*Bind1*/ AND
          p.owner = '?' /*Bind2*/ AND
          f.constraint_type = 'R' AND
          p.owner = f.r_owner AND
          p.constraint_name = f.r_constraint_name AND
          p.constraint_type = 'P' AND
          pc.owner = p.owner AND
          pc.constraint_name = p.constraint_name AND
          pc.table_name = p.table_name AND
          fc.owner = f.owner AND
          fc.constraint_name = f.constraint_name AND
          fc.table_name = f.table_name AND
          fc.position = pc.position
    ORDER BY fktable_schem, fktable_name, key_seq
    We use the CF9 and the database is ORACLE 11G.
    The same is performed several times a day and it's hurting the performance of queries in my system. How to fix it, or remove from the application;
    It is executed by the same driver ?
    thanks;
    Jaider Fraga;

    Hello
    As Mr Dan mentioned, you can do move the condition mentioned in 'where' clause to Join statements .Something like below
    SELECT NULL AS pktable_cat,
          p.owner as pktable_schem,
          p.table_name as pktable_name,
          pc.column_name as pkcolumn_name,
          NULL as fktable_cat,
          f.owner as fktable_schem,
          f.table_name as fktable_name,
          fc.column_name as fkcolumn_name,
          fc.position as key_seq,
          NULL as update_rule,
          decode (f.delete_rule, 'CASCADE', 0, 'SET NULL', 2, 1) as delete_rule,
          f.constraint_name as fk_name,
          p.constraint_name as pk_name,
          decode(f.deferrable, 'DEFERRABLE',5 ,'NOT DEFERRABLE',7 , 'DEFERRED', 6 ) deferrability
    FROM all_cons_columns pc ,
          INNER JOIN all_constraints p ON
                   p.table_name = '?' /*Bind1*/ AND
                   p.owner = '?' /*Bind2*/ AND,
                   p.constraint_type = 'P' AND,
                   pc.owner = p.owner AND,
                   pc.constraint_name = p.constraint_name AND,
                   pc.table_name = p.table_name
          INNER JOIN all_cons_columns fc ON
                   fc.position = pc.position
          INNER JOIN all_constraints f
                   f.constraint_type = 'R' AND
                   p.owner = f.r_owner AND
                   p.constraint_name = f.r_constraint_name AND
                   fc.owner = f.owner AND
                   fc.constraint_name = f.constraint_name AND
                   fc.table_name = f.table_name
    WHERE 1 = 1
    ORDER BY fktable_schem, fktable_name, key_seq
    Advantage is that if you are using the conditions in join statement the query results are filtered on joinning tables itself rather than taking the whole data and gets filtered by where clause. This will improve the query performance and the results will also be correct ones
    Hope this help
    Regards
    Sreekar

  • Is there a way to force a View Object to query the database always?

    Dear All,
    Is there a way to force a view object to always scan the database table to read the latest data?
    Here's my use case.
    I have a page that loads data then I have a button which executes the following code.
    viewObject.setApplyViewCriteriaName("SampleCriteria");
    viewObject.setNamedWhereClauseParam("arg1", "test");
    viewObject.executeQuery();
    RowSetIterator it = viewObject.createRowSetIterator(null); 
    while(it.hasNext()) {
         /* More Code */
    }Suppose after page load, I edited some row in the table and then I clicked the button. I notice that my edited row
    was not reflected in the query.
    I am not sure but is there some configuration to check so that when the viewobject executes it will always query the data
    from the table?
    I am thinking that there is some level of caching and I want to disable it. If I restart my application, I notice that it is able to read the latest data.
    JDEV 11.1.1.5

    By default a view object performs its query against the database to retrieve the rows in its resulting row set. However, you can also use view objects to perform in-memory searches and sorting to avoid unnecessary trips to the database.
    The view object's query mode controls the source used to retrieve rows to populate its row set. For more details please refer: http://docs.oracle.com/cd/B31017_01/web.1013/b25947/bcadvvo005.htm
    Also, see if this helps: setQueryMode for secondary rowSet not working

  • Obtain all list of queries run on the database in history.

    Good day to all of you.
    This is my first post here.
    We have an application where we need to study the set of all queries that were run successfully on the DB by users of that db.
    In particular, SELECT stats that were run on the DB Tables/Views...
    Therefore, does Oracle have a 'Query History' of some sort where SQL statements are stored in archives or something like that?
    If so, for how many days of data does it store ?
    Is the DBA_HIST_SQLTEXT View useful ? I took a look at it, however, it did not seem to store any of the queries that were run
    by users. It had some DML statements that i am sure were not run by any of the users.
    Any help in this regard would be greatly appreciated as this is central to what we wish to implement in the future.
    Thank you.
    Karan.

    welcome to forum,
    please refer the links:- it may be useful to you.
    Timestamp from DBA_HIST_SQLTEXT
    http://www.dba-oracle.com/t_time_series_sql_performance_tracking.htm

  • Need to query the database to get the last sequence number

    Hi all
    I am trying to get the last sequence number of the last row inserted into my Oracle database. Please could someone give me the SQL which would allow me to do this - using Oracle SQL Explorer I have confirmed that there is a sequence on the table which is called: XYZ_SEQ and the code for this is:
    CREATE SEQUENCE "MY_USER_NAME"."XYZ_SEQ" MINVALUE 1 MAXVALUE 999999999999999999999999999 INCREMENT BY 1 START WITH 21 CACHE 20 NOORDER NOCYCLE ;
    My Java application is inserting a row into my table and to insert a new row I need to have the last sequence inserted +1 so the new row can be added.
    Any help would be much appreciated.

    Hi,
    Welcome to the forum!
    If you are using a sequence just do (example):
    INSERT INTO TABLE_NAME
       (COL1,
        COL2)
    VALUES
       (SEQUENCE_NAME.NEXTVAL,
        OTHER_VALUE);to obtain (and use) the next number in the sequence when you are inserting.
    If you have a sequence to use for a specific table, you should use it when your insert new data (no matter your are doing that: java application, procedure, etc). Doing this you avoid some problems when you have the sequence 'out of date' about the associated data.
    Regards,
    Edited by: Walter Fernández on Sep 19, 2009 10:08 AM
    Edited by: Walter Fernández on Sep 19, 2009 10:10 AM

  • Subreport tabs are re-querying the database when changing tabs

    I've got a simple report with embedded subreports that open in a new tab in the viewer.  When I switch between tabs, the tab is re-running the query and rebuilding the report or subreport.  Is there a way to prevent this and just display the already-rendered report?

    start with storing the report in session so that it uses the session object on each postback (paging, drilling, etc all cause postbacks) instead of reopening the report each time.

  • Querying the MIB for estabilished database connectivity

    Hi
    Fairly new to the MIB and its internal workings.
    Can someone explain or provide an exampe ud script to determine database connections that are currently running.
    Configuration currently has the followin database connections:- Oracle 10g, DSM, Supra(IBM) and IDMSX(ICL)
    Take it the above should not make any difference.
    Need to understand what TA_CLASS, TA_OPERATION etc I need to query?
    Regards Sam

    Sam,
    The current state of the connection between a Tuxedo server and its
    asssociated resource manager is not part of the information offered by
    tmadmin or by the Tuxedo MIB, so the best way to obtain this information is
    by querying the database for active connections in its own specific way.
    Another way to obtain this information is to implement a simple service that
    makes one database call and to invoke this service to see if the database
    connection is active.
    It is also possible to perform a GET operation on the T_ULOG TM_MIB class
    and search for specific userlog messages that your application has seen when
    there is a database connection failure.
    Ed
    <Sam Dhooper> wrote in message news:[email protected]..
    Hi
    Fairly new to the MIB and its internal workings.
    Can someone explain or provide an exampe ud script to determine database
    connections that are currently running.
    Configuration currently has the followin database connections:- Oracle 10g,
    DSM, Supra(IBM) and IDMSX(ICL)
    Take it the above should not make any difference.
    Need to understand what TA_CLASS, TA_OPERATION etc I need to query?
    Regards Sam

  • How to query a database file on my hard drive?

    Hi,
    I have a filer called "server.dbs" on my hard drive. It is a database file. I use a simple program that allows you to view databases, and it loads up and I can traverse the database and see all the entries as any standard database.
    So I figured that Java's ability to handle SQL would allow me to make a standard SQL statement querying the database, and be able to get the results. The software stores servers in SID fields, and the value is the port the server runs on. I want to make a simple query to select a server by SID, and print the port in which that server is running on.
    So is there any way to, via my java application, load a database from a file (rather than a url) which has no authentication required, and simply make my queries directly to that file? If so, how?
    Thanks!
    -Josh

    Normal database access is via JDBC.
    http://java.sun.com/docs/books/tutorial/jdbc/index.html
    To use that JDBC driver is needed to access the database. Databases in wide usage all have one. It isn't clear from your posting that you have a common database though.

  • How I can transfer data from the database into a variable (or array)?

    I made my application according to the example (http://corlan.org/2009/06/12/working-in-flash-builder-4-with-flex-and-php/). Everything works fine. I changed one function to query the database - add the two parameters and get the value of the table in String format. A test operation shows that all is ok. If I want to display this value in the text area, I simply drag and drop service to this element in the design mode
    (<s:TextArea x="153" y="435" id="nameText" text="{getDataMeanResult.lastResult[0].name}"  width="296" height="89"  />).
    It also works fine, just a warning and encouraged to use ArrayCollection.getItemAt().
    Now I want to send the value to a variable or array, but in both cases I get an error: TypeError: Error #1010: A term is undefined and has no properties..
    How can I pass a value from the database into a variable? Thank you.
    public var nameTemp:String;
    getDataMeanResult.token = authors.getDataMean(arrayOfNumber[0], dir_id);
    nameTemp = getDataMeanResult.lastResult[0].name;
    public var nameArray:Array = new Array();
    for (var i:uint=o; i<3; i++){
    getDataMeanResult.token = authors.getDataMean(arrayOfNumber[i], dir_id);
    nameArray[i] = getDataMeanResult.lastResult[0].name;
    And how i can use syntax highlighting in this forum?

    Astraport2012 wrote:
    I have to go back to the discussion. The above example works fine when i want to get a single value of the database. But i need to pass an array and get an array, because i want to get at once all the values for all pictures tooltips. I rewrote the proposed Matt PHP-script and it works. However, i can not display the resulting array.
    yep, it won't work for Arrays, you'll have to do something slightly more intelligent for them.
    easiest way would be to get your PHP to generate XML, then read that into something like an ArrayList on your HTTPService result event (depends what you're doing with it).
    for example, you could have the PHP generate XML such as:
    <pictures>
         <location>test1.png</location>
         <location>test2.png</location>
         <location>test3.png</location>
         <location>test4.png</location>
         <location>test5.png</location>
         <location>test6.png</location>
    </pictures>
    then you'll read that in as the ResultEvent, and perform something like this on it
    private var tempAC:ArrayList = new ArrayList
    protected function getStuff_resultHandler(event:ResultEvent):void
        for each(var item:Object in event.result.pictures)
           var temp:String = (item.@location).toString();
           tempAC.addItem(temp);
    in my example on cookies
    http://www.mattlefevre.com/viewExample.php?tut=flash4PHP&proj=Using%20Cookies
    you'll see an example of how to format an XML structure containing multiple values:
    if($_COOKIE["firstName"])
            print "<stored>true</stored>";
            print "<userInfo>
                    <firstName>".$_COOKIE["firstName"]."</firstName>
                    <lastName>".$_COOKIE["lastName"]."</lastName>
                    <userAge>".$_COOKIE["userAge"]."</userAge>
                    <gender>".$_COOKIE["gender"]."</gender>
                   </userInfo>";
        else
            print "<stored>false</stored>";
    which i handle like so
    if(event.result.stored == true)
                        entryPanel.title = "Welcome back " + event.result.userInfo.firstName + " " + event.result.userInfo.lastName;
                        firstName.text = event.result.userInfo.firstName;
                        lastName.text = event.result.userInfo.lastName;
                        userAge.value = event.result.userInfo.userAge;
                        userGender.selectedIndex = event.result.userInfo.gender;
    depends on what type of Array you're after
    from the sounds of it (with the mention of picture tooltips) you're trying to create a gallery with an image, and a tooltip.
    so i'd probably adopt something like
    <picture>
         <location>example1.png</location>
         <tooltip>tooltip for picture #1</tooltip>
    </picture>
    <picture>
         <location>example2.png</location>
         <tooltip>tooltip for picture #2</tooltip>
    </picture>
    <picture>
         <location>example3.png</location>
         <tooltip>tooltip for picture #3</tooltip>
    </picture>
    etc...
    or
    <picture location="example1.png" tooltip="tooltip for picture #1"/>
    <picture location="example2.png" tooltip="tooltip for picture #2"/>
    <picture location="example3.png" tooltip="tooltip for picture #3"/>
    etc...

  • End-of-file in communication channel while querying the data

    We are using ColdFusion(Windows) to access an Oracle - 8.1.7
    database. I have context indexes setup on the data for search
    purposes.
    If I use a package to query the database and return some values,
    when many people use the call to the package I get the following
    error:
    End-of-file in commnuication channel
    And many other users lose connection to the database. The
    database, however does not go down.
    The same logic works well on the development database where
    traffic is less.
    If we replace the stored proc call by the individual sql
    statements there are no problems. Due to complexity of the
    program, I would like to use stored procs instead of sql
    statements in the ColdFusion code.
    Does anyone have any suggestions?

    07445:exception encountered:core dump [kopedga()+200] [SIGSEGV]
    [Address not mapped to object] ....
    ORA-7445 is a core dump (segmentation fault) and is a bug in the
    database.
    You have now the following options:
    If you have metalink access:
    1. You can have a look if you find a bug entry and then see
    when it will be fixed (e.g. search for 'ORA-7445 kopedga').
    2. Create an iTAR in Metalink.
    If you don't have metalink access:
    3. Use the latest patchset and try again and hope that it is
    fixed.
    Regards,
    Thomas

  • Filter API will hit the database if not found in Cache???

    I wrote a sample program using Filter API i.e. LikeFilter, EqualsFilter which will query the cache (i.e. Map in memory) based on the criteria. But what if it doesn't found the entries in Cache . Will it then query the database with similar criteria.
    I don't think so ... Please correct me if i am wrong.
    I need to implement Pre-loading the cache and the link http://download.oracle.com/docs/cd/E14526_01/coh.350/e14509/preloadcache.htm#CACCFCFJ
    use the Filter API. I am not sure if i can rely on pre-loading the cache from database.
    Any sample example preloading the data from database into cache will be greatly appreciated
    Regards,
    Bansi

    Then you won't need the Invokable code (anyway its owned by my employer ;-)
    All you need to do is write a simple program something like this :
    1. Query everything from the database "select * from table"
    2. Iterate through the ResultSet converting them all into objects
    3. Cache.put() these objects into Coherence.
    Now some optimisations. Re :
    1. You have a single query going to the database and will be connecting to a single cluster member. You could divide the query up by some logical division (eg. Customer / Date etc.) and then have many clients putting in concurrently, but it raises the complexity.
    2. It is also possible to store List tuples in Coherence, I once worked on a very nice project along those lines.
    3. Cache.putAll() is much faster than put() and you should batch these into sizes of 1000 for maximum performance.
    However, I would ignore these optimisations for now (tho 3. is the most useful).
    You will have to manually kick off this process when you restart your cluster (or put it in your startup script). People generally write a cluster restart script. Tho JavaServiceWrapper is very nice for restarting nodes that run out of memory. When you get really complicated you can use something like FabricServer to dynamically control your cluster, but lets get the basics working now.
    Best, Andrew.

Maybe you are looking for

  • Excel download with multiple worksheets using ABAP webdynpro

    Content of Internal table should to downloaded  to an excel sheet with multiple worksheet.

  • Please add keyboard focus events to swing calculator.  Its very argent.

    import java.awt.*; import java.awt.event.*; import javax.swing.*; A frame with a calculator panel. class CalculatorFrame1 extends JFrame      private static final long serialVersionUID=0; public CalculatorFrame1() setTitle("Calculator"); Container co

  • Converting Scope_Identity from tsql to pl\sql

    Here is my MS proc: CREATE Procedure [dbo].[sp_AddLabel] @v_LabelName NVARCHAR(50) = Null,           @v_LabelDescription NVARCHAR(255)= Null,           @v_Label_Data IMAGE = NULL,           @v_ProfileID SMALLINT) As begin      INSERT INTO LABELS (LAB

  • Clarity required on these questions pls help?

    HI , Need your help in solving these questions, these are questions asked in during interviews a) Dyamic actions, how to create a customer specific dynamic action , specify configured fields and rules? b) how to create Customer specific infotype, , p

  • Sun Relax NG converter

    I am trying to use the Sun Relax NG Converter version 20030225 but get some exceptions. C:\Dev\TheWineCellarBook\xml\sunconverter>java -jar rngconv.jar wineXML.xsd > wineXML.rng Exception in thread "main" java.lang.ClassCastException at com.sun.msv.d