title: Jpa Integration Testing Persistence.xml
body: <p>I am attempting to perform integration testing on services that I have developed. Part of the service involves using daos. At this point what I need to do is in my setup create some sort of connection to the persistent unit and then I can test my service.</p>
  
  <p>I basically copy the persistence.xml and put it in src/test/resources and am trying</p>
  
  <pre><code>@Before
  public void beginTransaction() {
    emf = Persistence.createEntityManagerFactory(dao-test");
    em = emf.createEntityManager();
  }
  </code></pre>
  
  <p>@Test
      public void testAccountDonation(){</p>
  
  <pre><code>    AccountResult result = AccountService.getDonationAmount();
      Assert.assertEquals("Success", result.getResultCode());
  
  
  }
  </code></pre>
  
  <p>A connection could not be obtained for driver class "oracle.jdbc.driver.OracleDriver" and URL "jdbc:oracle:thin:@data-arctichome.arcww2.com:1521:orclgdb1".  You may have specified an invalid URL.</p>
  
  <p>Here is my persistence unit.</p>
  
  <pre><code>&lt;persistence-unit name="dao-test"
      transaction-type="RESOURCE_LOCAL"&gt;
  
      &lt;properties&gt;
          &lt;property name="openjpa.ConnectionDriverName"
              value="oracle.jdbc.driver.OracleDriver" /&gt;
  
  
          &lt;property name="openjpa.ConnectionURL"
              value="jdbc:oracle:thin:@xxxxxxxxx:orclgdb1" /&gt;
          &lt;property name="openjpa.ConnectionUserName" value="xxxxxx" /&gt;
          &lt;property name="openjpa.ConnectionPassword"
              value="xxxxxx" /&gt;
      &lt;/properties&gt;
  &lt;/persistence-unit&gt;
  </code></pre>
  
  <p>Thanks.</p>