Friday, November 30, 2007

Webservices

Using Rational Developer to create a simple Web service and use it in a Web application

Turn EJB components into Web services

Best practices

Here are a few best practices for developing an EJB Web service:

* Avoid overusing Web services in your applications. Examine whether you really need to expose your EJB as a Web service.
* Use a coarse-grained session façade that encapsulates your business logic to be used as a Web service. Avoid exposing all your application's session beans as Web services.
* Examine properly whether you need either RPC-style or document-style Web services. RPC-style Web services are more efficient than document-style Web services. On the contrary, document style is more flexible because you can use schema.
* Make sure you design your Web service so that it creates minimal network traffic.
* Avoid maintaining any kind of state information in your EJB components that you expose as Web services.
* Use JAX-RPC data types as the method parameters for your Web service to give it interoperability with heterogeneous Web services. Avoid types such as Collection, HashMap, and Lists as parameters for your Web service if interoperability is important for your application.
* Many of the conventional best practices for J2EE applications (Web applications) are also relevant to EJB Web services. For example, avoid exposing an EJB component that involves long-running transactions as a Web service.
* Weigh your security requirements against performance, because security comes with a higher cost. The performance costs of end-to-end security are high.

Java Web Services, Part 3: Axis2 Data Binding link


Tuesday, November 20, 2007

ADMIN_CMD procedure

The ADMIN_CMD procedure is used by applications to run DB2 command 9 line processor (CLP) administrative commands using the SQL CALL 9 statement. 9 The procedure currently supports the following CLP commands:

use admin_cmd('')

ref

note. This only for build in for version 8.2 FixPak 4 (equivalent to version 8.1 FixPak 11) and DB2 Data Warehouse Edition Version 9.1.

Thursday, November 15, 2007

Do u know tat we can query sql error code in db2 command line processor?

db2 => CALL runstats('unknown.table')@
SQL0443N Routine "STOLZE.RUNSTATS" (specific name "RUNSTATS") has returned an
error SQLSTATE with diagnostic text "Error -2306 returned by db2Runstats.".
SQLSTATE=38RS1

db2 => ? sql2306@

SQL2306N The table or index "" does not exist.

ref

Db2 import/export data

db2 import from datafile1.del of del replace into table1

IMPORT FROM "C:\aaaaaaaaa" OF IXF commitcount 10000 MESSAGES "C:\zzzzzz" INSERT INTO IBSADMIN.ARC_SETUP;
EXPORT TO "C:\aaaaaaaaa" OF IXF MESSAGES "C:\zzzzzz" SELECT * FROM IBSADMIN.ARC_SETUP;

import from date of DEL commitcount 10000 insert into mytable
EXPORT TO "C:\x" OF DEL MESSAGES "y" SELECT * FROM IBSADMIN.ARC_TABLE;

db2 export to mbuser.csv of del "select * from tibsadmin.mbuser"
db2 import
from mbuser.del of del "insert_update into tibsadmin.mbuser"

import

export



Wednesday, November 14, 2007

EXPORT in DEL forma get SQL3100W in DB2

I am using UDB V8.2 on AIX . When I do an EXPORT in DEL format , it gives a
SQL3100W on certain rows.

mainly, This warning occurs on rows that do not have any columns that are
over 254 chars.

In Command ref on page 365 second paragraph it says that if the char col is greater then 254 and using DEL format only you will get an error. IXF stores data diferently then DEL does, thus not effected by this limitation.

ref

Tuesday, November 13, 2007

Usefull sql script

sql to create backup table

CREATE TABLE UserBackup like User NOT LOGGED INITIALLY;
INSERT INTO UserBackup (SELECT * FROM User );

Monday, November 12, 2007

CSS in IE

1)IE not recognise css syntax if there is no space between the attribute.

table.title_bg
{
background:transparent url(/wps/images/ibs/hlbrib_bimb/sp_title_bg.gif)top left no-repeat;
}
==>work in firefox and opera but not IE (not space btw closing bracket and top)


table.title_bg
{
background:transparent url(/wps/images/ibs/hlbrib_bimb/sp_title_bg.gif) top left no-repeat;
}
==>work in IE

#.bodytext_9:hover { TEXT-DECORATION: none}
=>IE do recognise this as comment. Use /* comment */







Wednesday, November 07, 2007

enable automatic JSP reloading in Portal

Follow these steps to enable automatic JSP reloading:

Open the file was_profile_root/config/cells/cell_name/applications/wps.ear/deployments/wps/wps.war/WEB-INF/ibm-web-ext.xmi

Find the following entry in this file:
xmlns:webappext="webappext.xmi" xmlns:webapplication="webapplication.xmi"
xmlns:commonext="commonext.xmi" xmlns:common="common.xmi"
xmi:id="IBM_WPS_Ext" reloadInterval="3" reloadingEnabled="false"
fileServingEnabled="true" directoryBrowsingEnabled="false"
serveServletsByClassnameEnabled="false" preCompileJSPs="false">

Change the value for reloadingEnabled to true.

Save the file.

Restart the portal server.

After completing these steps, JSPs are automatically reloaded when they are changed. However, to view changes to a JSP that is included by another (parent) JSP, you must also change the parent JSP to indicate that it must be reloaded by the server.


ref

Monday, November 05, 2007

SQL UNION and UNION ALL

UNION

The UNION command is used to select related information from two tables, much like the JOIN command. However, when using the UNION command all selected columns need to be of the same data type.

UNION ALL

The UNION ALL command is equal to the UNION command, except that UNION ALL selects all values.

Use "union all" when u wan all data for sql1 & sql2.
:)
"union" sometime might cause data missing if data from sql1 & sql2 are same.

ref

Looking up an EJB home with JNDI

Sometimes it is more convenient for an application to use a corbaname URL as the lookup name. Container-based JNDI clients and thin Java clients can use a corbaname URL. An example of a lookup with a corbaname URL is also included in this section

JNDI lookup from an application running in a container

  java.lang.Object ejbHome =
initialContext.lookup(
"java:comp/env/com/mycompany/accounting/AccountEJB");

JNDI lookup from an application that does not run in a container

java.lang.Object ejbHome = initialContext.lookup(
"cell/nodes/Node1/servers/MyServer/com/mycompany/accounting/AccountEJB");

Server cluster
java.lang.Object ejbHome = initialContext.lookup(
"cell/clusters/MyCluster/com/mycompany/accounting/AccountEJB");

Fixed qualified names
java.lang.Object ejbHome = initialContext.lookup(
"cell/persistent/com/mycompany/accounting/AccountEJB");

JNDI lookup with a corbaname URL
java.lang.Object ejbHome = initialContext.lookup(
"corbaname:iiop:someHost:2809#com/mycompany/accounting/AccountEJB");


ref



Example: Getting an initial context by setting the provider URL property

You can use two different provider URL forms with WebSphere Application Server's initial context factory:

  • A CORBA object URL (new for J2EE 1.3)
  • An IIOP URL

Using a CORBA object URL

env.put(Context.PROVIDER_URL, "corbaloc:iiop:myhost.mycompany.com:2809");

Using a CORBA object URL with multiple name server addresses

env.put(Context.PROVIDER_URL,
"corbaloc::myhost1:9810,:myhost1:9811,:myhost2:9810");

Using a CORBA object URL from an non-WebSphere Application Server JNDI implementation

env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.somecompany.naming.TheirInitialContextFactory");
env.put(Context.PROVIDER_URL,
"corbaname:iiop:myhost.mycompany.com:9810/NameServiceServerRoot");

Using an IIOP URL

env.put(Context.PROVIDER_URL, "iiop://myhost.mycompany.com:2809");

ref