Monday, December 25, 2006

BC4J:Various ways to get DBTransactionImpl handle.

DBTransactionImpl has various advantages like proividing the preparedStatements/callableStatements etc very easily to the developers.

Here are few different ways to get the handle to the ADF BC DBTransactionImpl.Different ways suited for different types of applications.

Through ApplicationModule:
Once we get handle to the ApplicationModule(Mostly using COnfiguration), we can easily get a handle to the DBTransaction using

am.getDBTransaction();
This would be the most common way Apps developers would use.

Through Datasource:
At times, we use datasources in our applications.In that scenario, we can still take advantage to DBtransactionImpl.


// Get an initial JNDI context for locating the driver and
// database
Context ctext = new InitialContext();

// Get a DataSource object for the driver and database
// associated with a logical name
DataSource ds =
(DataSource)ctext.lookup("jdbc/logical_name_for_DB");

DBtransactionImpl txn = new DBtransactionImpl(ds);


Through java.sql.Connection:
At times, we use plain JDBC URL to get the connection objects in our applications.In that scenario, we can still take advantage to DBtransactionImpl.


// Get the JDBC connection object
Class.forName ("oracle.jdbc.driver.OracleDriver");

Connection conn =DriverManager.getConnection("jdbc:oracle:thin:@ap618sdb.us.oracle.com:20015:ssfdev","apps","apps");

DBtransactionImpl txn = new DBtransactionImpl(conn);


Through Datasource and java.sql.Connection:


// Get an initial JNDI context for locating the driver and
// database
Context ctext = new InitialContext();

// Get a DataSource object for the driver and database
// associated with a logical name
DataSource ds =
(DataSource)ctext.lookup("jdbc/logical_name_for_DB");

// Now, get the connection
Connection conn = ds.getConnection("username","password");

DBtransactionImpl txn = new DBtransactionImpl(conn);

Tuesday, December 12, 2006

RDBMS:Tablespace Size revisited

At times, we encounter issues around tablespace size. Here are few handy queries using which we can do a first hand analysis of the tablespace size and other related information.

Sample error message related to tablespace, while uploading huge data comes as below..


ORA-01653: unable to extend table [TABLE_NAME] by 128 in tablespace [TABLESPACE_NAME]


To know the size of a tablespace.

select sum(bytes)/1024/1024 tbspace_size from dba_data_files where
tablespace_name=
'[TABLESPACE_NAME]';

To know the free space size of a tablespace.

select sum(bytes)/1024/1024 from dba_free_space where
tablespace_name=
'[TABLESPACE_NAME]';

Identify the Temp Tablespace size used for sorting,hashing etc

select decode(count(1),0,'Empty Temp Tablespace',sum(bytes)) Temp_Table_Space_Size_In_Bytes
from dba_temp_files where status =
'[TABLESPACE_NAME]';

Oracle Reports:Convert a rdf to XML for extracting information

At times, we may need to extract information from an oracle report (i.e an .rdf file). Its not easy to read the contents of the .rep and parse because of its nature of plain text.

$ORACLE_HOME/bin/rwconverter scott/tiger@sid stype=rdffile source=MYRDF.rdf dtype=xmlfile dest=MYRDF.xml batch=yes overwrite=yes

After then, either apply an XSL to the XMl to present the data in an HTML format
or parse the XML file to extract the required information and print/store.

Tuesday, December 05, 2006

RDBMS:Oracle:Know physical size of DB objects

This is the query through which we can know the physical space occupied by the DB objects in Oracle for a schema. This returns the size in MB.

select segment_name,sum(bytes)/1024/1024 "SIZE in MB"
from dba_extents
where owner = 'OWNER_NAME'
group by segment_name

UnitTesting:JTestcase and Jetif

JTestcase is an open source software which takes the Testdata in an XML format and generates the testcases automatically. It have a no of simple APIs which we need to use to extract the testdata from the XML file and use them in the Testcase file.
Once testcase gets created, then without changing the Testcase java file, we can keep adding the Testdata in the XML file. So this separates the Testdata and the Testcase java file.


Jetif is a higher level open source software which requires very little code to be written as compared to Junit and JTestcase.

Below table shows the feature difference between Jetif and JUnit + JTestCase.

Feature Jetif JUnit + JTestCase
Sepearate test code and data Supported by Handler Supported by JTestCase or other mechanism
Parameters & Return Value Supported by Handler No
Logging Yes Supported by extension
DataTypes Limited built-in supported, extendable by user Limited supported
Client/Server Testing Yes Supported by extension

Code Comparison

You can create more straightforward test code with Jetif, because the parameters and return value in test method are supported by Jetif. For example, a test method can be writtern as below with Jetif:

public boolean testSomething(float param1, String[] param2, Integer param3){
// Test something with the param1, param2, param3
return true;
}

While a test method can only be writtern as below with JUnit + JTestCase:

public void testSomething() {
// get the test cases from XML
Vector testCases = _jtestcase.getNameOfTestCases("testSomething");
// for each test case execute
With Jetif, you can define the parameters and expected return value in spec file, and then just use them as parameters and return a value what you want in test code, it's more simple and more clear than JUnit.

http://jetif.sourceforge.net/docs/comparison.html
http://jetif.sourceforge.net/

Thursday, November 23, 2006

General:Windows Update nagging you to restart after an update

After Windows Automatic Updates has downloaded updates to your computer, it may display a dialog that says: "Updating your computer is almost complete. You must restart your computer for the updates to take effect. Do you want to restart your computer now?" Its painful, if you are in the midst of an importantb stuff(assume, everybody is!!)

Solution:

Click Start, Run and enter the command net stop wuauserv

This will stop the Windows Update service until the next restart of the computer, which will stop the reminders to restart your computer for this update.

XP professional:
-------------------
1)-Start->Run . Type gpedit.msc
2)-Computer Configuration->Administrative templates->Windows Component->Windows Update->
3)-Double click on last but 1 entry.
4)-
Choose "Enable". Specify the minutes "1440".
Apply


Relaxed till the next restart of the computer or laptop.

Friday, November 17, 2006

Science:Bernoulli's challenge and Newton

In 1696 John Bernoulli challenged mathematicians
(i) to determine the brachistochrone, and
(ii) to find a curve such that if any line drawn from a fixed point O cut it in P and Q then OP^n+OQ^n would be constant.

Leibnitz solved the first of these questions after an interval of rather more than six months, and then suggested that they be sent as a challenge to Newton and others. Newton received the problems on Jan. 29, 1697, and the next day gave the complete solutions to both, at the same time generalising the second question. An almost exactly similar case occurred in 1716 when Newton was asked to find the orthogonal trajectory of a family of curves. In five hours Newton solved the problem in the form in which it was propounded to him, and laid down the principles for finding trajectories i.e integral calculus

Science:Newton vs. Leibniz- The Calculus Controversy

Like most discoveries, calculus was the culmination of centuries of work rather than an instant epiphany. Mathematicians all over the world contributed to its development, but the two most recognized discoverers of calculus are Isaac Newton and Gottfried Wilhelm Leibniz. Although the credit is currently given to both men, there was a time when the debate over which of them truly deserved the recognition was both heated and widespread.

As the renowned author of Principia (1687) as well as a host of equally esteemed published works, it appears that Newton not only went much further in exploring the applications of calculus than Leibniz did, but he also ventured down a different road. Leibniz and Newton had very different views of calculus in that Newton’s was based on limits and concrete reality, while Leibniz focused more on the infinite and the abstract (Struik, 1948). However, regardless of the divergent paths these two scholars chose to venture down, the question of who took the first step remained the primary issue of debate.

Unaware that Newton was reported to have discovered similar methods, Leibniz discovered “his” calculus in Paris between 1673 and 1676 (Ball, 1908). By 1676, Leibniz realized that he was onto something “big”; he just didn’t realize that Newton was on to the same big discovery because Newton was remaining somewhat tight lipped about his breakthroughs. In fact, it was actually the delayed publication of Newton’s findings that caused the entire controversy. Leibniz published the first account of differential calculus in 1684 and then published the explanation of integral calculus in 1686 (Boyer, 1968).

Newton did not publish his findings until 1687. Yet evidence shows that Newton discovered his theories of fluxional calculus in 1665 and 1666, after having studied the work of other mathematicians such as Barrows and Wallis (Struik, 1948).. Evidence also shows that Newton was the first to establish the general method called the "theory of fluxions" was the first to state the fundamental theorem of calculus and was also the first to explore applications of both integration and differentiation in a single work (Struik, 1948). However, since Leibniz was the first to publish a dissertation on calculus, he was given the total credit for the discovery for a number of years. This later led, of course, to accusations of plagiarism being hurled relentlessly in the direction of Leibniz.

There was speculation that Leibniz may have gleaned some of his insights from two of Newton's manuscripts on fluxions, and that that is what sparked his understanding of calculus. Many believed that Leibniz used Newton's unpublished ideas, created a new notation and then published it as his own, which would obviously constitute plagiarism. The rumor that Leibniz may have seen some of Newton's manuscripts left little doubt in most people’s minds as to whether or not Leibniz arrived at his conclusions independently. The rumor was, after all, believable because Newton had admittedly bounced his ideas off a handful of colleagues, some of who were also in close contact with Leibniz (Boyer, 1968).

It is also known that Leibniz and Newton corresponded by letter quite regularly, and they most often discussed the subject of mathematics (Boyer, 1968). In fact, Newton first described his methods, formulas and concepts of calculus, including his binomial theorem, fluxions and tangents, in letters he wrote to Leibniz (Ball, 1908). However an examination of Leibniz' unpublished manuscripts provided evidence that despite his correspondence with Newton, he had come to his own conclusions about calculus already. The letters may then, have merely helped Leibniz to expand upon his own initial ideas.

The question of the date at which these extracts were made is therefore all important. It is known that a copy of Newton's manuscript had been sent to Tschirnhausen in May, 1675, and as in that year he and Leibniz were engaged together on a piece of work, it is not impossible that these extracts were made then. It is also possible that they may have been made in 1676, for Leibniz discussed the question of analysis by infinite series with Collins and Oldenburg in that year, and it is a priori probable that they would have then shown him the manuscript of Newton on that subject, a copy of which was possessed by one or both of them. On the other hand it may be supposed that Leibniz made the extracts from the printed copy in or after 1704. Leibniz shortly before his death admitted in a letter to Conti that in 1676 Collins had shown him some Newtonian papers, but implied that they were of little or no value, - presumably he referred to Newton's letters of June 13 and Oct. 24, 1676, and to the letter of Dec. 10, 1672, on the method of tangents, extracts from which accompanied the letter of June 13, - but it is remarkable that, on the receipt of these letters, Leibniz should have made no further inquiries, unless he was already aware from other sources of the method followed by Newton (Ball, 1908).

While Newton had many allies rallying in his favor, Leibniz had only one: John Bernoulli, who in a letter, tried to cast doubt upon Newton’s credibility. When Bernoulli was later asked to comment on the letter, he denied ever writing it, which caused Newton to aver: I have never grasped at fame among foreign nations, but I am very desirous to preserve my character for honesty, which the author of that epistle, as if by the authority of a great judge, had endeavored to wrest from me. Now that I am old, I have little pleasure in mathematical studies, and I have never tried to propagate my opinions over the world, but I have rather taken care not to involve myself in disputes on account of them (Ball, 1908).

In 1715, just a year before Leibniz death, the Royal Society handed down their verdict crediting Sir Isaac Newton with the discovery of calculus. It was also stated that Leibniz was guilty of plagiarism because of certain letters he was supposed to have seen (Ball, 1908). It later became known that these accusations were false, and both men were then given credit, but not until after Leibniz had already died. In fact, the controversy over who really deserved the credit for discovering calculus continued to rage on long after Leibniz’ death in 1716 (Struik, 1948). Newton and his associates even tried to get the ambassadors of the London diplomatic corps to review his old manuscripts and letters, in the hopes that they would endorse the finding of the Royal Society that Leibniz had plagiarized his findings regarding calculus. Another argument on the side promoting the idea of Leibniz as a plagiarist was the fact that he used an alternate set of symbols. Leibniz specifically set out to develop a more meticulous notation system than Newton’s, and he developed the integral sign ( I ) and the 'd' sign, which are still used today (O’Connor, 1996) However this action was argued by many to be merely a way for Leibniz to “cover his tracks” so as not to get accused of stealing Newton’s material (Boyer, 1968). The fact that the method was more efficient was considered to be an ancillary benefit. The fact is that Leibniz sent letters to Newton outlining his own presentation of his own methods, and these letters focused quite stringently upon the subject of tangents and curves. Because Newton had been approaching calculus primarily in regards to its applications to physics, he purported curves to be the creation of the motion of points while perceiving velocity to be the primary derivative. Conversely, the calculus of Leibniz was applied more to discoveries in geometry made by scholars such as Descartes and Pascal. Since "Leibniz' approach was geometrical," the notation of the differential calculus and many of the general rules for calculating derivatives are still used today, while Newton's approach, which has in many aspects, fallen by the wayside, was "primarily cinematical" (Struik, 1948).

Despite the ruling of the Royal Society, mathematics throughout the eighteenth century was typified by an elaboration of the differential and integral calculus in which mathematicians generally discarded Newton's fluxional calculus in favor of the new methods presented by Leibniz. Nevertheless, in England, the controversy was viewed as an attempt to pilfer Newton's glory simply because of international egotism. Consequently, as a matter of “national pride”, England refused to teach anything but Newton’s discoveries of geometrical and fluxional methods for over a century. So while other countries were integrating various findings that occurred over time and were progressing in their discoveries, England remained essentially stagnant in the realm of mathematic discovery. In fact, it wasn’t until 1820 that England finally agreed to recognize the work of mathematicians from any other countries (Ball, 1908).

With modern controversies covering such volatile topics as abortion and gun control, a debate over who discovered calculus may seem somewhat trivial by contemporary standards. However at the time, this was a serious issue that not only involved matters of mathematical discovery but also matters of national pride and allegiance. What is important to keep in perspective is that no matter who actually discovered calculus first, both Newton and Leibniz made great contributions to the advancement of mathematical processes, and both deserve credit for that.

Thursday, November 16, 2006

BC4J:EOImpl.revert()

EOImpl.revert() method:
-----------------------
Calling this method will either reset the attribute values to their database
values or revert them to their default values. If the Entity Object is
posted, all the attributes revert to the unread state, so that a subsequent
getAttribute() call will refresh all attributes from the database.

It internally calls

  EOImpl.refresh(REFRESH_WITH_DB_FORGET_CHANGES)

Wednesday, November 15, 2006

Oracle Apps:Concurrent programs different Execution Methods

Following are the possible execution methods which are commonly used in oracle applications Concurrent programs.

  • * Oracle Reports – used for the RDF reports
  • * Host – used for shell scripts, basically the language of the host operating system
  • * PL/SQL Stored procedure – used to run the stored procedure through oracle applications
  • * SQL*Loader – used to run the sql loader programs
  • * SQL*Plus - used to run the anonymous PL/SQL blocks. It will get executed in the same fashion as
  • you are running on SQL Plus.
  • * Java Stored Procedure – The execution file is a Java stored procedure.
  • * Java Concurrent Program – Used for program written in Java.
  • * Spawned – used for c or pro*c Program. Mainly used by standard oracle interfaces.
  • * Perl Concurrent Program – used for programs written in CGI Perl.
  • * Request Set Stage Function – PL/SQL stored function that can be used to calculate the
  • completion statuses of request set stages.
  • * Immediate – execution file is a program written to run as subroutine of the concurrent manager.
  • Oracle doesn’t recommend use of this executable type.
  • * Multi-Language function – execution file is an MLS function that supports running concurrent program in multiple languages.

PL/SQL Stored Procedure, Oracle Reports, Host, SQL*loader, SQL*Plus, Java Concurrent Program are the most commonly used executable types.

Tuesday, November 14, 2006

General:Retreive back hidden windows task-bar

In WIndows-XP and 2000, sometimes the taskbar gets hidden. Its because of

1)-Multiple Hanged Windows Explorer Programs
2)-Low virtual memory when the CPU utilization is around 100%.

Its really irritating.
Here are the steps to get the same back.

1)-CTRL+ALT+DEL.
2)-Task Manager
3)-Close all the windows explorer programs.
4)-Click on "Run New Task".
5)-Type "Explorer".

That should bring up the Hidden task Bar.

Tuesday, November 07, 2006

J2EE:Creating POJOs from Database tables using Oracle Toplink feature

Maynot be a frequent requirement, but sometimes developers may need to create Plain Old Java Objects(POJOs) out of Database Tables.This can be easily created by using the Oracle Toplink feature available in JDeveloper.

1)-Create a new Application, say ToplinkResearch.
2)-Add a project to this Application, say ToplinkResearch.
3)-Click New->Business Components->select Toplink/JPA.
4)-It will ask for the Database connection and at the same time an offline database
schema it asks for to maintain in the middle-tier.(You can create at the same time
as well!!)
5)-Select the Table name from the List, just we select for an Entity Object.
6)-Thats all and the POJO is created and ready to be compiled.
7)-This class can be refactored to be used in any other project.
8)-Right click on the POJO class and select "New Sample Java Client.." and it will
create a sample Java client that uses this POJO(However, in JM8, this client class
gives runtime exception).


Monday, November 06, 2006

BC4J:Understanding EODefImpl class

Most of the time, while creating an EO, we choose the custom EOImpl class to be generated. In the same EO wizard->Java Panel, we have another option of "Create DefImpl class".So whats this?
EODefImpl class, bahaves as the "home" or "factory" for the Entity Object. We can define custom, factory level methods(mostly the validation methods for the entire set of rows in the VO cache and/or in the underlying DB table).

Every EOImpl.java has a method like below..

/**Retrieves the definition object for this instance class.
*/
public static synchronized EntityDefImpl getDefinitionObject() {
if (mDefinitionObject == null) {
mDefinitionObject = (EntityDefImpl)EntityDefImpl.findDefObject("oracle.apps.fusion.schema.server.CustomerEO");
}
return mDefinitionObject;
}

This is where the handle to the Home or factory i.e the DefImpl class is obtained.
How to make use of a user defined DefImpl class method in the base EOImpl.class.

Here is an example
CustomerDefImpl home = (CustomerDefImpl)CustomerImpl.getDefinitionObject();
if(home != null &&
home.existsDuplicateCutomerEmail(this.getDBTransaction(), getCustEmail()))
{
raise JboException;
}

Thursday, November 02, 2006

Groovy:Expression Example Codes

Below are few example codes for the Groovy Expressions.

1)-Use of Boolean expression
def x = false
return x


2)-Use of IF statement
def x= newValue
if (x <>
return true;
else
return false;


3)-Use of ArrayList
def myList=[10,20,30,40,50]
if(myList.get(2) == 30){
return false
}
else{
return true
}


4)-Use of HashMap
def myMap=[1:"A",2:"B", 3:"C"]
if(myMap[2] == null){
return false
}
else{
return true
}

http://groovy.codehaus.org/Tutorial+1+-+Getting+started

JDeveloper:Autogenerate Javadoc comments

----------------------------
We can create Javadoc automatically for any methods we want in a class.
1)-Click on the Java file.
2)-Double Click on any method name.
e.g public void doDML()
select "doDML" word by double clicking the left mouse button.
3)-Select Source->Add Javadoc comments from the menu on top.

JDeveloper:Override Methods

-------------------------------
Often times we need to override methods in java classes, e.g. for classes like VOImpl, VORowImpl, EOImpl, AMImpl etc etc. So how do you find the methods and their signatures.
I used to do this by typing "this." which popsup the method list popup and then select the method, else by going through Javadoc and typing the method signature.

But this is fairly simple..
1)-Open the required java file in the editor.
2)-Click on "Source" from meny , then "Override Methods".
3)-Select one or multiple methods and it will create the empty body methods with the signatures.

It also provides an annotation called "@Override" just before the method signature.

Wednesday, November 01, 2006

JDBC:A framework for calling a stored procedure.

Here is a generic code snippet for calling a PLSQL stored procedure using JDBC.
It takes the stored procedure callablestatement and an array of variables which need to be passed to this procedure.

 protected void callStoredProcedure(String stmt, Object[] bindVars) {
PreparedStatement st = null;
try {
st = getConnection().createPreparedStatement("begin " + stmt + "; end;", 0);
if (bindVars != null) {
for (int z = 0; z != bindVars.length-1; z++) {
st.setObject(z + 1, bindVars[z]);
}
}
st.executeUpdate();
} catch (SQLException e) {
throw new SQLException(e);
} finally {
if (st != null) {
try {
st.close();
} catch (SQLException e) {
}
}
}
}

Tuesday, October 31, 2006

Spring Framework:The advantages

Spring Framework:
----------------
The main aim of Spring framework is to elliminate the complexities of writing a complex J2EE application.e.g in a typical J2EE env, if you want to access EJB, then Spring takes away the pain of using JNDI or if you need to use JDBC, then it takes away the pain of using "try" "catch" "finally" blocks etc.

1)-Helps designing and organizing the components(web-tier as well as
the server side bsuiness components) in a much layered manner(Just like BC4J, but more than that)
2)-It uses simple POJOs as the business logic class instead of EJBs.
3)-It has got a greater support for Dependency Injection as each layer of
code in Spring framework works in isolations. So essentially developers
can pull out any layer and test them in isolation.
4)-It has a great JDBC wrapper in it.
5)-It has Inversion of Control container and AOP.(Please google for these two terms)
6)-Most importantly, it provides an env to have a Test Driven Development.


Listen to this webcast by Rod Johson, the founder of Spring Framework.

BC4J:transaction-level postChanges() is hazardous!!

The transaction-level postChanges() method that exists to force the transaction to post unvalidated changes without committing them is not recommended for use in web applications unless you can guarantee that the transaction will definitely be committed or rolled-back during the same HTTP request. Failure to heed this advice can lead to strange results in an environment where both application modules and database connections can be pooled and shared serially by multiple different clients.

Friday, October 27, 2006

Gen Tech:How to copy HTML data from browser to an Excel sheet.

There is a pretty simple way of exporting an HTML data into an Excel file without much effort of writing any program.
I have tested many times and it works.
Note: It works only in IE.

Please follow the steps below.
  • 1)-Open MS Excel in your pc and keep it in taskbar.
  • 2)-Access any URL which gives an HTML table output.
  • 3)-Select the whole of the data you want to export.
  • 4)-After selecting just see the mouse where it is. DOnt move the mouse and by pressing the left button drag the mouse towards the taskbar to the top of the Excel icon.
  • 5)-Dont yet release the mouse even if the mouse icon changes.
  • 6)-Keep the left button pressed and keep on top of the excel button.It automatically maximizes the Excel spreadsheet.
  • 7)-Dont release the mouse button in the whole process.
  • 8 )-Just drag the mouse with left button pressed towards the start of the Excel sheet and release the mouse button.
  • Thats all..
  • The whole trick is not to release the left mouse button.
  • Please try in IE and see if it helps you. I have tried number of times.

Thursday, October 19, 2006

Oracle Apps:Programmatically Compile a KFF View

Sometimes its required an API to call from our PL/SQL package to compile the KFV view in Apps.
request_id := fnd_request.submit_request('FND',
'FDFCMPK',
'Compiling Flexfield',
SYSDATE,
FALSE,
'K', -- Type of FF
, -- Application short name
p_ff_name, -- FF name
TO_CHAR(l_flex_num) -- ID_Flex_Num);

Wednesday, October 18, 2006

Java:Programmatically compiling a java file

The class com.sun.tools.javac.Main.compile provides the programming interface for javac.
sample code is :

int errorCode = com.sun.tools.javac.Main.compile(new String[] {
"-classpath", "bin",
"-d", "/temp/dynacode_classes",
"dynacode/sample/Foo.java" });

errorCode return 0 for Sucess and some non-zero number for any compilation failure.

Also to print the compilation error messages to an o/p file,
it has another overloaded method.

// Defined in com.sun.tools.javac.Main
public static int compile(String[] args);
public static int compile(String[] args, PrintWriter out);

Perl: XML Parsing program in Perl using XML module

Here is a sample code snippet on how we can easily parse an XML doc in PERL (tested in Linux).


#!usr/local/bin/perl

##Programs for XML parsing.

use XML::Parser;

my $p = XML::Parser->new(Style => "Tree");
my $input = '/home/ammishra/perl/ip.xml';


traverse( $p->parsefile( $input ) );
exit(0);


sub traverse
{
my $node = shift;
while ( defined ( my $element = shift @{ $node } ))
{
my $child = shift @{ $node };
if ( ref $child ) # if $child is yet another arrayref node
{
my %attr = %{ shift @{ $child } };
# yank the attributes out of the grandchild
print "$element has attributes @{[ %attr ]}\n";
traverse( $child );
# child element is now just a list of element/children pairs
}
else # otherwise, if $child is just some text
{
print "$child\n";
}
}
}

BC4J+OA Framework:Get number of rows in a ViewObject without fetching all rows to middletier

In BC4J(Business Component for Java),Lets assume, we have a View Object(VO) based on a SQL.
The code below prints i as "0" i.e no rows are fetched to the middle tier.

vo.setMaxFetchSize(-1);
vo.executeQuery();
int i = vo.getFetchedRowCount();
System.out.println("i="+i);

Now use
getRowCount() instead of getFetchedRowCount();
and it would print correct no of records.

Explanation:
------------
executeQuery() doesn't actually fetch the first batch of rows right then and there. The next operation that requires a query (such as first(), for example) will do this. getRowCount() forces the last() row to be retrieved. But getRowCount() might be a costly affair in cases where we dont want the rows to be fetched from the DB, say we just want the count.

using getEstimatedRowCount() if you want the count without fetching all the rows, solves the same purpose.



Oracle Apps:Open a Conc program Output in your favourite Program

There is a profile option called "Viewer:Application for Text" in Apps.
Logon to Oracle Applications , use System Administrator Responsibility and Navigate as :-
Install -> Viewer Options
to open the Form "Viewer Options"

Then do the entry as shown below :-

File Format Mime Type Description
Text application/msword Microsoft Word(.doc)
Text application/vnd.ms-excel Excel (.xls)
Text text/plain Notepad(.txt)

Then ensure that the profile option
Viewer: Application for Text
is set to BLANK at the Site Level.

Then ensure that the profile option
Viewer: Text
is set to Browser at the Site Level

Submit a Concurrent Request that generates Text Output File
Click on View Output Button
You will see a LOV showing
Microsoft Word(.doc)
Excel (.xls)
Notepad(.txt)