[
https://issues.apache.org/jira/browse/TOMEE-1537?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14392938#comment-14392938
]
CHERANTHIAN MUTHUVINAYAGAM commented on TOMEE-1537:
---------------------------------------------------
Our product requires to store the configuration of data source with in LDAP. I
was looking for a solution and found it in one of your reply to openejb forum
question.
I followed your suggestion in {Dynamic DataSource - Exception
|http://tomee-openejb.979440.n4.nabble.com/Dynamic-DataSource-Exception-td4657657.html].
I copied the text from the above link. I know you already mentioned that it is
an internal mechanism.
{quote}
TomEE supports configuration of datasources and resources (including router) in:
1) tomee.xml
2) resources.xml (app classloader)
3) system.properties or JVM system properties
All of them are static
If you want runtime resource definition you need to use internal
mecanism. Globally it doesn't need to be tomee datasource to work, it
can be custom ones. The easier will be to use DataSourceFactory:
DataSourceFactory.create(name, jta, driverOrDataSourceClass,
propertiesInString, waittime, evictionTimeout, evictableTimeout)
If you don't use JTA compatible datasource you can just use dbcp. If
you prefer just use
SystemInstance.get().getComponent(DataSourceCreator.class). The API is
maybe easier.
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau
{quote}
Thanks for your reply. Always your blog entries are more informative.
> DataSourceFactory.create method removes the single backslash from MS SQL
> Server jdbcUrl string that contains SQL Server instance name that causes
> dataSoruce.getConnection() to throw SQLServerException.
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: TOMEE-1537
> URL: https://issues.apache.org/jira/browse/TOMEE-1537
> Project: TomEE
> Issue Type: Bug
> Affects Versions: 1.7.1
> Environment: Windows, Sql Server 2012, MS Sql Server JDBC Driver 4
> Reporter: John Pratt
> Priority: Critical
>
> If you pass in a valid connection string to the DataSourceFactory.create
> method that contains a single backslash i.e.,
> jdbcUrl=jdbc:sqlserver://IN08268\SQLEXPRESS. The DataSource factory
> implementation parses the “definition” String as java.util.Properties.
> Parsing the string as java.util.Properties removes the single backslash
> character that cause JDBC driver to fail.
> There is a workaround you could do to replace the single backslash with
> double backslash in the jdbcUrl property (but this is an invalid conection
> url for sql server).
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)