Hi, Great thanks for the reply. Here is some background and my question:
I have openejb setup and have managed to get the HelloWorld example working on
my configuration. I use oc4j at work so I know a reasonable amount about ejbs.
I also have a working mysql setup and i am able to query using connector J and
jdbc.
What I want to do is take the HelloWorld example and get a pooled database
connection from it and issue a select statement. But I cant seem to find any
information on this.
So I would like the HelloBean.java example to do something like this :
public String sayHello() throws java.rmi.RemoteException {
PreparedStatement pstmt;
try {
con=getDbConnection();
String sql_stmt;
String results = "";
sql_stmt="SELECT id, name from TUSERS";
pstmt = con.prepareStatement(sql_stmt);
rs = pstmt.executeQuery();
while (rs.next())
{
results+= rs.getString("name");
}
rs.close();
pstmt.close();
con.close();
return results;
}
I would like to define getDbConnection(); to get the connection as a private
method inside the ejb. For example at work we do the following:
private Connection getDbConnection()
{
try
{
Connection con1;
context = new InitialContext();
jdbcURL = (DataSource) context.lookup("jdbc/ejb/OurDS");
con1 = jdbcURL.getConnection();
return con1;
}
catch(javax.naming.NamingException re)
{
re.printStackTrace();
}
catch(java.sql.SQLException re)
{
re.printStackTrace();
}
return null;
}
But I am at a loss as to how to define the connection for mysql within openejb
(which files to edit and what to put in there). I looked at openejb.conf and
it has a <connector> tag for mysql which i uncommented but I dont know what to
do with it! I dont know how I can use context.lookup to find my database and
get the connection as i have shown above.
Thanks for your help,
Ed
"Alan D. Cabrera" <[EMAIL PROTECTED]> wrote:
[EMAIL PROTECTED] wrote, On 7/7/2005 9:01 PM:
>Hi , I need help with my openejb confiuration and was wondering what the
>correct email address to send questions to is?
>
>
This is it! What's your question?
Regards,
Alan