Data base query
what is difference between query and execute query?
Query, question: an instance of questioning; "there was a question about my training"; "we made inquiries of all those who were present"
http://www.google.com/search?hl=en&q=define%3Aquery&btnG=Google+Search
Execute Query is an operating system independent database utility written entirely in Java.
http://executequery.org/index.html
Similar Messages
-
How to use Add Query Criteria for the MySQL data Base in Netbeans ?
How to use Add Query Criteria for the MySQL data Base in Netbeans Visual web pack.
When the Query Criteria is add like
SELECT ALL counselors.counselors_id, counselors.first_name, counselors.telephone,counselors.email
FROM counselors WHERE counselors.counselors_id = ?
when i run this Query in the Query Window
i get a error message Box saying
Query Processing Error Parameter metadata not available for the given statement
if i run the Query with out Query Criteria its working fine.*I am glad I am not the only one who have this problem. Part of issue has been described as above, there are something more in my case.
Whenever I try to call ****_tabRowSet.setObject(1, userDropList.getSeleted()); I got error message as shown below:*
The Java codes are:
public void dropDown1_processValueChange(ValueChangeEvent event) {
Object s = this.dropDown1.getSelected();
try {
this.User_tabDataProvider1.setCursorRow(this.User_tabDataProvider1.findFirst("User_Tab.User_ID", s));
this.getSessionBean1().getTrip_tabRowSet1().setObject(1, s);
this.Trip_tabDataProvider1.refresh();
} catch (Exception e) {
this.log("Error: ", e);
this.error("Error: Cannot select user"+e.getMessage());
SQL statement for Trip_tabRowSet:
SELECT ALL Trip_Tab.Trip_Date,
Trip_Tab.User_ID,
Trip_Tab.Destination
FROM Trip_Tab
WHERE Trip_Tab.User_ID = ?
Error messages are shown below:
phase(RENDER_RESPONSE 6,com.sun.faces.context.FacesContextImpl@5abf3f) threw exception: com.sun.rave.web.ui.appbase.ApplicationException: java.sql.SQLException: No value specified for parameter 1 java.sql.SQLException: No value specified for parameter 1
com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.cleanup(ViewHandlerImpl.java:559)
com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.afterPhase(ViewHandlerImpl.java:435)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:274)
com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
com.sun.webui.jsf.util.UploadFilter.doFilter(UploadFilter.java:240)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
tandardWrapperValve[Faces Servlet]: Servlet.service() for servlet Faces Servlet threw exception
java.sql.SQLException: No value specified for parameter 1
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
at com.mysql.jdbc.PreparedStatement.fillSendPacket(PreparedStatement.java:1674)
at com.mysql.jdbc.PreparedStatement.fillSendPacket(PreparedStatement.java:1622)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1332)
at com.sun.sql.rowset.internal.CachedRowSetXReader.readData(CachedRowSetXReader.java:193)
at com.sun.sql.rowset.CachedRowSetXImpl.execute(CachedRowSetXImpl.java:979)
at com.sun.sql.rowset.CachedRowSetXImpl.execute(CachedRowSetXImpl.java:1439)
at com.sun.data.provider.impl.CachedRowSetDataProvider.checkExecute(CachedRowSetDataProvider.java:1274)
at com.sun.data.provider.impl.CachedRowSetDataProvider.setCursorRow(CachedRowSetDataProvider.java:335)
at com.sun.data.provider.impl.CachedRowSetDataProvider.setCursorIndex(CachedRowSetDataProvider.java:306)
at com.sun.data.provider.impl.CachedRowSetDataProvider.getRowCount(CachedRowSetDataProvider.java:639)
at com.sun.webui.jsf.component.TableRowGroup.getRowKeys(TableRowGroup.java:1236)
at com.sun.webui.jsf.component.TableRowGroup.getFilteredRowKeys(TableRowGroup.java:820)
at com.sun.webui.jsf.component.TableRowGroup.getRowCount(TableRowGroup.java:1179)
at com.sun.webui.jsf.component.Table.getRowCount(Table.java:831)
at com.sun.webui.jsf.renderkit.html.TableRenderer.renderTitle(TableRenderer.java:420)
at com.sun.webui.jsf.renderkit.html.TableRenderer.encodeBegin(TableRenderer.java:143)
at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:810)
at com.sun.webui.jsf.component.Table.encodeBegin(Table.java:1280)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:881)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
at com.sun.faces.application.ViewHandlerImpl.doRenderView(ViewHandlerImpl.java:271)
at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:182)
at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.renderView(ViewHandlerImpl.java:285)
at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:133)
at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:244)
at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:140)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
at com.sun.webui.jsf.util.UploadFilter.doFilter(UploadFilter.java:240)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:368)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:239)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
Also when I tried to update my MYSQL connector / J driver to version 5.1.5 from 5.0.5 (NB 5.5.1) and 5.0.7 (NB 6.1), I could not get it work (looooong time to search some JDBC classes and with no response in the end) on both of my Netbean 5.5.1(on PC) and Netbean 6.1(on laptop) IDEs.
Could anybody look into this issue.
Many thanks
Edited by: linqing on Nov 22, 2007 4:48 AM -
SAP QUERY -logical data base ADA
I have created a SAP Query with logical data base ADA,I have selected four tables in it.Do i need to link these tables if yes..where and how?The report is for fields in asset master data.
.But i get below error when i try to genaret the output :
Fields from parallel tables within a line
Line: 01
Field: Asset description
(ANLT-TXT50, table ANLT)
Field: License plate no. of vehichle
(ANLZ-KFZKZ, table ANLZ)
i get such similar five messages but they are warning..when i execute with warning however i get the fields with description but not with Value.Ex:i get asset description and not Asset number as required.You don't have to link them, they ar linked that is the power of a logical data base
To get the text in your report you need the key fields
Like
(Lanque Key)
company code
asset number
Asset sub number
Go to info sets and look to the standard ones like /SAPQUERY/AM01 -
Regarding Data Base Select Query
Hi All,
I want to extract the data from data base into my internal table
by not giving the exact value but the pattern.
Ex) I want to select the vendor starting with patter '12*'
from LFA table in my internal table.
Which select Query I should use for getting the
Vendor No. starting with pattern '12*' ?.
Points will be rewaded.
Thanks in Advance.
With Regards
Jitendra Gujarathi.Hi jitendra,
1. simple
2.
select * from lfa1
into table lfa1
where lifnr like '12%'.
regards,
amit m . -
Is there any query i can use to monitor Users tried to log on to data base
is there any way to know the users tried to log on to data base
is this possible
if user entered user name and wrong password 4 times for example
is there a table or something let me know that for example
HR tried 4 times to log into data baseHi,
You can go for Auditing.
http://www.securityfocus.com/infocus/1689
http://toolkit.rdbms-insight.com/oracle_auditing_nroshak.ppt
- Pavan Kumar N -
Logical data base for license revenue report.
Hi All,
My requirement is to create "license revenue report through SAP Query with following fields:
VBAK:
Sales Document,Sales Doc type,net value of sales order in document,sales org,distribution channel,division,sales office,business area,customer purchase order number,customer purchase order date,sold to party.
VBAP:
Sales document item,target quantity in sales units,target quantity in UOM,usage indicator,billing block for item,business area,plant(own or external),
origin of bill of material,net price,SD document currency,material pricing pgroup,account assignment group for this material,activity type,personnel number.
VEDA:
contracts start date,contract end date,date on which contract is assigned.,installation date,agreement acceptance date
VBREVK:
clearing account for accrued revenues,clearing accountkey(offsetting account),total accrued value,currency key,amount in document currency,posting year and posting period.
VBREVE:
revenue amount,currency key,accrual period,company code,country of destination,profit center,posting year and posting period,amount in document currency,gl account,account for deferred revenue,account for non billed receivable
Is there any standard logical data base which gives all the required fields mentioned above? since i am not SD consultant i am not sure whether i have to take only above tables exactly or not
there are certain logical databases like SD_ORDER,SD_SALES_DOCUMENT which has tables VBAK,VBAP,VEDA but i am unable to join remaining tables VBREVE and VBREVK with those logical data bases
Please provide some valuable suggestions on this.
Thanks&RegardsHi All,
My requirement is to create "license revenue report through SAP Query with following fields:
VBAK:
Sales Document,Sales Doc type,net value of sales order in document,sales org,distribution channel,division,sales office,business area,customer purchase order number,customer purchase order date,sold to party.
VBAP:
Sales document item,target quantity in sales units,target quantity in UOM,usage indicator,billing block for item,business area,plant(own or external),
origin of bill of material,net price,SD document currency,material pricing pgroup,account assignment group for this material,activity type,personnel number.
VEDA:
contracts start date,contract end date,date on which contract is assigned.,installation date,agreement acceptance date
VBREVK:
clearing account for accrued revenues,clearing accountkey(offsetting account),total accrued value,currency key,amount in document currency,posting year and posting period.
VBREVE:
revenue amount,currency key,accrual period,company code,country of destination,profit center,posting year and posting period,amount in document currency,gl account,account for deferred revenue,account for non billed receivable
Is there any standard logical data base which gives all the required fields mentioned above? since i am not SD consultant i am not sure whether i have to take only above tables exactly or not
there are certain logical databases like SD_ORDER,SD_SALES_DOCUMENT which has tables VBAK,VBAP,VEDA but i am unable to join remaining tables VBREVE and VBREVK with those logical data bases
Please provide some valuable suggestions on this.
Thanks&Regards -
How to delete copyed wrongly in the data base
Hi Gurus,
I copy the cube 0IC_C03 to Z0IC_C03.
After that i went to RSZC--> copy from 0IC_C03 to Z0IC_C03 all the queries, but when i am copying i dint remove the _1 beside each query. when i repeat system telling queries already in the data base. can you tell how to delete and copy freshly.
Points Assure.
Thanks
AmarendraHi,
you can use rszdelete where you can choose the queries and query objects which you want to delete.
After this you can start the copy again.
regards
Cornelia -
Performance problem in select data from data base
hello all,
could you please suggest me which select statement is good for fetch data form data base if data base contain more than 10 lac records.
i am using SELECT PACKAGE SIZE n statement, but it's taking lot of time .
with best regards
srinivas rathodHi Srinivas,
if you have huge data and selecting ,you could decrease little bit time if you use better techniques.
I do not think SELECT PACKAGE SIZE will give good performance
see the below examples :
ABAP Code Samples for Simple Performance Tuning Techniques
1. Query including select and sorting functionality
tables: mara, mast.
data: begin of itab_new occurs 0,
matnr like mara-matnr,
ernam like mara-ernam,
mtart like mara-mtart,
matkl like mara-matkl,
werks like mast-werks,
aenam like mast-aenam,
stlal like mast-stlal,
end of itab_new.
select fmatnr fernam fmtart fmatkl gwerks gaenam g~stlal
into table itab_new from mara as f inner join mast as g on
fmatnr = gmatnr where gstlal = '01' order by fernam.
Code B
tables: mara, mast.
data: begin of itab_new occurs 0,
matnr like mara-matnr,
ernam like mara-ernam,
mtart like mara-mtart,
matkl like mara-matkl,
werks like mast-werks,
aenam like mast-aenam,
stlal like mast-stlal,
end of itab_new.
select fmatnr fernam fmtart fmatkl gwerks gaenam g~stlal
into table itab_new from mara as f inner join mast as g on f~matnr =
gmatnr where gstlal = '01'.
sort itab_new by ernam.
Both the above codes essentially do the same function, but the execution time for code B is considerably lesser than that of Code A. Reason: The Order by clause associated with a select statement increases the execution time of the statement, so it is profitable to sort the internal table once after selecting the data.
2. Performance Improvement Due to Identical Statements Execution Plan
Consider the below queries and their levels of efficiencies is saving the execution
tables: mara, mast.
data: begin of itab_new occurs 0,
matnr like mara-matnr,
ernam like mara-ernam,
mtart like mara-mtart,
matkl like mara-matkl,
werks like mast-werks,
aenam like mast-aenam,
stlal like mast-stlal,
end of itab_new.
select fmatnr fernam fmtart fmatkl gwerks gaenam g~stlal
into table itab_new from mara as f inner join mast as g on f~matnr =
gmatnr where gstlal = '01' .
sort itab_new.
select fmatnr fernam
fmtart fmatkl gwerks gaenam g~stlal
into table itab_new from mara as
f inner join mast as g on f~matnr =
gmatnr where gstlal
= '01' .
Code D (Identical Select Statements)
tables: mara, mast.
data: begin of itab_new occurs 0,
matnr like mara-matnr,
ernam like mara-ernam,
mtart like mara-mtart,
matkl like mara-matkl,
werks like mast-werks,
aenam like mast-aenam,
stlal like mast-stlal,
end of itab_new.
select fmatnr fernam fmtart fmatkl gwerks gaenam g~stlal
into table itab_new from mara as f inner join mast as g on f~matnr =
gmatnr where gstlal = '01' .
sort itab_new.
select fmatnr fernam fmtart fmatkl gwerks gaenam g~stlal
into table itab_new from mara as f inner join mast as g on f~matnr =
gmatnr where gstlal = '01' .
Both the above codes essentially do the same function, but the execution time for code B is considerably lesser than that of Code A. Reason: Each SQL statement during the process of execution is converted into a series of database operation phases. In the second phase of conversion (Prepare phase) an execution plan is determined for the current SQL statement and it is stored, if in the program any identical select statement is used, then the same execution plan is reused to save time. So retain the structure of the select statement as the same when it is used more than once in the program.
3. Reducing Parse Time Using Aliasing
A statement which does not have a cached execution plan should be parsed before execution; this parsing phase is a highly time and resource consuming, so parsing time for any sql query must include an alias name in it for the following reason.
1. Providing the alias name will enable the query engine to resolve the tables to which the specified fields belong to.
2. Providing a short alias name, (a single character alias name) is more efficient that providing a big alias name.
Code E
select jmatnr jernam jmtart jmatkl
gwerks gaenam g~stlal into table itab_new from mara as
j inner join mast as g on jmatnr = gmatnr where
g~stlal = '01' .
In the above code the alias name used is j .
4. Performance Tuning Using Order by Clause
If in a SQL query you are going to read a particular database record based on some key values mentioned in the select statement, then the read query can be very well optimized by ordering the fields in the same order in which we are going to read them in the read query.
Code F
tables: mara, mast.
data: begin of itab_new occurs 0,
matnr like mara-matnr,
ernam like mara-ernam,
mtart like mara-mtart,
matkl like mara-matkl,
end of itab_new.
select MATNR ERNAM MTART MATKL from mara into table itab_new where
MTART = 'HAWA' ORDER BY MATNR ERNAM MTART MATKL.
read table itab_new with key MATNR = 'PAINT1' ERNAM = 'RAMANUM'
MTART = 'HAWA' MATKL = 'OFFICE'.
Code G
tables: mara, mast.
data: begin of itab_new occurs 0,
matnr like mara-matnr,
ernam like mara-ernam,
mtart like mara-mtart,
matkl like mara-matkl,
end of itab_new.
select MATNR ERNAM MTART MATKL from mara into table itab_new where
MTART = 'HAWA' ORDER BY ERNAM MATKL MATNR MTART.
read table itab_new with key MATNR = 'PAINT1' ERNAM = 'RAMANUM'
MTART = 'HAWA' MATKL = 'OFFICE'.
In the above code F, the read statement following the select statement is having the order of the keys as MATNR, ERNAM, MTART, MATKL. So it is less time intensive if the internal table is ordered in the same order as that of the keys in the read statement.
5. Performance Tuning Using Binary Search
A very simple but useful method of fine tuning performance of a read statement is using Binary search addition to it. If the internal table consists of more than 20 entries then the traditional linear search method proves to be more time intensive.
Code H
select * from mara into corresponding fields of table intab.
sort intab.
read table intab with key matnr = '11530' binary search.
Code I
select * from mara into corresponding fields of table intab.
sort intab.
read table intab with key matnr = '11530'.
Thanks
Seshu -
How to read a byte data from maxdb data base
Dear All,
I have a issue in reading the data from database table.
I have a column named as templateData which contains the byte data (biometric template data, which comes from fingerprint device) which is DataType of LONG and CODE of BYTE.
I am not using the below to get the template data
Connection con = null;
Statement stmt = null;
ResultSet resultSet = null;
byte[] DbBioData = new byte[1024];
InitialContext ctx = new InitialContext();
if(ctx == null)
throw new Exception("Boom - No Context");
DataSource ds = (DataSource)ctx.lookup(db_drvstr);
con = ds.getConnection();
stmt = con.createStatement();
resultSet = stmt.executeQuery(db_query + " where SUBJECT_ID='"+ username +"'");
if(resultSet.next())
DbBioData = resultSet.getBytes(1);
_loc.infoT("verify", "verify::Got BioData From MAXDB" +DbBioData );
loc.infoT("verify", "verify::Query is: " +dbquery + " where SUBJECT_ID='"+ username +"'" );
But I am not getting the proper data, could anyone please tell me the way to read the biometric data from data base table.Hi Kishore,
is it me or is there no query definition in that code?
I see that you concatenate a "db_query" with a string to make up a WHERE clause, but the db_query is nowhere defined before.
So at least you should provide something like
stmt = con.createStatement("SELECT templateDate FROM <tablename> ");
before you do anything with the query.
Besides this: have you ever heard of SQL injections? Try to use BIND-variables instead of concatenating strings. Otherwise your application will spend much time just with parsing your queries...
Hmm... possibly the best thing you could do about this is to read the JAVA manual for MaxDB:
<a href="http://maxdb.sap.com/currentdoc/ef/2de883d47a3840ac4ebb0b65a599e5/content.htm">Java Manual (SAP Library - Interfaces)</a>
Best regards,
Lars
Edited by: Lars Breddemann on Dec 17, 2007 1:12 PM - corrected link -
Get data from a Data Base in MySQL
Hi guys,
I'm developing an app for my exam at school. In this app I need to query my Data Base to get my data and to create a table.
The purpose of my app is to create a list of songs that a DJ has played during a concert and automatically create a table with the song titles, artist name and date of the concert. All of these information are already stored in the Data Base.
I created an interface in Xcode where the user types in the DJ name and the date. I want to query the Data Base with these information and create a table that can be view directly on the iPhone. I think that I can send the text contained in the text field to a PHP page and then the PHP page does the query.
Is it possible doing this? Can you help me with the code?
If you need any explanation just ask me.
Thank you very much!
AngeloThanks for the reply, I found the problem, i was returning no.sentDate in the form YYYY-MM-DD and method getTime doesn't like so it was returning null, so what I have done was cast(no.sentDate as datetime) and also store the difference of the dates as a long variable as I need the difference between the dates not the day of the month.
My code now looks like this:
conWorkPartyID = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
String sWorkOrderID = "select co.orderPartyid, no.workOrderListPartyid, wl.workOrdListDesc, cast(no.sentDate as datetime) as newDate from contractorOrders as co "+
"left join newOrders as no on no.orderPartyid = co.orderPartyid "+
"left join workOrderList as wl on wl.workOrderListPartyID = no.workOrderListPartyid "+
"where co.flagSentToContractor = 0 and co.contractorPartyid =" + sCompany;
cWorkPartyID = conWorkPartyID.executeQuery(sWorkOrderID);
while(cWorkPartyID.next()){
Object x = cWorkPartyID.getObject("co.orderPartyid");
Object y = cWorkPartyID.getObject("no.workOrderListPartyid");
Object z = cWorkPartyID.getObject("wl.workOrdListDesc");
Date dateTest = cWorkPartyID.getDate("newDate");
Date Now = new Date();
System.out.println("dateTest is: " + dateTest.getTime());
long dif = ((Now.getTime() - dateTest.getTime())/86400000);// milliseconds to days
System.out.println("Order PartyID that require your attention is : "+ x + " and workOrderPartyid: " + y +" and WorkOrderListDesc: "
+ z + " and the sent date is: "+ dateTest + "and the difference between the insertDate and the today is in days: "
+ dif);
cWorkPartyID.close();
Any other suggestions are welcome.
Thanks for answering so soon.
Good night! -
Help: How to call a user defined function in a data block query?
I created a string aggregation function in the program unit, see reference:
http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php
I now like to call the function in my data block query. I got the error: ORA-00904: 'concatenate_list' invalid identifier.
Please help.
Thank you in advance.
JimmyHi,
You can write UDFs in java in Graphical mapping to enhance your XI Graphical mapping functionality
The steps for doing it would be:
1. Click on Create New function Button found on Bottom left corner on your XI Mapping window.
2. Write your java code.
3. Run the Mapping Test as usual.
>>The module that is given here ...where and how it is used.
The adapters in the Adapter Framework convert XI messages to the protocols of connected external systems and the other way around. When doing so, some
functionality might need to be added specific to a situation which is possible with the use of custom modules.
Typical example would be validation of file content when using a File Adapter or modification of the message payload to a common content structure which is not supported by any of the standard SAP modules.
An Adapter module is developed as an Enterprise Java Bean and is called locally by the Adapter.
An example on modules :
<a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/da5675d1-0301-0010-9584-f6cb18c04805">How to develop a module for reading file name in a sender file adapter XI 3.0</a>
Cheers,
Chandra -
Hi, people,
I`m using Logical Data Base ADA in my program to generate some files, but when the program is executed in DEV System the files are generated normaly, but in the PRD system don´t work.
Someone knows if exist same parameter or why this problem occurs ?
Tks for all.
FlavioAs ADA is a standard logical database, if you don't change this object, there should be no difference, except Authorizations that may differ between development and production systems , check via [SU53|http://www.sdn.sap.com/irj/scn/advancedsearch?query=su53+#sdn_content_category_value_wiki].
(In AM "Asset Accounting" class, check authorization objects : A_A_VIEW, A_S_ANLKL, A_S_GSBER, A_S_WERK.)
Regards,
Raymond -
When to refresh Servlet data from Data Base
Hello all,
I have a servlet that retrive few hundreds thousands records from data base table.
The data in data base table being updated once or twice in every week.
Since same servlet instance serve all users, that access the servlet many times a day.
I would like to avoid retriving the data from data base on each servlet access.
and make the users use same data already retrieved and kept in servlet members.
First, what is the best way to avoid data retrive from data base on each servlet access?
and how could I have some kind of trigger that will refresh servlet data from data base every few days?
Thanks in advance for every idea.
AmiJava_A wrote:
Thanks Saish for your reply.
I'm not using DAO in my application but retrive the data from BI data base using a web service. response time querying the BI data base is not quick enuogh.
Since, I wouldn't want to query the BI server on each servlet access.
Because the data I retrived at the begining using the web service contains all required data for all servlet requests, I thought to store the data (~200K rows) once in the servlet which will be using for all requests.
Why not store the results locally in your own database after you fetch them?
This still leave me with the questions: in which event should I query the BI data, and also when or in which event should I update the data again from BI server?
Query at startup, an user demand, when data becomes stale. It depends on your requirements.
>
Thanks
Ami- Saish -
Pivot Report in Excel from Oracle data base
I need to bring data in Excel from Oracle table.
The connectivity was established without any problem.
When trying to transform the newly created query into
a pivot table a am not able to see the data inside the
"Data area" of pivot table as it is in the data base
tables, instead Excel transforms the data in Sum, Average,
etc...
I believe it is an Excel issue but I am not sure.
Any sugestions would be appreciated.
Thanks,
Larry MoiseThank u but already i do have apache POI
hoew to make a conversion of coulmn data to excel -
Featching Data From The Data Base Using DI API in Matrix
Hi
All of u i am shahid i faced a problem when i retrive
the selected data from the data base using matrix plz.
Healp me!.
Thanks
Mohd Shahid.
SAP Techinical Consultent
Option Strict Off
Option Explicit On
Friend Class UseMatrix
'// This parameter will use us to manipulate the
'// SAP Business One Application
Private WithEvents SBO_Application As SAPbouiCOM.Application
Private oForm As SAPbouiCOM.Form
Private oMatrix As SAPbouiCOM.Matrix
Private oColumns As SAPbouiCOM.Columns
Private oColumn As SAPbouiCOM.Column
'// declareing a DB data source for all the Data binded columns
Private oDBDataSource As SAPbouiCOM.DBDataSource
'// declaring a User data source for the "Remarks" Column
Private oUserDataSource As SAPbouiCOM.UserDataSource
' This Function is called automatically when an instance
' of the class is created.
' Indise this function
Public Sub New()
MyBase.New()
'// set SBO_Application with an initialized application object
SetApplication()
'// Create the UI
CreateFormWithMatrix()
'// Add Data Sources to the Form
AddDataSourceToForm()
'// Bind the Form's items with the desired data source
BindDataToForm()
'// Load date to matrix
GetDataFromDataSource()
'// Make the form visible
oForm.Visible = True
End Sub
Private Sub SetApplication()
'// Use an SboGuiApi object to establish connection
'// with the SAP Business One application and return an
'// initialized appliction object
Dim SboGuiApi As SAPbouiCOM.SboGuiApi
Dim sConnectionString As String
SboGuiApi = New SAPbouiCOM.SboGuiApi
'// by following the steps specified above, the following
'// statment should be suficient for either development or run mode
sConnectionString = Environment.GetCommandLineArgs.GetValue(1)
'// connect to a running SBO Application
Try ' If there's no active application the connection will fail
SboGuiApi.Connect(sConnectionString)
Catch ' Connection failed
System.Windows.Forms.MessageBox.Show("No SAP Business One Application was found")
End
End Try
'// get an initialized application object
SBO_Application = SboGuiApi.GetApplication()
'SBO_Application.MessageBox("Hello World")
End Sub
Private Sub SBO_Application_AppEvent(ByVal EventType As SAPbouiCOM.BoAppEventTypes) Handles SBO_Application.AppEvent
Select Case EventType
Case SAPbouiCOM.BoAppEventTypes.aet_ShutDown
SBO_Application.MessageBox("A Shut Down Event has been caught" & _
Environment.NewLine() & "Terminating 'Add Menu Item' Add On...")
'// terminating the Add On
System.Windows.Forms.Application.Exit()
End Select
End Sub
Private Sub CreateFormWithMatrix()
'// Don't Forget:
'// it is much more efficient to load a form from xml.
'// use code only to create your form.
'// once you have created it save it as XML.
'// see "WorkingWithXML" sample project
'// we will use the following object to add items to our form
Dim oItem As SAPbouiCOM.Item
'// we will use the following objects to set
'// the specific values of every item
'// we add.
'// this is the best way to do so
Dim oButton As SAPbouiCOM.Button
Dim oStaticText As SAPbouiCOM.StaticText
Dim oEditText As SAPbouiCOM.EditText
'// The following object is needed to create our form
Dim creationPackage
creationPackage = SBO_Application.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_FormCreationParams)
creationPackage.UniqueID = "UidFrmMatrix14"
creationPackage.FormType = "TypeFrmMatrix14"
'// Add our form to the SBO application
oForm = SBO_Application.Forms.AddEx(creationPackage)
'// Set the form properties
oForm.Title = "Quality Check"
oForm.Left = 336
oForm.ClientWidth = 620
oForm.Top = 44
oForm.ClientHeight = 200
'// Adding Items to the form
'// and setting their properties
'// Adding an Ok button
'// We get automatic event handling for
'// the Ok and Cancel Buttons by setting
'// their UIDs to 1 and 2 respectively
oItem = oForm.Items.Add("1", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
oItem.Left = 5
oItem.Width = 65
oItem.Top = 170
oItem.Height = 19
oButton = oItem.Specific
oButton.Caption = "Ok"
'// Adding a Cancel button
oItem = oForm.Items.Add("2", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
oItem.Left = 75
oItem.Width = 65
oItem.Top = 170
oItem.Height = 19
oButton = oItem.Specific
oButton.Caption = "Cancel"
'// Adding a Text Edit item
'oItem = oForm.Items.Add("txtPhone", SAPbouiCOM.BoFormItemTypes.it_EDIT)
' oItem.Left = 265
'oItem.Width = 163
'oItem.Top = 172
'oItem.Height = 14
'// Adding an Add Phone prefix column button
' oItem = oForm.Items.Add("BtnPhone", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
' oItem.Left = 160
' oItem.Width = 100
' oItem.Top = 170
' oItem.Height = 19
' oButton = oItem.Specific
' oButton.Caption = "Add Phone prefix"
'// Add the matrix to the form
AddMatrixToForm()
End Sub
Private Sub AddMatrixToForm()
'// we will use the following object to add items to our form
Dim oItem As SAPbouiCOM.Item
'// we will use the following object to set a linked button
Dim oLink As SAPbouiCOM.LinkedButton
'// Adding a Matrix item
oItem = oForm.Items.Add("Matrix1", SAPbouiCOM.BoFormItemTypes.it_MATRIX)
oItem.Left = 5
oItem.Width = 500
oItem.Top = 5
oItem.Height = 150
oMatrix = oItem.Specific
oColumns = oMatrix.Columns
'// Adding Culomn items to the matrix
oColumn = oColumns.Add("#", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oColumn.TitleObject.Caption = "#"
oColumn.Width = 30
oColumn.Editable = False
'// Add a column for Item Code
oColumn = oColumns.Add("DSItemCode", SAPbouiCOM.BoFormItemTypes.it_LINKED_BUTTON)
oColumn.TitleObject.Caption = "Item Code"
oColumn.Width = 40
oColumn.Editable = True
'// Link the column to the ITEM master data system form
oLink = oColumn.ExtendedObject
oLink.LinkedObject = SAPbouiCOM.BoLinkedObject.lf_Items
oColumn = oColumns.Add("DSItemName", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oColumn.TitleObject.Caption = "Item Name"
oColumn.Width = 80
oColumn.Editable = True
'// Add a column for BP Card Phone
oColumn = oColumns.Add("DSWhs", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oColumn.TitleObject.Caption = "Ware House"
oColumn.Width = 40
oColumn.Editable = True
'// Add a column for BP Card Phone
oColumn = oColumns.Add("DSQuantity", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oColumn.TitleObject.Caption = "Quantity"
oColumn.Width = 40
oColumn.Editable = True
'// Add a column for Combo Box
oColumn = oColumns.Add("DSQuality", SAPbouiCOM.BoFormItemTypes.it_CHECK_BOX)
oColumn.TitleObject.Caption = "Quality"
' oColumn.ValidValues.Add("OK", "")
'oColumn.ValidValues.Add("NOT OK", "")
oColumn.Width = 40
oColumn.Editable = True
oColumn = oColumns.Add("DSReport", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oColumn.TitleObject.Caption = "Remarks"
' oColumn.ValidValues.Add("OK", "")
'oColumn.ValidValues.Add("NOT OK", "")
oColumn.Width = 40
oColumn.Editable = True
'// Add a column for BP Card Phone
' oColumn = oColumns.Add("DSPhoneInt", SAPbouiCOM.BoFormItemTypes.it_EDIT)
' oColumn.TitleObject.Caption = "Int. Phone"
'oColumn.Width = 40
'oColumn.Editable = True
End Sub
Public Sub AddDataSourceToForm()
'// every item must be binded to a Data Source
'// prior of binding the data we must add Data sources to the form
'// Add user data sources to the "International Phone" column in the matrix
' oUserDataSource = oForm.DataSources.UserDataSources.Add("IntPhone", SAPbouiCOM.BoDataType.dt_SHORT_TEXT, 20)
'// Add DB data sources for the DB bound columns in the matrix
oDBDataSource = oForm.DataSources.DBDataSources.Add("OITW")
End Sub
Public Sub BindDataToForm()
'// getting the matrix column by the UID
oColumn = oColumns.Item("DSItemCode")
'oColumn.DataBind.SetBound(True, "", "DSCardCode")
oColumn.DataBind.SetBound(True, "OITW", "ItemCode")
'oColumn = oColumns.Item("DSItemName")
'oColumn.DataBind.SetBound(True, "OITW", "ItemName")
oColumn = oColumns.Item("DSWhs")
oColumn.DataBind.SetBound(True, "OITW", "WhsCode")
oColumn = oColumns.Item("DSQuantity")
oColumn.DataBind.SetBound(True, "OITW", "U_QCStock")
'// to Data Bind an item with a user Data source
'// the table name value should be an empty string
' oColumn = oColumns.Item("DSPhoneInt")
'oColumn.DataBind.SetBound(True, "", "IntPhone")
End Sub
Public Sub GetDataFromDataSource()
'// Ready Matrix to populate data
oMatrix.Clear()
oMatrix.AutoResizeColumns()
'// Querying the DB Data source
oDBDataSource.Query()
'// setting the user data source data
'oUserDataSource.Value = "Phone with prefix"
oMatrix.LoadFromDataSource()
End Sub
Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
If (pVal.FormUid = "UidFrmMatrix") Then
If ((pVal.itemUID = "BtnPhone") And _
(pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED) And _
(pVal.Before_Action = False)) Then
AddPrefix()
End If
If ((pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD) And _
(pVal.Before_Action = False)) Then
SBO_Application.MessageBox("Form Unloaded, Addon will terminate")
System.Windows.Forms.Application.Exit()
End If
End If
End Sub
Public Sub AddPrefix()
Dim i As Integer
Dim PhoneExtCol As SAPbouiCOM.Column
Dim newPhone As String
Dim oItem As SAPbouiCOM.Item
Dim oEditTxt As SAPbouiCOM.EditText
'// Get the prefix edit text item
oItem = oForm.Items.Item("txtPhone")
oEditTxt = oItem.Specific
'// Flush user input into datasources
oMatrix.FlushToDataSource()
'// Get the DBdatasource we base the matrix on
oDBDataSource = oForm.DataSources.DBDataSources.Item("OCRD")
'// Iterate all the records and add a prefix to the phone
For i = 0 To oDBDataSource.Size - 1
newPhone = oDBDataSource.GetValue("phone1", i)
newPhone = newPhone.Trim(" ")
oDBDataSource.SetValue("phone1", i, oEditTxt.String + newPhone)
Next
'// Load data back to
oMatrix.LoadFromDataSource()
End Sub
End ClassHi Shahid,
I am not sure what your question is. The code you pasted looks like the MatrixAndDataSources example that comes with the SDK. What are you trying to do?
Thanks,
Adele
Maybe you are looking for
-
Unable To Pass Input Page Parameter Using PageDef File.
Dear All, I am currently exploring task flows as I dont have that much knowledge in it. Here's my use case 1. I setup a taskflow which has a Method Call and a View Activity in it. 2. The method call is a default activity which just calls a web servic
-
How can I see Foreign Currency FC balance in Purchase Analysis Report??
Dear Experts, Right now in the Purchase Analysis Report, I can only see Local Currency and System Currency balances. How can I see Foreign Currency balances?? Much Thanks! Warmest Regards, Chinho
-
Transfer of material to material with excise duties
Hi, We are importing material and as per std. procedure while invoice we are passing the duties we we have paid while purchasing of material. Now we have one requirement that we have two material code ABC which is old code and XYZ is new co
-
Share JVM on the client using ORACLE Forms on Oracle Application Server 10x
Hi All, excuse the question, if it's wrong here: We have a problem running an Oracle Forms Application on an Oracle Application Server 10.1.2.3 Local requirements do not allow multiple JVMs to run on the Client where the Oracle Forms Application is s
-
Podcasts Just Stop When Downloading
I've tried to work around this by downloading one podcast at a time. This has not helped at all. I'm using a 3 Mbps connection and I can download from other sites on the internet at 390KBps. The podcast will be downloading at a high rate of speed and