Bill Dao

Greenhorn
+ Follow
since Nov 14, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Bill Dao

Hi all,
When i make a report with 2-tier, I usually do the following pattern:
Java Application(Client) <----> Database (Server)
Crystal Report <----> Store procedure
And now i must make a report with 3-tier :
Java Application(Client) <----> Middle tier(Server) <----> Database (Server)
Crystal Report <----> EJB <----> Store procedure
I have a trouble with :
Java Application(Client) <----> Middle tier(Server)
Crystal Report <----> EJB
With 3-tier ,if I don't want to use store procedure, and I want to use EJB to make report with Crystal Report.
Can you help me ?
17 years ago
Can you give me the example code which implements what you tell me ?. Thanks for your attention.
Thanks for your reading. Can you show me detail of this problem ?. If you can't, can you help me to tel me the reference links which describes this problem ?
I read Sun EJB Tutorial, but you know that you can create temporary table and you can use cursor in store procedure. For example with code of SP
CREATE TABLE #TempTable(
CustomerID int,
TotalMoney numeric)
INSERT INTO #TempTable
SELECT a.CustomerID, SUM(a.Total1) FROM table1 a
GROUP BY a.CustomerID
INSERT INTO #TempTable
SELECT b.CustomerID, SUM(b.Total2) FROM table1 b
GROUP BY b.CustomerID
UPDATE #TempTable SET TotalMoney=0 WHERE CustomerID<=0
SELECT CustomerID, TotalMoney FROM TempTable
GROUP BY CustomerID
I want to how to write similar code which can do it in EJB. Thanks for your attention.
For last, I used to write store procedure, trigger in SQL Server 2000. And now I want to move store procedure code, trigger code and implement it into EJB technology. Can you help me how to do it ?. Thanks a lot.
OK. Thank you.
17 years ago
I use IBM WebSphere 5.0 for development.
1) In EJB Modules, I have a SessionBean with simple helloworld method returns String "HelloWorld"). I deployed and RMIC code.
2) In Application Client Module, I have a java class with
public static void main(String [] args){
HashTable env = new HashTable();
String result;
try{
env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(javax.naming.Context.PROVIDER_URL, "iiop://127.0.0.1:2809");
InitialContext initialContext = new InitialContext(env);
Object ref = initialContext.lookup("HelloWorld");
HelloWorldHome home = (HelloWorldHome)
javax.rmi.PortableRemoteObject.narrow
(ref,HelloWorldHome.class);
HelloWorld obj = home.create();
result=obj.helloworld();
System.out.print(result);
}catch (java.rmi.RemoteException re){re.printStackTrace();}
catch (javax.naming.NamingException ne){ne.printStackTrace();}
catch (javax.ejb.CreateException ce){ce.printStackTrace();}
catch (javax.ejb.FinderException fe){fe.printStackTrace();}
}
Then I create a testserver in IBM WSAD 5.0, run EJB on this server and run Application Client in Websphere Client Enviroment. I test EJB and Client on one computer and console printed "Hello World". But when I run EJB module on first computer only server with IPAdd : 10.4.100.24 and RMI connector at port 2809 , Application Client on second computer. Both of computer installed IBM WSAD 5.0 . With Client code following :
public static void main(String [] args){
HashTable env = new HashTable();
String result;
try{
env.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
env.put(javax.naming.Context.PROVIDER_URL, "iiop://10.4.100.24:2809");
InitialContext initialContext = new InitialContext(env);
Object ref = initialContext.lookup("HelloWorld");
HelloWorldHome home = (HelloWorldHome)
javax.rmi.PortableRemoteObject.narrow
(ref,HelloWorldHome.class);
HelloWorld obj = home.create();
result=obj.helloworld();
System.out.print(result);
}catch (java.rmi.RemoteException re){re.printStackTrace();}
catch (javax.naming.NamingException ne){ne.printStackTrace();}
catch (javax.ejb.CreateException ce){ce.printStackTrace();}
catch (javax.ejb.FinderException fe){fe.printStackTrace();}
}
I receive from second computer :
javax.naming.CommunicationException :.........."iiop://10.4.100.24:2809"....
I don't understand. Can you help me ?
17 years ago