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.
Similar Messages
-
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....... -
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!
-JoshNormal 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 to query the Date/Time Dataype
Hi,
I am trying to query the database with Data/Time Datatype.
String date=request.getParameter("date");
String month=request.getParameter("month");
String year=request.getParameter("year");
String tosearch=month+"/"+date+"/"+year;
String getTable="select * from tableRes where dmy='"+tosearch+"'";I would like to know why it is not working?
I ran through tomcat and it appeared this error:
Data type mismatch in criteria expression.
Thanks!pramudya81 wrote:
Rock,
May I know more detail on your specs?
What is your DB? Or how is exactly you execute the sql.
to_date is anyway an Oracle syntax.
So I guess your DB might be an SQL Server.
to_date for oracle is equivalent as Convert in SQL Server
example Select Convert(datetime ,'2002/01/01')
Hope it works nowBad idea. See reply 1. -
How to Query a database table of a remote system in a program.
How to Query a database table of a remote system in a program.
Thanks in adv.
-Satish1.Create an RFC(SE37) in Source (To Where you want to get data)
IMPORTING MATNR
EXPORTING : SYS TYPE SY-SYID
I_MARA TYPE MARA
SELECT SINGLE * FROM MARA INTO I_MARA WHERE MATNR EQ MATNR
2.Copy the same RFC to Target(From Where you want to get data)
3.Create a RFC destination(SM59.) in Source
Enter the connection type as 3 and enter the target host and system number ( may be 00)
4.Create a program to calling RFC in Source.
PARAMETERS: p_matnr LIKE mara-matnr.
PARAMETERS: p_dest LIKE rfcdes-rfcdest DEFAULT 'NONE'.
DATA: system LIKE sy-sysid.
DATA :i_mara TYPE mara.
CALL FUNCTION 'XX_RFC_GET_TEST' DESTINATION p_dest
EXPORTING
matnr = p_matnr
IMPORTING
sys = system
i_mara = i_mara
:-Gopeekrishnan -
How to query the Product short code of EBS products?
I need to get all the Product short code of all EBS products. Is there any table record such kinds of short codes? thanks!
Hi,
However, these product codes are not associated with corresponding products and product families.
do you know how to query the product name , product short codes and product familiy together?Script to get Codelevels Summary in R12 and 11i
Re: Script to get Codelevels Summary in R12 and 11i
PS: all these tables are public to query or just allow oracle internal usage?As Apps user, you should be able to query these tables. For other database users, you need to check if the users have select privilege to access the tables or not.
Regards,
Hussein -
How to recover the database when some of the archive log file get deleted.
I am facing a problem with Oracle database, which is related to archivelogs.
Our development database is running in archivelog mode, but we don't have backups scheduled and have no recovery catalog.
When the database was in running condition, disk got full, so some archivelogs were deleted manually.
After this they restarted the DB, and now DB is not coming up. Errors are as follows:
SQL> startup
ORACLE instance started.
Total System Global Area 1444383504 bytes
Fixed Size 731920 bytes
Variable Size 486539264 bytes
Database Buffers 956301312 bytes
Redo Buffers 811008 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs;
alter database open resetlogs
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/export/home/oracle/dev/ADVFRW/ADVFRW.system'
SQL> recover datafile '/export/home/oracle/dev/ADVFRW/ADVFRW.system'
ORA-00283: recovery session canceled due to errors
ORA-01610: recovery using the BACKUP CONTROLFILE option must be done
SQL> recover database using backup controlfile;
ORA-00279: change 215548705 generated at 09/02/2008 17:06:10 needed for thread
1
ORA-00289: suggestion :
/export/home/oracle/dev/ADVFRW/ADVFRW.archivelog1/LOG_ADVFRW_1107_1.ARC
ORA-00280: change 215548705 for thread 1 is in sequence #1107
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/export/home/oracle/dev/ADVFRW/ADVFRW.archivelog1/LOG_ADVFRW_1107_1.ARC
ORA-00308: cannot open archived log
'/export/home/oracle/dev/ADVFRW/ADVFRW.archivelog1/LOG_ADVFRW_1107_1.ARC'
ORA-27037: unable to obtain file status
SVR4 Error: 2: No such file or directory
Additional information: 3
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
CANCEL
Media recovery cancelled.
SQL>
1. How to recover the database and bring it online
Any help will be highly appreciated.
With Regards
Hemant Joshi
Edited by: hem_Kec on Sep 7, 2008 9:07 AMHi,
Archive log files are the copies of redolog files.As redo log files are circularly overwritten,oracle generates archive log file of the corresponding redo logfiles being overwritten.So if you have a backup that dates back to 10 am in the morning and if your database creashed at 3 pm,you cannot use the redo log files alone as they have incomplete information.To completely recover the database upto 3 pm,you need archive log files generated between 10 am to 3 pm. In your case since you are missing one archive log file,you cannot perform complete recovery and hence would suffer data loss. -
How to download the database form the call manager 7 to excel?
how to download the database from the call manager 7 to excel document?
No, it never did - the "ask" for the DRS folks to provide unencryption capabilities for their TARs is still out there (several other BUs want this) but so far as I know there's been zero movement on it. I've about given up hope on the DRS folks at this point - pretty clear this isn't a priority for them and I don't see much in the way of any kind of improvements on the product schedule for them at all, this included.
As a side note I've been pushing the Connection product managers to give us off box file system access to limited directories via a proxy service and roles (i.e. similiar to the ODBC proxy but for SFTP access) - armed with this we can provide our own (far superior) disaster recovery tools that work on a pull model instead of the full push DRS is built on - this would get partial backups, individual restores, about 6x increase in performance (more actually - I have a prototype that is hovering right around 10x the speed of DRS end to end), smaller backups, requires less space and resources on the server etc... etc... Fun stuff like doing a full backup on Sunday mornings and deltas every day of the week after that and another full backup Sunday etc... would be possible. Imagine.
I'll probably get more traction with that but it's a long road I'm afraid - as ever, asking your account team to enter a PERs helps - makes it more difficult for the product folks to delay on assigning engineering resources to such efforts. -
How to increase the database size
Hi All ,
Our Client is going to increase their customers from 3.5 million to 5 millions
(12 millions in future ) and there is no increase in the existing licenses..
At present we have very less space in Data base server. We are Going Live at the End of the Month.
How to increase the database size to meet the Client requirements.
we have to increase the No of Processerors etc...
Below are the details of Servers:
System Model: IBM,7040-681
Machine Serial Number: 830D5BF
Processor Type: PowerPC_POWER4
Number Of Processors: 2
Processor Clock Speed: 1904 MHz
CPU Type: 64-bit
Kernel Type: 64-bit
LPAR Info: 4 bgl-svr-biap
Memory Size: 4096 MB
Good Memory Size: 4096 MB
Note : Server is IBM P690.
1) System Lansdcape --> Two System Landsacpe ( Dev to Prod )
2) BW Version --> 3.5
3) SAP Basis --- > 6.4
4) No of Application servers currently having --> Only One Server
Can any body suggest me how to solve this.....
Thanks in Advance..
Kasi ChukkaHi Kasi,
Your question is not very clear, from the looks of it, the load on your client's system will be doubling soon.
You need to look at the system stats on how the system is handling the current load, use transactions ST06, ST04 and ST02 to check if the DB hit ratios are as expected, the cpu idle time, the busy periods. Identify if there is large amounts of paging on the server(candidate for increase in real memory).
On AIX level, you will need to look at CPU / Memory usage.
On SAP Application server, you need to look at SAP Buffers.
On Oracle end, look at SGA stats, if it need to increase, the data growth that is current and estimated growth (DB02).
You will not get an exact answer to it, you will need to analyze the existing load and then estimate (guess). The hardware upgrade will also depend on what the client is willing to spend, its always a good practise to add 20% to what you have estimated as these figures are never accurate.
All the best.
Cheers,
Nisch -
can one tell how to find the database size?
Depends what you mean by database size and how you want the output to look?
Are you referring to the number of rows across all tables of a schema? The number of bytes used by the rows? The number of bytes used by the tablespaces? The number of bytes used by the datafiles? etc. etc. etc. So many options.
Be more clear in your requirements please. -
How to reduce the database size based on MS SQL/Oracle?
Hi,
I had deleted severy clients via SCC5, but the database size is more and more bigger. Do you know how to reduce the database size.
my platform is: NT, MS SQL 2005
NT, Oracle 10.2
Best Regards,
Simon ShenHi Simon,
In the case of SQL you need to check how many space free you have in your datafiles and the based on that you need to Shrink them using DBCC SHRINKFILE command.
Find a couple of reference docs here,
http://www.intermedia.net/support/kb/default.asp?id=996
http://doc.ddart.net/mssql/sql70/dbcc_21.htm
Also i'm pretty sure that if your check the properties of the datafiles in MSSQL Enterprise Manager you get a "Shrink" option.
Regards
Juan
Please reward with points if helpful -
How to specify the database file path when create FDM application
Dear All,
How to specify the database file path (MSSQL) when create FDM application?
Right now, all data file are placed in the D:\ . I want to specify the database files (log and mdf file) in other place. How to do it?
Thanks.Where is the highS2.xml located on the disk? If you add it to your project you should set its Build Action to Content and its Copy To Output Directory to Always in Visual Studio:
Please remember to close your threads by marking helpful posts as answer once your issue has been solved and then start a new thread if you have a new question. -
How to monitor the database growth?
Dear All,
How to monitor the database growth in SAP.
Is there any t.code available to check the same.
advance thanks,
Sundar C
Note: suitable answers will get maximum reward points.Hai,
You can check the database growth using tcode -db02.
and also use tcode-db02old(if the SAP is Netweaver2004s version) and click on space statistics for monitoring the datbase growth,
Thanks and Regards, -
How to get the Database type from weblogic Db connection
I want to use database version control in my application . that means different database type use different Sql Statement. Such as in weblogic7.0 if I create SqlServer JDBC pool then I will use some special Sqlserver sql Statement . such as some join statement. If I create Oralce JDBC pool then I have to use different Sql statement . because these two database support different Sql statement.
What my question is how to get the database type from the connection.For a normal jdbc driver you can use
Connection.getMetaData()
To get the meta data, in particular the getDatabase...() methods.
That might or might not work.
However, at the very least in the server you have access to the weblogic properties so you can parse the pool property to figure it out. -
How to modify the database by Oracle-ridc-client
How to modify the database by Oracle-ridc-client
First of all, from your question it is not very clear what kind of modifications you intend to do - one correct answer to your question could be "call any non-read-only service", which will result as insert/update/delete to a table somewhere. My guess is that this is not the answer you are looking for.
While working with RIDC (or CIS to answer your other thread at once) you have to understand that you integrate primarily with the application layer of your solution. If you want to modify the database scheme, you might, for instance, add a new metadata field - this is OK, because there is a service that you may call to achieve that. On the other hand you might want to change the db scheme directly (e.g. add a new column to a standard table); here neither RIDC, not CIS will help you unless you create a custom (server-side) service that you will call. Note, however, that you should be doing this only if you are really sure what you are doing.
Maybe you are looking for
-
Mac book pro crashes frequently after hibernation
mac book pro OSX10.9.1 , recently the mac book pro has been crashing after recovering from hibernation , Can anyine point to the root cause , here is the crash report panic(cpu 0 caller 0xffffff8004082a76): "Hibernate restore error e00002ca"@/SourceC
-
I tried accessing imovie after not using it for a long time and got an error message "You can't open the application iMovie because it is damaged or incomplete. I'm not sure how to go about addressing it. Your suggestions would be very much apprecai
-
Once I introduce the URL of a portal page,I don4t want to appear the dad and the schema in the URL, I want to appear only the address I introduced first.
-
Hi Friends We are using portals to run reports.When the queries run on Bex analyser, stats recording fine but however when we run the queries on Portals,the stats are not recording. Then I did load data from RSDDSTAT table into 0BWTC_C02 cube.Now no.
-
Existing Adobe master Collection CS5 will not upgrade to CS6
I have an existing installation of Adobe Master Collection CS5. When I try to upgrade to CS6 it does not recognize the CS5 serial number it says it is not a qualifying product. What can I do about it?