Diff b/n CreateStatement and PreparedStatement
Difference Between CreateStatement and PrepareStatement
Which one is Better Performance and why?
Please stop asking about performance in all your questions. There is MUCH more than performance to consider.
createStatement returns a Statement object.
prepareStatement returns a PreparedStatement object.
For reasons including code portability, resolution of data type formatting issues and security it is better to choose PreparedStatement over Statement.
Under some conditions the use of a PreparedStatement will result in better performance, under other conditions the use of Statement will result in better performance. No I will not expand on this because it is not relevent. It is better for you use to PreparedStatement for the reasons listed above and those for your purposes outweigh any performance differences.
Questions regarding Statement vs PreparedStatement have been asked and answered repeatedly in this forum. If you have more question do a search and you will find the answers. You should consider searching on a more regular basis anyway as all your questions are easily answered by searching as all of them have been asked before.
Similar Messages
-
Diff betw SY-LSIND and SY-LILLY
Hi,
Tel me the Diff betw SY-LSIND and SY-LILLY.?
Points wil b rewarded for useful answers.
Thanx in advance.Hi Pavitra
<b>SY-LSIND</b>
Index of the list that is being created (basic list: 0, detail list > 0). Each time an interactive list event occurs, the system automatically increases SY-LSIND by 1. SY-LSIND can be changed in the ABAP program to navigate between detail lists. Changes to SY-LSIND are not taken into account until the end of the list event. Therefore, any manipulation of SY-LISND should be done using the last command of the processing block.
<b>SY-LILLI</b>
Line from which the event was triggered Counting begins at 1 and includes the page header.
and here is one more
<b>SY-LISTI</b>
List Index of the list from which the event was triggered
Regards Rk -
Hi everbody,
what is diff b/w reuse_alv_grid_display and reuse_alv_grid_display_lvc.
can u give a dteils on it .
Regards,
PriyaALV
1. Please give me general info on ALV.
http://www.sapfans.com/forums/viewtopic.php?t=58286
http://www.sapfans.com/forums/viewtopic.php?t=76490
http://www.sapfans.com/forums/viewtopic.php?t=20591
http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
2. How do I program double click in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=11601
http://www.sapfans.com/forums/viewtopic.php?t=23010
3. How do I add subtotals (I have problem to add them)...
http://www.sapfans.com/forums/viewtopic.php?t=20386
http://www.sapfans.com/forums/viewtopic.php?t=85191
http://www.sapfans.com/forums/viewtopic.php?t=88401
http://www.sapfans.com/forums/viewtopic.php?t=17335
4. How to add list heading like top-of-page in ABAP lists?
http://www.sapfans.com/forums/viewtopic.php?t=58775
http://www.sapfans.com/forums/viewtopic.php?t=60550
http://www.sapfans.com/forums/viewtopic.php?t=16629
5. How to print page number / total number of pages X/XX in ALV? http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
http://www.sapfans.com/forums/viewtopic.php?t=64320
http://www.sapfans.com/forums/viewtopic.php?t=44477
7. How can I set the cell color in ALV? http://www.sapfans.com/forums/viewtopic.php?t=52107
8. How do I print a logo/graphics in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=81149
http://www.sapfans.com/forums/viewtopic.php?t=35498
http://www.sapfans.com/forums/viewtopic.php?t=5013
9. How do I create and use input-enabled fields in ALV?
http://www.sapfans.com/forums/viewtopic.php?t=84933
http://www.sapfans.com/forums/viewtopic.php?t=69878
10. How can I use ALV for reports that are going to be run in background?
http://www.sapfans.com/forums/viewtopic.php?t=83243
http://www.sapfans.com/forums/viewtopic.php?t=19224
11. How can I display an icon in ALV? (Common requirement is traffic light icon).
http://www.sapfans.com/forums/viewtopic.php?t=79424
http://www.sapfans.com/forums/viewtopic.php?t=24512
12. How can I display a checkbox in ALV? http://www.sapfans.com/forums/viewtopic.php?t=88376
http://www.sapfans.com/forums/viewtopic.php?t=40968
http://www.sapfans.com/forums/viewtopic.php?t=6919
Check this for basic concepts of OOPS
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/abap%20objects/abap%20code%20sample%20to%20learn%20basic%20concept%20of%20object-oriented%20programming.doc
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20display%20data%20in%20alv%20grid%20using%20object%20oriented%20programming.doc
Tabstrip
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20for%20tab%20strip%20in%20alv.pdf
Editable ALV
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/abap%20code%20samples/alv%20grid/abap%20code%20sample%20to%20edit%20alv%20grid.doc
Tree
http://www.sapdevelopment.co.uk/reporting/alv/alvtree/alvtree_usrint.htm
General Tutorial for OOPS
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/abap/an%20easy%20reference%20for%20alv%20grid%20control.pdf
http://www.sapdevelopment.co.uk/reporting/alvhome.htm
http://www.sap-img.com/abap/what-is-alv-programming.htm
http://www.sap-img.com/abap-function.htm
http://www.geocities.com/mpioud/Abap_programs.html
http://www.sapdevelopment.co.uk/reporting/alv/alvtree%5Calvtree_basic.htm
http://esnips.com/doc/ad20dca9-6182-4903-8d8f-96a66dc8590c/ALV.pdf
http://www.sap-img.com/abap-function.htm -
What is diff b/w abstarct and interface
what is diff b/w abstarct and interface in real time where we come across, give a best real time example
I think there have been lots of threads in this forum discussing interfaces and abstract classes.
http://forum.java.sun.com/thread.jspa?forumID=256&threadID=389830
http://forum.java.sun.com/thread.jspa?forumID=54&threadID=5120074
http://forum.java.sun.com/thread.jspa?forumID=54&threadID=499077
http://forum.java.sun.com/thread.jspa?forumID=31&threadID=546668
Interfaces define a contract for what an implementing class should provide. Abstract classes do the same but they can also provide some common part of the implementation. -
Too many connections - even after closing ResultSets and PreparedStatements
I'm getting a "Too many connections" error with MySQL when I run my Java program.
2007-08-06 15:07:26,650 main/CLIRuntime [FATAL]: Too many connections
com.mysql.jdbc.exceptions.MySQLNonTransientConnectionException: Too many connections
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:921)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:812)
at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3269)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1182)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:2670)I researched on this and found out that I wasn't closing the ResultSet and the PreparedStatement.
The JDBC connection is closed by a central program that handles connections (custom connection pooling).
I added the code to close all ResultSets and PreparedStatements, and re-started MySQL as per the instructions here
but still get "Too many connections" error.
A few other things come to mind, as to what I may be doing wrong, so I have a few questions:
1) A few PreparedStatements are created in one method, and they are used in a 2nd method and closed in the 2nd method
does this cause "Too many connections" error?
2) I have 2 different ResultSets, in nested while loops where the outer loop iterates over the first ResultSet and
the inner loop iterates over the second ResultSet.
I have a try-finally block that wraps the inner while loop, and I'm closing the second ResultSet and PreparedStement
in the inner while loop.
I also have a try-finally block that wraps the outer while loop, and I'm closing the first ResulSet and PreparedStatement
in the outer while loop as soon as the inner while loop completes.
So, in the above case the outer while loop's ResultSet and PreparedStatements remain open until the inner while loop completes.
Does the above cause "Too many connections" error?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The following is relevant sections of my code ( it is partially pseudo-code ) that shows the above 2 cases:
init( Connection jdbcConnection ){
String firstSQLStatement = "....";
PreparedStatement ps1 = jdbcConnection.prepareStatement( firstSQLStatement );
String secondSQLStatement = "....";
PreparedStatement ps2 = jdbcConnection.prepareStatement( secondSQLStatement );
String thirdSQLStatement = "....";
PreparedStatement ps3 = null;
ResultSet rsA = null;
try{
ps3 = jdbcConnection.prepareStatement( thirdSQLStatement );
rsA = ps3.executeQuery();
if( rsA.next() ){
rsA.getString( 1 );
}finally{
if( rsA != null )
rsA.close();
if( ps3 != null )
ps3.close();
//Notice, how ps1 and ps2 are created here but not used immediately, but only ps3 is
//used immediately.
//ps1 and ps2 are used in another method.
run( Connection jdbcConnection ){
ResultSet rs1 = ps1.executeQuery();
try{
while(rs1.next()){
String s = rs1.getString();
ps2.setString(1, s);
ResultSet rs2 = ps2.executeQuery();
try{
while(rs2.next()){
String s2 = rs2.getString();
}finally{
if( rs2 != null )
rs2.close();
if( ps2 != null )
ps2.close();
}catch( Exception e ){
e.printStackTrace();
}finally{
if( rs1 != null )
rs1.close();
if( ps1 != null )
ps1.close();
//Notice in the above case rs1 and ps1 are closed only after the inner
//while loop completes.
}I appreciate any help.Thanks for your reply.
I will look at the central connection pooling mechanism ( which was written by someone else) , but that is being used by many other Java programs others have written.
They are not getting this error.
An addendum to my previous note, I followed the instructions here.
http://dev.mysql.com/doc/refman/5.0/en/too-many-connections.html
There's probably something else in my code that is not closing the connection.
But I just wanted to rule out the fact that opening a PreparedStatement in one method and closing it in another is not a problem.
Or, if nested ResultSet loops don't cause the problem.
I've read in a few threads taht "Too many connections" can occur for unclosed RS and PS , and not just JDBC connections. -
Diff b/w Infoset and multiprovider BI 7.0 onwards
Hi gurus,
Could somebody tell me the difference b/w Infoset and multiprovider BI 7.0 onwards. I mean earlier we were not able to add cube to an infoset. It allowed us to add only ODS and info object . Since the new version allow us to add cubes too then what is the diff b/w Infoset and multiprovider. Since both of them are full filling the same purpose ?
Thanks in advance.
Ashu Gupta.Hi,
Follow there links.
An InfoSet describes data sources that are usually defined as joins for ODS objects or InfoObjects (characteristics with master data). A time-dependent join or temporal join is a join that contains an InfoObject that is a time-dependent characteristic.
MultiProvider is a type of InfoProvider that combines data from a number of InfoProviders and makes it available for reporting purposes. The MultiProvider does not itself contain any data. Its data comes entirely from the InfoProviders on which it is based. These InfoProviders are connected to one another by a union operation.
InfoProviders and MultiProviders are the objects or views that are relevant for reporting.
Infoset- Join
Multiprovider-Union
Follow there links for multiprovider and infoset.
http://help.sap.com/saphelp_nw04/helpdata/en/52/1ddc37a3f57a07e10000009b38f889/frameset.htm
need documentation on Multiprovider
Multiprovider
reporting on two cube without multiprovider or multicube
MultiProvider -Options
<removed>
Regards,
Senthil Kumar.P -
Diff b/w aggretation and compresion?
any one give me the diff b/w aggretation and compresion?,in both sinero we aggregate data, and why rool up, after rool up again we do compresion , i dont under stand taht
Hi,
Aggregation:
An aggregate is a materialized, aggregated view of the data in an InfoCube. In an aggregate, the dataset of an InfoCube is saved redundantly and persistently in a consolidated form on the database. Aggregates allow quick access to InfoCube data during reporting.
http://help.sap.com/saphelp_nw70/helpdata/EN/26/4bc0417951d117e10000000a155106/frameset.htm
Compression:
When you load data into the InfoCube, entire requests can be added at the same time. Each of these requests has its own request ID, which is included in the fact table in the package dimension. This makes it possible to pay particular attention to individual requests. However, the request ID concept can also cause the same data record (where all characteristics are the same except the request ID) to appear more than once in the fact table. This can be eliminated by Compressing the cube.
http://help.sap.com/saphelp_nw70/helpdata/EN/ca/aa6437e7a4080ee10000009b38f842/frameset.htm
First you have to build the Aggregates and do the Compression.
If you do Compression first then what happens is that it deletes all the Requests and transfers records from F Table to E Table. -
Diff b/w mk01 and mk02 using lsmw
what is diff b/w mk01 and mk02 to transfer data using lsmw
which steps are different, what are thosewhat is diff b/w mk01 and mk02 to transfer data using lsmw
which steps are different, what are those -
In LSMW, what is diff between LSMW-BAPI and LSMW-IDOC
hello all
In LSMW, what is diff between LSMW-BAPI and LSMW-IDOCHi Swamy,
The differences between IDoc and BAPI are as follows:
IDOC
IDocs are text encoded documents with a rigid structure that are used to exchange data between R/3 and a foreign system.
Idocs are processed asynchronously and no information whatsoever is returned to the client.
The target system need not be always online. The IDOC would be created and would send the IDOC once the target system is available (tRFC concept). Hence supports guaranteed delivery.
With asynchronous links the sub-process on the client can be finished even if the communication line or the server is not available. In this case the message is stored in the database and the communication can be done later.
The disadvantage of asynchronous links is that the sub-process on the server cannot return information to the calling sub-process on the client. A special way for sending information back to the client is required. In addition, a special error handling mechanism is required to handle errors on the receiving side.
IDOCs may be more changeable from release to release.
IDOCs are poorly documented.
BAPI
BAPIs are a subset of the RFC-enabled function modules, especially designed as Application Programming Interface (API) to the SAP business object, or in other words: are function modules officially released by SAP to be called from external programs.
BAPIs are called synchronously and (usually) return information.
For BAPIs the client code needs to do the appropriate error handling.
Problems with synchronous links occur if the communication line or the server is temporarily not available. If this happens, the sub-process on the client cannot be finished (otherwise there would be data inconsistencies).
Synchronous links have the advantage that the sub-process on the server can return values to the sub-process on the client that has started the link.
BAPIs are not totally immune to upgrades.
BAPIs are reasonably well documented.
Reward points if useful.
Best Regards,
Sekhar -
Diff in IT 0027 and IT 1018 ie.. Cost Distribution
Hello Experts,
My Earlier thread is not found.... so opening another thread........ ( My Question was about -> What is the diff between IT 1018 and IT 0027? If anyone could explain with an example would be great)....
Correct me if i am wrong, from the earlier replies i got an impression of..... we use IT 1018 if we want to distribute costs at the level of position or org unit...... and IT 0027 if we want to distribute by employee.....
I saw for the IT 0027 subtypes like Wage/Salary, Travel Expenses, Planned Cost Distribution, Planned Effort etc.,.
Can anyone explain me with an example in what scenarios will we be using each of thse subtypes.....
Also, what would be the functionality if IT 1018 and IT 0027 in case of concurrent employement???
All inputs are appreciated......
Thanks,
Janga K.
Edited by: Janga k on Mar 15, 2010 8:45 PMHi Arthi,
Thats was really helpfull....... that explains my question regarding IT 27 and IT 1018....
I would also like to know....... what would be the functionality of these ITs in case if concurrent employement.......
Would it be same or it would be different????
Thanks,
Janga K. -
Diff between Thin client and Rich client
Hi Everyone,
Can someone give me a clear picture of the what is the diff between Thin client and Rich client.
Thanks,
KrishnaHi,
thick client (rich client) has/stores all the data inside itself
so it can do application processing without the server with data
thin client uses resources from host computer (from server)
and wihtout that you are not able to work with that kind of client
does that answer your question ?
Regards,
michal -
Diff between Seeburger Adapter and File Adapter
Hi All,
My company needs to interact with some banks and the banks are particular that they want SFTP, which is not supported by File Adapter, so we have decided to go with Seeburger adapter.
Now what are the differences between File adapter and seeburger adapter?
I believe that Seeburger adapter does not support File Content Conversion, Archiving etc.
Could you all pls put some light on the diff between file adapter and seeburger adapter when it comes to dealing with files?
XierHi
You are aware with working of File Adapter.
The most direct way of using the Seeburger adaptors is to configure the BIC as a module. There is a software component from seeburger called bicmapper which will allow you to
1. Define or import the inbound message metadefinition in various formats ( edifact, xml,...)
2. Using a mapping create an xml variant as the output metadefinition or edifact in the other direction.
3. Create a one to one mapping between input en output.
4. Export the metadata in xsd or sda format for import in XI
5. Generate an SDA which can be deployed in XI and used as a module.
Have a look here,
http://www.seeburger.com/fileadmin/com/pdf/SAP_Exchange_Infrastructure_Integratio_Strategy.pdf
Some Seeburger related information
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e2aeb02c-0601-0010-d680-c9be61ffa390
Go through this threads:
http://www.seeburger.com/fileadmin/com/pdf/SAP_Exchange_Infrastructure_Integratio_Strategy.pdf
Need Material on Seeburger Adapters.
Seeburger Adapter
Installing seeburger adapter
http://www.seeburger.com/xi-adapters/
Thanks -
Diff. between Tax Code and Condition Types
Hi,
What is the diff. between Tax Code and Condition Type???
Why we maintain Tax Codes under Invoice Tab in PO, when Condition Types are available for Calculation Procedure...???
Please guide..hi..
Tax code : Tax code in some what more specific for calculating the tax...some material is having 2% tax..some having 3 % tax..etc..and these are input tax...so..these tax code will be of type input tax..
now..based on the nature of tax type amount will be calculated....
suppose tax code is calculation of 2 condtion type so ..we can do it in tax code conditon record fv11 also..
so..tax code can be a combination of cond type...
where as through cond type also we can also achieve this..by using one statistical cond type...
Cond Type : cond type is for the daily pricing configuration..how system will calculate the price for a centain material we can make define the rules here...
Try this out..
Thans -
Diff between oracle 10g and 11g
Can any one could tell me what is the main diff between oracle 10g and 11g ?
Thanks in Advance
VenkatHi,
You can read
http://www.oracle.com/technetwork/articles/sql/index-082320.html
http://www.oracle.com/technetwork/articles/sql/index-099021.html
Anand -
DataSource and PreparedStatement
I am using DataSource and PreparedStatement in weblogic8.1 for a J2EE application.
It works if we use only EJB..but if we use enterprise app. i.e. servlets,jsp,ejb etc.. it does not work.
Can somebody tell the reason behind it??Why do you feel this is an issue with the PreparedStatements and not just the DataSource? Are you sure you have configured the DataSource correctly for your platforms outside your ejb container?
Maybe you are looking for
-
Need information on how to integrate bank interfaces for 820,824 transaction using B2B add on
HI All, Can anyone share some knowledge on how to integrate 820,824 transactions using PI B2B add on . I have downloaded B2B mapping kit and B2B toolkit into IR and uploaded SCA files into PI server. But I can not see any mappings provided for 820/82
-
To upgrade from MobileMe or not?
I have MobileMe and I'm just wondering whether to risk the upgrade to iCloud or not. My main concern is about calendars. My Mac and iPad 2 will be fine but I also have an iPod 2G which has been working fine with MobileMe. I know that I can add my iCl
-
Timed Access Switching Off??
My settings in Timed Access seem to hold for maybe a few days at a time, but then all of a sudden when I check it, the Timed Access tab reads Not Enabled. No one else can be turning it off as I am the only one that knows the password. Has anyone else
-
And condition within the same table
Hello all, Was wondering if anyone knows what's the best and most efficient way to query for something similar to the example below. Table1 ID CID VALUE 1 1 a 2 2 b 3 3 c 4 1 c Find me all customer id where value is a and c This should only bring bac
-
What would happen if site to site conference call using G.729
conference bridge I am currently using is software conference , I am aware that Cisco software conference bridge only support G.711. and my project is a multisite project and site to site calls are via wan not PSTN. so my question is what would happe