How to use dataBase other than cloudscape in J2ee server - urgen

Discussions

EJB programming & troubleshooting: How to use dataBase other than cloudscape in J2ee server - urgen

  1. hi to all,
        i am new to the world of ejb. I have coded my CMP Entity Beans. The problem which i am facing is how to use my own Database , as with j2ee server(j2ee 1.3) has it's own Cloudscape DB. The option i have either i should create my tables in the cloudscape DB(which i don't want to use).

    So can any body help me to share his/her knowledge regarding this problem . I will be very thanxful.

    It's urgency.!

    cheers
    deepak
  2. Hi ,
    Pls have the entry in the weblogic.properties as
    weblogic.jdbc.connectionPool.clientPool=\
    url=jdbc:oracle:thin:@171.97.1.5:1521:oracleDb,\
    driver=oracle.jdbc.driver.OracleDriver,\
    initialCapacity=1,\
    maxCapacity=6,\
    capacityIncrement=1,\
    props=user=userName;password=userPwd

    machineip=171.97.1.5:1521
    1521 is used by oracle so u have suffix with ip
    oracle instance =oracleDb

    In the xml of cmp u have to mention the clientPool....

    I hope it could help u ..If u have nay more clarification u can reply....
  3. Thanx..
    thanx for ur usefull information ...it can help me in my work

  4. hi mic,
    thanxs for ur valueable information .
    But the thing what i want to know is that
    first of all i am using J2SDKEE 1.3 and
    as u know i have coded my CMP's , but the problem is that
    i am unable to connect the database
    i exaclty code what i have done

    ////////////////// for getting connection i have done

    import javax.sql.DataSource
    private Connection getConnection()
        throws SQLException
      {
        InitialContext initCtx = null;
        try {
           initCtx = new InitialContext();
    DataSource ds= (javax.sql.DataSource) initCtx.lookup("java:comp/env/jdbc/TimeReportDB");
           return ds.getConnection();
         }
        catch(NamingException ne)
         {
           log("Failed to lookup JDBC Datasource. Please double check that");
           throw new EJBException(ne);
         }
        finally
         {
           try {
             if(initCtx != null) initCtx.close();
           }
           catch(NamingException ne)
           {
                   log("Error closing context: " + ne);
                   throw new EJBException(ne);
           }
         }
      }


     throught deplooyment tool setting
    i have set the following

    jdbcDataSource.name=jdbc/TimeReportDB
    jdbcDataSource.url=jdbc:odbc:TimeReportDB
    jdbcDriver.name=sun.jdbc.odbc.JdbcOdbcDriver

    "jdbc:odbc:TimeReportDB" is the DSN name &
    "jdbc/TimeReportDB" is the JNDI name

    the error which i am getting is
    SQLException -- Not a suitable Driver

    it will be quite helpful for me , is u give solution/steps to configure my database in j2sdkee1.3

    Deepak

  5. If u look carefully - u are attempting to use jdbc:odbc bridge instead of just pure type 3 or 4 JDBC drivers for Oracle -thats why it is complaining "Not a suitable driver "

    How ever if u are connecting using jdbc-odbc bridge please create a DSN on ur windows2000/NT to the Oracle db that u are trying to connet to.

    There is a basic tutorial on jdbc here http://java.sun.com/docs/books/tutorial/jdbc/basics/index.html

    Here is a link on sun site describing the types of database and the use. http://java.sun.com/products/jdbc/driverdesc.html


  6. hi mic
    i had already created the DSN !
    deepak
  7. I think you are using J2EE RI from SUN. In that case, you will need to edit configuration file
     {j2ee1.3HOME}/config/resource.properties. I am assuming that you are using Oracle Database. You need to add the following entries :

    jdbcDataSource.5.name=jdbc/mydata
    jdbcDataSource.5.url=jdbc:oracle:thin:@abhi:1521:MyDB;create=true
    jdbcDriver.1.name=oracle.jdbc.driver.OracleDriver.

    I hope this helps.

    Ciao,

    Abhi

  8. hi ABHIJEET ,
    thanxs for u valueable suggestion ,
    intially i was trying out with MS Access .
    i don't think J2sdkee1.3 has a combation with Access database , know i am trying out with oracle
    thanxs once again
    deepaki
  9. hi abhi ,
    i am getting a problem (Exception)when my bean trys to connect with database

    SQLException: java.sql.SQLException: Io exception: Connection refused(DESCRIPTI
    ON=(TMP=)(VSNNUM=135294976)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4)))
    )

    and i am using following in resource properties file

    jdbcDataSource.5.name=jdbc/TimeReportDB
    jdbcDataSource.5.url=jdbc:oracle:thin:@99.0.0.200:1521:ericwave,scott,tiger;create=true

    thanxs
    deepak