Two datasources connection problem WSAD4.0.3

Discussions

EJB programming & troubleshooting: Two datasources connection problem WSAD4.0.3

  1. Two datasources connection problem WSAD4.0.3 (1 messages)

    I am using WSAD4.0.3 in our project. For our application we have two Oracle 9i DBs.We have some tables in DB1 and rest in the other DB2. For my testing i am using the Advance Single Server Edition included in WSAD4.0.3. On the server configuration, i created two datasources, one for each DB, with JNDI names as jdbc/ds1 and jdbc/ds2, and default values for time attributes.
    //User Login Process.
    Call Business delegate method.
    Call Session bean method.
    Call DAO method...
    Datasource ds1 = (Datasource)context.lookup("jdbc/ds1");
    Connection con1 = ds1.getConnection();
    // Create and Execute the prepared stmt 1(SELECT * FROM DEMO1)
    con1.close();

    //For Next Action
    Call Business delegate method.
    Call Session bean method.
    Call DAO method...
    Datasource ds2 = (Datasource)context.lookup("jdbc/ds2");
    Connection con2 = ds2.getConnection();
    // Create and Execute the prepared stmt 2 (SELECT * FROM DEMO2)
    con2.close();

    Its executing prepared stmt 2 using the connection con1 and the table DEMO2 doesnt exist in DB1. Thats why i am getting Table doesnt exist error. Please advise.
    Thanks
    Ravi.
  2. check the user previliges for DS2. Chk if he can access that table(if he is admin etc). Also close ds1.

    thanks
    Sri