4 Replies Latest reply on Jan 11, 2004 1:59 AM by joshlam

    Testing database interaction using JUnit

    joshlam Newbie


      I am in the process of migrating some legacy database code that uses pure JDBC over to JBoss 3.2.1. The plan is to have a dedicated session bean or a message driven bean invoke these legacy JDBC code.

      I have successfully configured JBoss so that I can get a database connection (the database is Oracle 9x) from a message driven bean and then invoke some store procedures via JDBC.

      I however, have some existing JUnit test code that I have been using to test those legacy JDBC functions. How do I make those JUnit code work within the jBoss environment? The important thing is to have the JUnit code get a database connection provided by jBoss (independent of any EJB) so that the code can invoke the appropriate JDBC function. The goal is to test these JDBC functions with the same jBoss code that the EJBs would use to retrieve the database connections.

      From reading past posts, I have not found a way to get a database connection through jBoss other than a EJB. However, if someone has found a way, I would really appreciate any help.