[ 
https://issues.apache.org/jira/browse/TOMEE-171?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13264409#comment-13264409
 ] 

Henk de Boer commented on TOMEE-171:
------------------------------------

>we create a pool and not just a datasource from the specified class. for this 
>reason we need a jdbc driver.

I wonder if you really need the JDBC driver class. There is a similar 
discussion currently on the JBoss JIRA (their web.xml 
data-source/persistence.xml combo also didn't work correctly, see 
https://issues.jboss.org/browse/AS7-4552)

To crosspost a relevant part of my reply from there:

"A plain javax.sql.DataSource that's provided by the DB vendor is a direct 
alternative for java.sql.Driver. In fact, it's the more modern and preferable 
version. Such DataSource shouldn't do much if any connection management and 
certainly shouldn't do any pooling.

This DataSource typically calls the DriverManager (java.sql.DriverManager), 
which on its turn calls the Driver.connect method. java.sql.Driver#connect can 
take extra properties, but apart from "user" and "password" these are DB 
specific. The DataSource implementation can be configured with the same kind of 
DB specific properties.

So, in my understanding, the differences between java.sql.Driver and 
javax.sql.DataSource are rather small and they eventually end up at the same 
point.

[...]

Other AS implementations, like GlassFish, do all their magic with a 
javax.sql.DataSource (or XA variant) instead of a Driver."

{quote}Can you try adding the property JdbcDriver=xxx please?{quote}

I'll certainly try this. To be clear, this is a property for the data-source 
element in web.xml?
                
> TomEE automatically directs embedded (@DataSourceDefinition) h2 datasource to 
> hsqldb
> ------------------------------------------------------------------------------------
>
>                 Key: TOMEE-171
>                 URL: https://issues.apache.org/jira/browse/TOMEE-171
>             Project: TomEE
>          Issue Type: Bug
>    Affects Versions: 1.0.0-beta-2
>         Environment: Mac OS X 10.6.8, JDK6u31, h2 1.3.161
>            Reporter: Henk de Boer
>         Attachments: crudh2_eclipseproject.zip
>
>
> When trying to run an example CRUD application for Java EE 6 (see 
> http://henk53.wordpress.com/2012/04/15/jsf2-primefaces3-ejb3-jpa2-integration-project)
>  on TomEE beta 2, I noticed that the logs and data for the embedded h2 
> datasource end up as hsqldb equivalents in [TOMEE HOME]/data/hsqldb/.
> The datasource definition in web.xml is as follows:
> {code:xml}
>       <data-source>
>               <name>java:app/MyApp/myDS</name>
>               <class-name>org.h2.jdbcx.JdbcDataSource</class-name>
>               <url>jdbc:h2:~/mydb;DB_CLOSE_DELAY=-1</url>
>               <user>sa</user>
>               <password>sa</password>
>               <transactional>true</transactional>
>               <isolation-level>TRANSACTION_READ_COMMITTED</isolation-level>
>               <initial-pool-size>2</initial-pool-size>
>               <max-pool-size>10</max-pool-size>
>               <min-pool-size>5</min-pool-size>
>               <max-statements>0</max-statements>
>       </data-source>
> {code}
> So clearly it should be using h2, and the DB should be created in my home as 
> {{mydb}}. When I remove the h2 implementation jar from WEB-INF/lib, TomEE 
> does complain, so it does try to do something with h2 for sure. Inspecting 
> the log reveals it really are hsqldb log lines and not h2.
> What's happening here? Why is TomEE silently swapping one DB for the other?
>  

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to