Skip to Content
author's profile photo
Former Member

problem configure mysql datasource

Hi, I am trying to use mysql datasource for my application. I had configured MYSQL_DRIVER and then

i had configured gtasappdb datasource with

driver-class-name = com.mysql.jdbc.Driver

url = jdbc:mysql://localhost:3306/appdb

alias = appdbdatasource

And then i tried to deploy a EJB application which uses the above 'appdbdatasource'. When the application starts

it says cannot find 'gtasappdb' connectionfactory.

So can anyone tell me what should be done to use mysql for my application, please

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

2 Answers

  • author's profile photo
    Former Member
    Aug 19, 2004 at 06:28 AM

    Hello mahesh,

    There are two ways.

    1. You should add a resource reference to the ds alias in the deployment descriptor of the application component.Once you have defined the reference,use the following snippet to access the data source

    DataSource ds = (DataSource) context.lookup("java:comp/env/<res-ref-name>").

    2. If you have not defined the reference in your application, use the JNDI reference "jdbc/alias".

    Hope this helps,

    Prasad

    Add comment
    10|10000 characters needed characters exceeded

  • author's profile photo
    Former Member
    Aug 19, 2004 at 06:58 AM

    Hi Mahesh,

    I just want to add a remark to Prasad's reply. Please, use the first suggested option - that is, declare a resource reference and then use the resource reference name to lookup the data source.

    See the following documentation for information about resource references: http://help.sap.com/saphelp_nw04/helpdata/en/64/8590109a86f145958fb22dab86d58d/frameset.htm

    Zornitsa

    P.S. Also, make sure you register the data source with 'Native SQL' support.

    Add comment
    10|10000 characters needed characters exceeded