打印本文 打印本文 关闭窗口 关闭窗口
整合JBoss 3.x 和MS SQL Server 2000
作者:武汉SEO闵涛  文章来源:敏韬网  点击数7238  更新时间:2007/11/14 12:59:50  文章录入:mintao  责任编辑:mintao

            } catch (Exception e) {

            }

            finally {

                    if(rs!=null) rs.close();

                    if(st!=null) st.close();

                    if(conn!=null) conn.close();

            }

        } catch (Exception e) {

            e.printStackTrace();

        }

        return resl;

    }


2.        
部署EJB


3.        
测试SessionBean

public class test{

       public void run() {

        Properties p = new Properties();

        p.put(Context.INITIAL_CONTEXT_FACTORY,  "org.jnp.interfaces.NamingContextFactory");

        p.put(Context.PROVIDER_URL, "jnp://localhost:1099");

        try {

            Context ctx = new InitialContext(p);

            Object obj = ctx.lookup("testBean");

            testHome home = (testHome) PortableRemoteObject.narrow(obj, testHome.class);

            test t = home.create();

 

            System.out.println("test...");

            String str = t.testDS();

            System.out.println("received: \n" + str);

            System.out.println("test finished!\n");

        } catch (Exception e) {

            e.printStackTrace();

        }

   

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9]  下一页

打印本文 打印本文 关闭窗口 关闭窗口