Hello!

Although I'm using CMP beans, in some cases (primary key generation) I
need to execute the SQL queries directly (that is, from within the
bean).

I'm using the following code to get the database connection in such
cases:


            private Connection estabslishDatabaseConnection() throws
NamingException, SQLException 
            {
                Connection connection = null;
                InitialContext initialContext = new InitialContext();
                DataSource dataSource =
(DataSource)initialContext.lookup("java:/MySqlDS");
                connection = dataSource.getConnection();
                return connection;
            }


If I do it in this way, do I not bypass the connection pooling
mechanism of JBoss?

If I do, how should the code be changed to establish a database
connection properly (that is, by using connection pooled by JBoss) ?

Thanks

Dimitri Pissarenko


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to