cancel
Showing results for 
Search instead for 
Did you mean: 

MySql connection in EJB2

Former Member
0 Kudos

Hi Experts,

I’m new in net weaver. I developed a CMP bean using EJB2 project. Now I want to connect with a table which has in MySql database. In net weaver MAXDB,ORACLE etc… options are there, but MySql is not there. So pls help me for connecting MySql.

Thanks in Advance

Toji.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi Toji,

This is the code example for access to Oracle:

import java.sql.Connection;

import java.sql.DriverManager;

DriverManager.registerDriver(new <b>oracle.jdbc.driver.OracleDriver()</b>);

try{

Connection con = DriverManager.getConnection(serverName, db_user, db_pwd);

}catch(Exception e){

Logger.error(e.toString());

}

<b>oracle.jdbc.driver.OracleDriver()</b> is the driver for access to Oracle.

You can try using <b>com.mysql.jdbc.Driver()</b> for mySql (I have found it in google but I've never used it!

Former Member
0 Kudos

Hi Thanks for ur replay, but sorry it is not sutable. Because i'm doveloping CMP so i have to cofigure MySql database through ejb-jar.xml file. This i want to konw how i can connect through this xml file.