Thursday, June 23, 2011

Create JDBC resources using commands in Glassfish 2.0

Display the list of JDBC connection pool within the specified domain

/opt/JCAPS62/appserver/bin/asadmin list-jdbc-connection-pools --user Administrator --passwordfile /home/midw/jcaps/SIT-pwd.txt --host un228sesb1 --port 18348


Display the list of JDBC resources within the specified domain

/opt/JCAPS62/appserver/bin/asadmin list-jdbc-resources --user Administrator --passwordfile /home/midw/jcaps/SIT-pwd.txt --host un228sesb1 --port 18348


Delete the specified JDBC resource within the specified domain

/opt/JCAPS62/appserver/bin/asadmin delete-jdbc-resource --user Administrator --passwordfile /home/midw/jcaps/SIT-pwd.txt --host un228sesb1 --port 18348 jdbc/esbfoundation



Delete the specified JDBC connection pool within the specified domain

/opt/JCAPS62/appserver/bin/asadmin delete-jdbc-connection-pool --user Administrator --passwordfile /home/midw/jcaps/SIT-pwd.txt --host un228sesb1 --port 18348 ESBFoundationDBPool



Create the JDBC connection pool within the specified domain

/opt/JCAPS62/appserver/bin/asadmin create-jdbc-connection-pool --restype javax.sql.ConnectionPoolDataSource --datasourceclassname oracle.jdbc.pool.OracleConnectionPoolDataSource --user Administrator --passwordfile /home/midw/jcaps/SIT-pwd.txt --host un228sesb1 --port 18348 --validationtable DUAL --property DataSourceName=OracleConnectionPoolDataSource:NetworkProtocol=tcp:User=softrules:Password=softrules_sit:DatabaseName=softrules:ServerName=un128dora:port=1523:URL=jdbc\\:oracle\\:thin\\:@un128dora\\:1523\\:ESBRNSIT ESBFoundationDBPool


Create the JDBC resource within the specified domain

/opt/JCAPS62/appserver/bin/asadmin create-jdbc-resource --host un228sesb1 --port 18348 --user Administrator --passwordfile /home/midw/jcaps/SIT-pwd.txt --connectionpoolid ESBFoundationDBPool jdbc/esbfoundation

Wednesday, June 22, 2011

One tricky issue of creating Oracle trigger

I came across one tricky issue which puzzled me for a while when I was tring to create one trigger in Oracle.

The SQL statement is as the follow:

CREATE OR REPLACE
TRIGGER
prsd_nonidmp_req_ins_trigger
BEFORE INSERT
ON PROCESSED_NON_IDEMPOTENT_REQ
REFERENCING NEW AS NEW_ROW
FOR EACH ROW
BEGIN
SELECT processed_nonidmp_req_sequence.nextval INTO :NEW_ROW.ID FROM dual;
END;

When it is executed in Oracle SQL Developer there is no error and the trigger is created successfully.

But when it is executed from one Ant script the script always complain the error:

java.sql.SQLException: ORA-00900: invalid SQL statement.

The complain comes from the semicolon ; after dual. Ant thinks this as the end the SQL statement because when Ant processes the SQL statements bt default it uses the semicolon ; as the delimiter of the each SQL statement.

But in the above the statement which creates the trigger the semicolon is required after dual otherwise the trigger will be created with the compiler error.

Saturday, June 18, 2011

JTA Transaction attribute

The below diagrams show the meaning of different transaction attributes.
The client can be other EJBs or web-ties clients and etc.




NOT_SUPPORTED






REQUIRES_NEW







MANDATORY








SUPPORTS






NEVER






REQUIRED


















Thursday, June 16, 2011

What is BMT?

BMT stands for Bean Managed Transaction. It is one of the way EJB prvides for the transaction management. Another one is CMT - Container Managed Transaction.
Unlike CMT, which let the application server handles the most of transaction management issues, BMT gives the developers more control over the transaction management. such as the transaction demarcation, start, commit or rollback the transaction.

The bean that can use BMT must be a session bean or MDB.

Although it is BMT, the container actually still does the most hard work of transaction management for the bean which manage the transaction itself. The container creates the physical transaction for the bean. This transaction is injected into the bean as one instance of javax.transaction.UserTransaction. The bean uses this instance of UserTransaction to start, commit or rollback the transaction.

Unit Testing Good Practices

    Here are some points which, I think, can help you make good unit testing



  • Unit test should be simple logically. One unit test should test one functionality only.



  • Don't add the conditions in the unit testing.



  • Don't have multiple assertations.



  • Use the constant value in the assertation.



  • Give each unit test a meaningful name.



  • Whenever a bug is found add unit tests for it.



  • Make the unit tests automatic and add the unit testing into the build scripts.

Thursday, May 19, 2011

wsdl:fault is used to specify the fault message - mapped to a subclass of java.lang.Exception How is it generated?generic SOAP fault.

Tuesday, April 5, 2011

Install Oracle OSA JDeveloper extension to JDeveloper 11g





Oracle JDeveloper 11g alone doesn't have the SOA capability. In order to create SOA application using JDeveloper 11g you need to install Oracle SOA JDeveloper extension to JDeveloper first.

The following are the steps which demonstrate how to do so from the downlaoded SOA JDeveloper extension file.


The JDeveloper 11g I are using is Studio version 11.1.1.4.0.



Step 1. First downlaod the SOA extension file from Oracle Fusion Middleware Products Update Center to your local. Its URL is: http://www.oracle.com/ocom/groups/public/@otn/documents/webcontent/156082.xml


Note: You must choose the matched version of SOA extention for your JDeveloper. Otherwise you might not be able to use SOA capability of this extension in JDeveloper.


For JDeveloper verison 11.1.4.0 I choose the verison 11.1.1.4.0.58.62 for Oracle SOA Composite Editor.



After the successful download, the extension file is in your local file system as: soa-jdev-extension.zip

Step 2. Start your JDeveloper and select the menu item: Help/Check for updates...








And the following window is pop up and click on the Next button.




Step 3. Select Install from Local File from the following popup and browse your local file system to put the downloaded extension file into FileName and then click on Next button.












Step 4. The popup window will show the summary information of the extension to be installed. After the confirmation click on the Finish button.








Step 5. JDeveloper will pop up the window to prompt the restart is needed to finish the installation. Click on Yes button to restart JDeveloper.






Step 6. After the restart of JDeveloper Oracle JDeveloper SOA extention is installed. We can


verify the installation by clicking on Help/About menu item. If SOA Composite Editor appers it means that the installation is successful.







Once the installation is done successfully you can build the SOA project using JDeveloper.