websphere and mySQL.

Discussions

General J2EE: websphere and mySQL.

  1. websphere and mySQL. (1 messages)

    Hi,
    I am new to EJB. I am using mySQL and websphere. I am writing a sample application for better understanding.
    I have created the database tables. How should I configure my application to use the database. I mean how would my entity beans talk to the database tables. Also there is a " jdbc provider" option in the admin console of websphere, do I have to do anything here?

    Thanks in advance. R.S

    Threaded Messages (1)

  2. websphere and mySQL.[ Go to top ]

    Hey
       Actually you can do it in 2 ways
    1)Bean managed
    2)Container Managed

    In bean managed:
      in the ejbLoad and ejbStore method we write some simple sql statements for persistance
      These methods need not be called explicitly by client
      Container invokes them
      Its like u insert a row into database when ejbCreate method is called and delete a row when remove method is called
      For getting connection use JNDI for looking up in the context for getting DataSource
      Using this DataSource u get the connection

    In Container Managed:
      In container managed entity bean we actually do not require to write sql statements
      Container Does it for us
    We access database using EJB-QL for storage,retrival of data

    Visit java.sun.com/j2ee/tutorial/1_3_fcs/ for better understanding of these concepts