How to execute a Java method when row inserted into a database table?
I have the need to fire off a java method when a row is inserted into a database table. I am unfortunately working with MySQL which just recently supported triggers but these new triggers can not execute a Java application on any event.
What I am looking for is an event driven approach such that when a row is inserted into a specific table I can fire off a java method (sitting in a tomcat container) that will take the contents and send it to a web service.
It has been mentioned that JMS may have the ability to poll and monitor a database table. Just wondering if anyone could point me in the right direction.
thanks
JavaTek
A service handler might be the right way to run some code at the end of a service call (another way would be to make use of filters).
First, make sure your static table is merged with ServiceHandlers.
Secondary, change your custom method name into one that is not already in the service definition of COLLECTION_COPY_LOT (preferably a unique method name like collectionCopyLotLastAction that describes its purpose) and remove the following line from your code:
m_service.doCodeEx("",this);Now create a service definition for COLLECTION_COPY_LOT in your custom component based on the original COLLECTION_COPY_LOT (copy paste from the original service definition) and add you own method collectionCopyLotLastAction as the last step in the service. Play with the load order to make sure CS is using your service definition of COLLECTION_COPY_LOT instead of the original.
regards,
Fabian
Similar Messages
-
Is there a tutorial on - how to call static java methods
I have defined external JAVA resource using a .jar file and have successfully catalogged the same. Now I need to pass variables to a static method in a class and also get the return variable mapped into a BPM variable.
Can someone share sample Java Invokation code, how to call methods in a class, how to instantiate a singleton or reference an existing instance of singleton class.
Any sample code or sample projects will be useful.
Also can I se ethe java system.out.println output in BPM Logviewer
ArvindHi Arvind,
Sure you've done this, but the first step is to catalog the Jar file. Before an Oracle BPM project can use the Java component, the appropriate Java JAR files must be added to the project.
Add the Jar File(s) to the External Resources:
1. Right-click the External Resources item in the Project Navigator tab
2. From the pop-up menu, select New External Resource.
3. Name this new Java resource "MyNewJavaComponents" and ensure its type is Java Class Library.
4. Add the Java jar file(s)
Catalog and Expose the Java Components:
5. Add a new module in the Catalog called "IntegrationComponents".
6. Generate a Java integration component by right-clicking the IntegrationComponents module and select "Catalogue Component" -> "Java".
7. Using the Java configuration you just created called MyNewJavaComponents, click the Next button to automatically introspect the Java libraries.
8. Select the class where your method(s) are located and click the Next -> Finish buttons to have Oracle BPM generate the integration component for you.
9. If you expand the newly exposed Java component, you can see a method has been created for each public method (attributes would also be automatically created if this class had any public attributes). If you've included the appropriate BeanInfo class in the JAR, you'll note that the method parameters are appropriately named.
How to Invoke Public Java methods Exposed in the Catalog:
10. Open the method editor for an automatic activity in the process (or any BPM Object method with its "Server Side" property set to "Yes").
11. Drag one of the Java methods you just exposed inside your IntegrationComponents module into the automatic activity's method. Once you drag it in, here's what you might see if you're using the Java syntax in Oracle BPM's method editor:
(PdfGenerator).generate(outputFilename : "", contents : { }, logoImageURL : null, signatureImageURL : null);
Assuming you have "outputFilename", "sampleContent", "logoURL" and "signatureURL" variables already created in your process, change the method you just dragged in to:
IntegrationComponents.Pdfservice.PdfGenerator.generate(outputFilename : outputFilename, contents : sampleContent,
logoImageURL : logoURL, signatureImageURL : signatureURL);
Hope this helps,
Dan -
How to execute a java code ...
how to execute a java code just like in javascript:
for example in javascript: we can create a function :
name_fonction=new Function("param1","param2",..., "Instructions");
but can it be supported in the common java code? how to do it?
Je suis a little urgent...
Thanks a lot!!!See beanshell
http://www.beanshell.org/
which should be include in the next J2SE 6.0 or 7.0.
See JSR 274 at http://jcp.org/en/jsr/detail?id=274
--Marc (http://jnative.sf.net) -
Why and how do I fix this? When I go into cellular data and view account it says my ipad is activated and ready to go. What gives???
It was working fine up until I upgraded the OS which I hadn't done in many versions so the ipad was not working as well as it should. Now it is searching for the network.
.Hello noodles074!
Let's get your device working again! It's possible that your device just needs to be reprovisioned on our network. Please go to Settings>General>Reset>Subscriber Services>Reprovision Account. This may take several minutes. After allowing about 5 minutes for completion, please power your iPad off and back on, and test it again. Let us know if this takes care of it!
Thank you,
MichelleH_VZW
Follow us on Twitter @VZWSupport -
How to select data from 3rd row of Excel to insert into Sql server table using ssis
Hi,
Iam having Excel files with headers in first two rows , i want two skip that two rows and select data from 3rd row to insert into Sql Server table using ssis.3rd row is having column names.CUSTOMER DETAILS
REGION
COL1 COL2 COL3 COL4 COL5 COL6 COL7
COL8 COL9 COL10 COL11
1 XXX yyyy zzzz
2 XXX yyyy zzzzz
3 XXX yyyy zzzzz
4 XXX yyyy zzzzz
First two rows having cells merged and with headings in excel , i want two skip the first two rows and select the data from 3rd row and insert into sql server using ssis
Set range within Excel command as per below
See
http://www.joellipman.com/articles/microsoft/sql-server/ssis/646-ssis-skip-rows-in-excel-source-file.html
Please Mark This As Answer if it solved your issue
Please Mark This As Helpful if it helps to solve your issue
Visakh
My MSDN Page
My Personal Blog
My Facebook Page -
How to send multiple row data into an internal table??
I have a view with table control.i want to select multiple row and send all the row data into an internal table.i am able to select multiple row but all the selected row data is not going to the internal table.....only a particular row data which is lead selected is going.
Do anyone can help me regarding this issue?
Thanks in advance,
Subhasis.Hey,
Some code example:
declaring an internal table and work area to get all the elements from the node.
data : lt_Elements type WDR_CONTEXT_ELEMENT_SET,
ls_Element type WDR_CONTEXT_ELEMENT_SET,
considering flights is my node.
lt_data type sflight.
Node_Flights is the ref of the node to which ur table is binded.
Use Code Inspector to read the node.
lt_Element = Node_Flights->GET_ELEMENTS
loop at lt_elements into ls_Element.
l_bollean = ls_elements->is_selected ( returns abap true/false ).
if l_bollean IS INITIAL.
append ls_Element to lt_data.
endif.
Hope this would help.
Cheers,
Ashish -
How do i upload an image to a server and put the name into a database table
Ok, i found a php image upload script that im using for a cms
image gallery on my site. But for it to work the way i need to i
have to have certain information submited into a mysql table at the
same time. I could just make it so the user types the name of the
image in a second form, but i would rather not have to as it seems
a clumsy way to do things and opens things up to typos etc.
So, i can upload the image ok, and i can upload data to the
table, but i dont know what I have to do so that the name of the
uploaded file is automaticly inserted into the mysql table.
The first bit of code below is the form I am using to upload
the file to the server. The second bit of code is what I am using
to tell the server what the file name is.
How do I combine the 2 form into one? Please help. It is
driving me to dispair.
Attach Code
<form enctype="multipart/form-data" action="uploader.php"
method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="500000"
/>
Choose a file to upload: <input name="uploadedfile"
type="file" />
<br />
<input type="submit" value="Upload File" />
</form>
<form action="<?php echo $editFormAction; ?>"
method="post" name="form2" id="form2">
<table align="center">
<tr valign="baseline">
<td nowrap="nowrap" align="right">Image One</td>
<td><input type="text" name="kingsImage1"
value="<?php echo
htmlentities($row_rskingscentre['kingsImage1'], ENT_COMPAT,
'UTF-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Image Two</td>
<td><input type="text" name="kingsImage2"
value="<?php echo
htmlentities($row_rskingscentre['kingsImage2'], ENT_COMPAT,
'UTF-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap" align="right">Image
Three</td>
<td><input type="text" name="kingsImage3"
value="<?php echo
htmlentities($row_rskingscentre['kingsImage3'], ENT_COMPAT,
'UTF-8'); ?>" size="32" /></td>
</tr>
<tr valign="baseline">
<td nowrap="nowrap"
align="right"> </td>
<td><input type="submit" value="Update record"
/></td>
</tr>
</table>
<p> </p>
<p>
<input type="hidden" name="MM_update" value="form2" />
<input type="hidden" name="kingsHeader" value="<?php
echo $row_rskingscentre['kingsHeader']; ?>" />
</p>
</form>jeffoirecoupe1234 wrote:
> Ok, i found a php image upload script that im using for
a cms image gallery on
> my site. But for it to work the way i need to i have to
have certain
> information submited into a mysql table at the same
time. I could just make it
> so the user types the name of the image in a second
form, but i would rather
> not have to as it seems a clumsy way to do things and
opens things up to typos
> etc.
>
> So, i can upload the image ok, and i can upload data to
the table, but i dont
> know what I have to do so that the name of the uploaded
file is automaticly
> inserted into the mysql table.
>
> The first bit of code below is the form I am using to
upload the file to the
> server. The second bit of code is what I am using to
tell the server what the
> file name is.
>
> How do I combine the 2 form into one? Please help. It is
driving me to dispair.
>
> Attach Code
>
> <form enctype="multipart/form-data"
action="uploader.php" method="POST">
> <input type="hidden" name="MAX_FILE_SIZE"
value="500000" />
> Choose a file to upload: <input name="uploadedfile"
type="file" />
> <br />
> <input type="submit" value="Upload File" />
> </form>
>
> <form action="<?php echo $editFormAction; ?>"
method="post" name="form2"
> id="form2">
> <table align="center">
> <tr valign="baseline">
> <td nowrap="nowrap" align="right">Image
One</td>
> <td><input type="text" name="kingsImage1"
value="<?php echo
> htmlentities($row_rskingscentre['kingsImage1'],
ENT_COMPAT, 'UTF-8'); ?>"
> size="32" /></td>
> </tr>
> <tr valign="baseline">
> <td nowrap="nowrap" align="right">Image
Two</td>
> <td><input type="text" name="kingsImage2"
value="<?php echo
> htmlentities($row_rskingscentre['kingsImage2'],
ENT_COMPAT, 'UTF-8'); ?>"
> size="32" /></td>
> </tr>
> <tr valign="baseline">
> <td nowrap="nowrap" align="right">Image
Three</td>
> <td><input type="text" name="kingsImage3"
value="<?php echo
> htmlentities($row_rskingscentre['kingsImage3'],
ENT_COMPAT, 'UTF-8'); ?>"
> size="32" /></td>
> </tr>
> <tr valign="baseline">
> <td nowrap="nowrap"
align="right"> </td>
> <td><input type="submit" value="Update record"
/></td>
> </tr>
> </table>
> <p> </p>
> <p>
> <input type="hidden" name="MM_update" value="form2"
/>
> <input type="hidden" name="kingsHeader"
value="<?php echo
> $row_rskingscentre['kingsHeader']; ?>" />
> </p>
> </form>
>
>
>
Hi Jeff:
Though this does not show you how to solve this issue via a
code
snippett, there are a couple of extensions at WebAssist.com
that enable
you to do this, they are Data Assist and Digital File Pro.
When you have
time, take a look at these Solution Recipes (tutorials) that
show how
DataAssist is used and then now Digital File Pro is used in
conjunction
with DataAssist:
http://www.webassist.com/professional/products/solutionrecipe/Media_139.asp
http://www.webassist.com/professional/products/solutionrecipe/Media_112.asp
DataAssist can be used to save time when you need to build
database
search and management applications quickly, and Digital File
Pro can be
used to include file upload functionality to your form fields
while
enabling you to insert your server file name into the
database, all on
the same page.
enthusiastically,
mark haynes -
HOW DO I STOP MY JSP PAGE FROM INSERTING DATA IN DATABASE EACH TIME REFRESH
Hi,
HOW DO I STOP MY JSP PAGE FROM INSERTING DATA IN DATABASE EACH TIME REFRESH?
Thanksemekaco wrote:
Hi,
HOW DO I STOP MY JSP PAGE FROM INSERTING DATA IN DATABASE EACH TIME REFRESH?
ThanksSTOP SHOUTING!
now, while displaying the form generate some random number, or take the current time in millis or whatever. Put that number in a hidden field. Insert that unique number along with the real data into the database, but before you do check if the number already exists. If it does you can be pretty sure this is a resubmit of the same data, so don't allow it. This is one way of many to prevent resubmission of existing data.
A good way to prevent a refresh from resubmitting altogether is to do a redirect to a result page right after you deal with the POST request. When the user presses refresh then, he/she will refresh the redirect and not the form submit. -
How to select the data from a Maintainance View into an internal table
Hi All,
Can anybody tell me how to select the data from a Maintainance View into an internal table.
Thanks,
srinivas.HI,
You can not retrieve data from A mentenance view.
For detail check this link,
http://help.sap.com/saphelp_nw2004s/helpdata/en/cf/21ed2d446011d189700000e8322d00/content.htm
Regards,
Anirban -
How to insert into two differents tables at the same time
Hi
I'm newer using JDev, (version 3.1.1.2 cause the OAS seems to support just the JSP 1.0)
and I want to insert into two differents tables at the same time using one view.
How can I do that ?
TIA
EdgarOracle 8i supports 'INSTEAD OF' triggers on object views so you could use a process similar to the following:
1. Create an object view that joins your two tables. 'CREATE OR REPLACE VIEW test AS SELECT d.deptno, d.deptname, e.empname FROM DEPT d, EMP E'.
2. Create an INSTEAD OF trigger on the view.
3. Put code in the trigger that looks at the :NEW values being processed and determines which columns should be used to INSERT or UPDATE for each table. Crude pseudo-code might be:
IF :NEW.deptno NOT IN (SELECT deptno FROM DEPT) THEN
INSERT INTO dept VALUES(:NEW.deptno, :NEW.deptname);
INSERT INTO emp VALUES (:NEW.deptno, :NEW.empname);
ELSE
IF :NEW.deptname IS NOT NULL THEN
UPDATE dept SET deptname = :NEW.deptname
WHERE deptno = :NEW.deptno;
END IF;
IF :NEW.empname IS NOT NULL THEN
UPDATE emp SET empname = :NEW.empname
WHERE deptno = :NEW.deptno;
Try something along those lines.
null -
How do i print pictures from a disc inserted into the Apple Superdrive connected to the 2011 MacBook Air by USB port? Thanks
How do i import them? The only place i can find them is on "Finder" and I don't know how to get them to a place where I can print them.
-
How do I stream the dvd's I insert into my mac on my apple tv?
How do I stream the dvd's I insert into my mac on my apple tv?
Welcome to the Apple community.
If your Mac meets the specifications for airplay mirroring, then you can play your DVDs but you will have to use a program such as VLC.
AirPlay Mirroring requires a second-generation Apple TV or later, OS X 10.8 or better and is supported on the following Mac models: iMac (Mid 2011 or newer), Mac mini (Mid 2011 or newer), MacBook Air (Mid 2011 or newer), and MacBook Pro (Early 2011 or newer). -
Any Spatial Method which can Insert Polygon Geometry in Table
Hi All,
Is there any Method of Oracle Spatial which can insert a polygon plotted with polygon tool on the map directly into any database table or do we have to resort to get each of the co-ordinates from the map and create a procedure to insert the ordinates value into mdsys.sdo_ordinates as we do for varrays.Hi,
On one way you can create unique number by selecting the maximum employee number before creation of a record and then increment one to assign to the new record.
The other way you can create a number range in tcode SNRO and use FM NUMBER_GET_NEXT to get the next number from the number range.
Search SDN with NUMBER_GET_NEXT, you will get example codes.
Regards
Karthik D -
How to insert data in database table
Hi experts,
How to insert data into database table using internal table from function module.Hi,
As per my understanding are you looking for the complete API feature of data insertion into the database using the Locking Mechanism? If yes, then you need to create a Lock Object using the Primary keys of the Primary Table and Secondary Tables. You need to call the lock object first and then you need to make the entry into the table. This principle is based on 'All or None Concept'.
For the insert Statement Key word you can have a look at the following link:
http://help.sap.com/abapdocu/en/ABAPINSERT_SOURCE.htm
Hope this helps.
Thanks,
Samantak. -
Possible solution to avoid deadlock when two inserts happen on same table from two different machines.
Below are the details from deadlock trace.
Deadlock encountered .... Printing deadlock information
Wait-for graph
NULL
Node:1
KEY: 8:72057594811318272 (ffffffffffff) CleanCnt:3 Mode:RangeS-S Flags: 0x1
Grant List 2:
Owner:0x00000013F494A980 Mode: RangeS-S Flg:0x40 Ref:0 Life:02000000 SPID:376 ECID:0 XactLockInfo: 0x000000055014F400
SPID: 376 ECID: 0 Statement Type: INSERT Line #: 70
Input Buf: RPC Event: Proc [Database Id = 8 Object Id = 89923542]
Requested by:
ResType:LockOwner Stype:'OR'Xdes:0x0000002AA53383B0 Mode: RangeI-N SPID:238 BatchID:0 ECID:0 TaskProxy:(0x00000027669B4538) Value:0x10d8d500 Cost:(0/38828)
NULL
Node:2
KEY: 8:72057594811318272 (ffffffffffff) CleanCnt:3 Mode:RangeS-S Flags: 0x1
Grant List 2:
Owner:0x0000000B3486A780 Mode: RangeS-S Flg:0x40 Ref:0 Life:02000000 SPID:238 ECID:0 XactLockInfo: 0x0000002AA53383F0
SPID: 238 ECID: 0 Statement Type: INSERT Line #: 70
Input Buf: RPC Event: Proc [Database Id = 8 Object Id = 89923542]
Requested by:
ResType:LockOwner Stype:'OR'Xdes:0x000000055014F3C0 Mode: RangeI-N SPID:376 BatchID:0 ECID:0 TaskProxy:(0x000000080426E538) Value:0x30614e80 Cost:(0/41748)
NULL
Victim Resource Owner:
ResType:LockOwner Stype:'OR'Xdes:0x0000002AA53383B0 Mode: RangeI-N SPID:238 BatchID:0 ECID:0 TaskProxy:(0x00000027669B4538) Value:0x10d8d500 Cost:(0/38828)
deadlock-list
deadlock victim=process5daddc8
process-list
process id=process5daddc8 taskpriority=0 logused=38828 waitresource=KEY: 8:72057594811318272 (ffffffffffff) waittime=2444 ownerId=2994026815 transactionname=user_transaction lasttranstarted=2014-07-25T12:46:57.347 XDES=0x2aa53383b0 lockMode=RangeI-N schedulerid=43 kpid=14156 status=suspended spid=238 sbid=0 ecid=0 priority=0 trancount=2 lastbatchstarted=2014-07-25T12:46:57.463 lastbatchcompleted=2014-07-25T12:46:57.463 clientapp=pa hostname=pa02 hostpid=1596 loginname=myuser isolationlevel=serializable (4) xactid=2994026815 currentdb=8 lockTimeout=4294967295 clientoption1=671088672 clientoption2=128056
executionStack
frame procname=mydb.dbo.SaveBill line=70 stmtstart=6148 stmtend=8060 sqlhandle=0x03000800d61f5c056bd3860170a300000100000000000000
INSERT INTO [dbo].[Prod1] .....
inputbuf
Proc [Database Id = 8 Object Id = 89923542]
process id=process5d84988 taskpriority=0 logused=41748 waitresource=KEY: 8:72057594811318272 (ffffffffffff) waittime=2444 ownerId=2994024748 transactionname=user_transaction lasttranstarted=2014-07-25T12:46:57.320 XDES=0x55014f3c0 lockMode=RangeI-N schedulerid=39 kpid=14292 status=suspended spid=376 sbid=0 ecid=0 priority=0 trancount=2 lastbatchstarted=2014-07-25T12:46:57.440 lastbatchcompleted=2014-07-25T12:46:57.440 clientapp=pa hostname=pa01 hostpid=1548 loginname=myuser isolationlevel=serializable (4) xactid=2994024748 currentdb=8 lockTimeout=4294967295 clientoption1=671088672 clientoption2=128056
executionStack
frame procname=pa.dbo.SaveBill line=70 stmtstart=6148 stmtend=8060 sqlhandle=0x03000800d61f5c056bd3860170a300000100000000000000
INSERT INTO [dbo].[Prod1]....
inputbuf
Proc [Database Id = 8 Object Id = 89923542]
resource-list
keylock hobtid=72057594811318272 dbid=8 objectname=pa.dbo.prod1 indexname=PK_a id=lock1608ee1380 mode=RangeS-S associatedObjectId=72057594811318272
owner-list
owner id=process5d84988 mode=RangeS-S
waiter-list
waiter id=process5daddc8 mode=RangeI-N requestType=convert
keylock hobtid=72057594811318272 dbid=8 objectname=pa.dbo.prod1 indexname=PK_a id=lock1608ee1380 mode=RangeS-S associatedObjectId=72057594811318272
owner-list
owner id=process5daddc8 mode=RangeS-S
waiter-list
waiter id=process5d84988 mode=RangeI-N requestType=convertDon't know. Perhaps these can help. I scanned the second link but didn't see much about Ending Deadlocks. I'd say the Fourth link probably has better information than the first three links. But maybe read them all just in case the Fourth is missing something
one of the first three have.
Deadlocking
Detecting and Ending Deadlocks
Minimizing Deadlocks
Handling Deadlocks in SQL Server
Google search for "SQL Deadlock"
La vida loca
Maybe you are looking for
-
Page numbers disappear in final pdf from *placed* InDesign pages
Hi, Because of restrictions in export to booklet, I have imposed an indesign document by placing each page from one InDesign document into another (the publication is 8.5 x 11 landscape – the script provided within won't impose this). I then export t
-
System name changing seemingly on it's own
I have a peculiar problem. My Macbook Air's name seems to be changing on it's own. The name doesn't change in any configuration prompt, but when I open the terminal it ALWAYS takes on the name of another computer on the LAN, regardless of what LAN I
-
Associating file with a particular Application
Hi. How can I associate a file, meaning that I want only a particular application can write to the file. Im creating an application that uses an XML file as data storage. I dont want any other applications (e.g Notepad, word) to write into it other t
-
Ok, Ihad a G3 iBook, and while I loved it I was dissapointed when the G4 iBooks debuted 2 weeks later at the same price...or cheaper I forget. In either case I've had it for the last 3 years and its seen me through college. I need to get my graphics
-
Slow downloading speed.
I use an Airport Extreme for my IBook G4. I connect my dsl modem into the Airport and then my Airport is connected into the Ethernet port of my windows PC. My connection speed and browsing speed are fine, the problem I'm having is when it comes to do