1.You can access your BMP, means the jndi is right.
2.You have't configured your data source yet.
3.In your bmp's code, you should put those:
    DataSource ds = (DataSource)ctx.lookup("your data source's jndi name");

解决方案 »

  1.   

    如果和数据库连接没有问题,JNDI 名字正确.这样写就可以了.javax.sql.DataSource myDataSource =null;
    private Connection conn = null;
     public 方法()
     {
        Context ctx = new InitialContext();
        myDataSource = (javax.sql.DataSource)ctx.lookup("AccountHome");
        conn = myDataSource.getConnection();
    }
      

  2.   

    Context ctx = null; 
        Hashtable ht = new Hashtable();  
        ht.put(Context.INITIAL_CONTEXT_FACTORY, 
                   "weblogic.jndi.WLInitialContextFactory"); 
        ht.put(Context.PROVIDER_URL, "t3://localhost:80");    System.out.println("ok1");
        try {    
            ctx = new InitialContext(ht);   
                System.out.println("ok2");         
            javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("AccountHome");
            
            System.out.println("ok3");
            java.sql.Connection conn = ds.getConnection();


            // You can now use the conn object to create Statements and retrieve result sets:

             Statement stmt = conn.createStatement();
             ResultSet rs =stmt.executeQuery("select * from dual ");
    可以试一试!
      

  3.   

    各位大哥。不是我不给分啊。还是报错:翻成中文意思就是:不支持数据库驱动。首先,我有了SQLSERVER JDBC。但是我还是不知道如何在J2EE环境下配置啊!
    请各位再指教一下?正确一定给分。
      

  4.   

    我不明白大家为什么都同意这一句:
    javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("AccountHome");最基本的一点是:“AccountHome”是Bean的名字,并不是DataSource的名字。DataSource的名字需要在服务器中进行设置。不知道这样写,是在找Bean还是在找数据源?好想两者都不是吧!楼主,试试在服务器中建立一个数据源,给一个JNDI名字,然后在Bean中调用,调用的代码跟以上程序基本相同,只是找的JNDI一定得是数据源的名字!另外,楼主在Client中找Bean时,别忘了加服务器的环境参数!
      

  5.   

    javax.sql.DataSource ds = (javax.sql.DataSource) ctx.lookup ("AccountHome");
    在EJB 1.1中这句话不满足规范,我想问问在2.0中可不可以(没分了 :)
      

  6.   

    To:首先,我有了SQLSERVER JDBC。但是我还是不知道如何在J2EE环境下配置啊!
    请各位再指教一下?正确一定给分。
    1、把这三个文件放在..\bea\wlserver6.1\lib目录下,然后进入..\bea\wlserver6.1\config\mydomain目录,修改startWebLogic.cmd中的环境变量,修改后如下:
    set CLASSPATH=.;.\lib\weblogic_sp.jar;.\lib\weblogic.jar;.\lib\msbase.jar;.\lib\mssqlserver.jar;.\lib\msutil.jar2、启动jbuilder,Tools->Enterprise Setup,单击Database Drivers页上的Add, 在弹出的对话框中单击New,. 在弹出的对话框中填写Name为MS SQL Server JDBC, Location选择User Home,单击Add按钮,选择msbase.jar, msutil.jar, mssqlserver.jar,单击OK关闭当前对话框,可以看到MS SQL Server JDBC已被加入,单击OK关闭当前对话框,再次单击OK,配置完成。3、右击“DataSource"--选择“Import Schema From Database--弹出“Database Schema Provider"窗体
    Driver:com.microsoft.jdbc.sqlserver.SQLServerDriver
    URL:jdbc:microsoft:sqlserver://服务器名:1433;DatabaseName=数据库名