cancel
Showing results for 
Search instead for 
Did you mean: 

problem configure mysql datasource

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

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.

Former Member
0 Kudos

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