You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by camelContext <pr...@citrix.com> on 2009/11/06 03:40:10 UTC

Custom path for drivers

Hi All,

I am using iBATIS tool for running all my DB migrations. As of now, the
script mandates that i have all the driver jar files, inside a drivers
folder in my root folder
i.e 

ROOT
  |
   -- scripts
  |
   -- environments
  |
   -- drivers
          |
           -- ojdbc.jar .....



I have multiple services which use the iBATIS tool and all my services need
the same drivers. It will be redundant to have the same files copied in n
number of locations. I would like to know if there is a way to custom
configure the driver path, so that the tool can load all the drivers from a
central location? 

I did modify the BaseCommand to cater to this need. I have attached the code
review with this post. If this feature is already existing, please do let me
know how to use the same. Else, i would suggest that my code be reviewed and
let me know if i can submit the patch.
http://old.nabble.com/file/p26225652/custom-driver-ibatis-3.patch
custom-driver-ibatis-3.patch 
-- 
View this message in context: http://old.nabble.com/Custom-path-for-drivers-tp26225652p26225652.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: Custom path for drivers

Posted by camelContext <pr...@citrix.com>.
May i know if the patch is accepted. the Jira status still says unassigned.
This is an essential feature and will be a good addon to the tool.



camelContext wrote:
> 
> Added a jira request with the patch attached to it.
> 
> https://issues.apache.org/jira/browse/IBATIS-685
> 
> 
> 
> Clinton Begin wrote:
>> 
>> Please atttache your patch (or just the BaseCommand.java is easier) to a
>> JIRA feature request...
>> 
>> Clinton
>> 
>> On Thu, Nov 5, 2009 at 7:47 PM, camelContext
>> <pr...@citrix.com>wrote:
>> 
>>>
>>> The patch file changes
>>>
>>> Index:
>>>
>>> trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/BaseCommand.java
>>> ===================================================================
>>> ---
>>>
>>> trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/BaseCommand.java
>>> (revision 828216)
>>> +++
>>>
>>> trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/BaseCommand.java
>>> (working copy)
>>> @@ -228,6 +228,10 @@
>>>
>>>   private void lazyInitializeDrivers() {
>>>     try {
>>> +      String customDriverPath =
>>> environmentProperties().getProperty("driverPath");
>>> +      if(customDriverPath != null && customDriverPath.length()>0){
>>> +          driverPath = new File(customDriverPath);
>>> +      }
>>>       if (driverClassLoader == null && driverPath.exists()) {
>>>         List<URL> urlList = new ArrayList<URL>();
>>>         for (File file : driverPath.listFiles()) {
>>>
>>>
>>>
>>> camelContext wrote:
>>> >
>>> > Hi All,
>>> >
>>> > I am using iBATIS tool for running all my DB migrations. As of now,
>>> the
>>> > script mandates that i have all the driver jar files, inside a drivers
>>> > folder in my root folder
>>> > i.e
>>> >
>>> > ROOT
>>> >   |
>>> >    -- scripts
>>> >   |
>>> >    -- environments
>>> >   |
>>> >    -- drivers
>>> >           |
>>> >            -- ojdbc.jar .....
>>> >
>>> >
>>> >
>>> > I have multiple services which use the iBATIS tool and all my services
>>> > need the same drivers. It will be redundant to have the same files
>>> copied
>>> > in n number of locations. I would like to know if there is a way to
>>> custom
>>> > configure the driver path, so that the tool can load all the drivers
>>> from
>>> > a central location?
>>> >
>>> > I did modify the BaseCommand to cater to this need. I have attached
>>> the
>>> > code review with this post. If this feature is already existing,
>>> please
>>> do
>>> > let me know how to use the same. Else, i would suggest that my code be
>>> > reviewed and let me know if i can submit the patch.
>>> > http://old.nabble.com/file/p26225652/custom-driver-ibatis-3.patch
>>> > custom-driver-ibatis-3.patch
>>> >
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Custom-path-for-drivers-tp26225652p26225655.html
>>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>>
>>>
>> 
>> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Custom-path-for-drivers-tp26225652p26614577.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: Custom path for drivers

Posted by camelContext <pr...@citrix.com>.
Added a jira request with the patch attached to it.

https://issues.apache.org/jira/browse/IBATIS-685



Clinton Begin wrote:
> 
> Please atttache your patch (or just the BaseCommand.java is easier) to a
> JIRA feature request...
> 
> Clinton
> 
> On Thu, Nov 5, 2009 at 7:47 PM, camelContext
> <pr...@citrix.com>wrote:
> 
>>
>> The patch file changes
>>
>> Index:
>>
>> trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/BaseCommand.java
>> ===================================================================
>> ---
>>
>> trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/BaseCommand.java
>> (revision 828216)
>> +++
>>
>> trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/BaseCommand.java
>> (working copy)
>> @@ -228,6 +228,10 @@
>>
>>   private void lazyInitializeDrivers() {
>>     try {
>> +      String customDriverPath =
>> environmentProperties().getProperty("driverPath");
>> +      if(customDriverPath != null && customDriverPath.length()>0){
>> +          driverPath = new File(customDriverPath);
>> +      }
>>       if (driverClassLoader == null && driverPath.exists()) {
>>         List<URL> urlList = new ArrayList<URL>();
>>         for (File file : driverPath.listFiles()) {
>>
>>
>>
>> camelContext wrote:
>> >
>> > Hi All,
>> >
>> > I am using iBATIS tool for running all my DB migrations. As of now, the
>> > script mandates that i have all the driver jar files, inside a drivers
>> > folder in my root folder
>> > i.e
>> >
>> > ROOT
>> >   |
>> >    -- scripts
>> >   |
>> >    -- environments
>> >   |
>> >    -- drivers
>> >           |
>> >            -- ojdbc.jar .....
>> >
>> >
>> >
>> > I have multiple services which use the iBATIS tool and all my services
>> > need the same drivers. It will be redundant to have the same files
>> copied
>> > in n number of locations. I would like to know if there is a way to
>> custom
>> > configure the driver path, so that the tool can load all the drivers
>> from
>> > a central location?
>> >
>> > I did modify the BaseCommand to cater to this need. I have attached the
>> > code review with this post. If this feature is already existing, please
>> do
>> > let me know how to use the same. Else, i would suggest that my code be
>> > reviewed and let me know if i can submit the patch.
>> > http://old.nabble.com/file/p26225652/custom-driver-ibatis-3.patch
>> > custom-driver-ibatis-3.patch
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Custom-path-for-drivers-tp26225652p26225655.html
>> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
>> For additional commands, e-mail: user-java-help@ibatis.apache.org
>>
>>
> 
> 

-- 
View this message in context: http://old.nabble.com/Custom-path-for-drivers-tp26225652p26226548.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Re: Custom path for drivers

Posted by Clinton Begin <cl...@gmail.com>.
Please atttache your patch (or just the BaseCommand.java is easier) to a
JIRA feature request...

Clinton

On Thu, Nov 5, 2009 at 7:47 PM, camelContext <pr...@citrix.com>wrote:

>
> The patch file changes
>
> Index:
>
> trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/BaseCommand.java
> ===================================================================
> ---
>
> trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/BaseCommand.java
> (revision 828216)
> +++
>
> trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/BaseCommand.java
> (working copy)
> @@ -228,6 +228,10 @@
>
>   private void lazyInitializeDrivers() {
>     try {
> +      String customDriverPath =
> environmentProperties().getProperty("driverPath");
> +      if(customDriverPath != null && customDriverPath.length()>0){
> +          driverPath = new File(customDriverPath);
> +      }
>       if (driverClassLoader == null && driverPath.exists()) {
>         List<URL> urlList = new ArrayList<URL>();
>         for (File file : driverPath.listFiles()) {
>
>
>
> camelContext wrote:
> >
> > Hi All,
> >
> > I am using iBATIS tool for running all my DB migrations. As of now, the
> > script mandates that i have all the driver jar files, inside a drivers
> > folder in my root folder
> > i.e
> >
> > ROOT
> >   |
> >    -- scripts
> >   |
> >    -- environments
> >   |
> >    -- drivers
> >           |
> >            -- ojdbc.jar .....
> >
> >
> >
> > I have multiple services which use the iBATIS tool and all my services
> > need the same drivers. It will be redundant to have the same files copied
> > in n number of locations. I would like to know if there is a way to
> custom
> > configure the driver path, so that the tool can load all the drivers from
> > a central location?
> >
> > I did modify the BaseCommand to cater to this need. I have attached the
> > code review with this post. If this feature is already existing, please
> do
> > let me know how to use the same. Else, i would suggest that my code be
> > reviewed and let me know if i can submit the patch.
> > http://old.nabble.com/file/p26225652/custom-driver-ibatis-3.patch
> > custom-driver-ibatis-3.patch
> >
>
> --
> View this message in context:
> http://old.nabble.com/Custom-path-for-drivers-tp26225652p26225655.html
> Sent from the iBATIS - User - Java mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
> For additional commands, e-mail: user-java-help@ibatis.apache.org
>
>

Re: Custom path for drivers

Posted by camelContext <pr...@citrix.com>.
The patch file changes

Index:
trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/BaseCommand.java
===================================================================
---
trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/BaseCommand.java
(revision 828216)
+++
trunk/ibatis-3-core/src/main/java/org/apache/ibatis/migration/commands/BaseCommand.java
(working copy)
@@ -228,6 +228,10 @@
 
   private void lazyInitializeDrivers() {
     try {
+      String customDriverPath =
environmentProperties().getProperty("driverPath");
+      if(customDriverPath != null && customDriverPath.length()>0){
+          driverPath = new File(customDriverPath);
+      }
       if (driverClassLoader == null && driverPath.exists()) {
         List<URL> urlList = new ArrayList<URL>();
         for (File file : driverPath.listFiles()) {



camelContext wrote:
> 
> Hi All,
> 
> I am using iBATIS tool for running all my DB migrations. As of now, the
> script mandates that i have all the driver jar files, inside a drivers
> folder in my root folder
> i.e 
> 
> ROOT
>   |
>    -- scripts
>   |
>    -- environments
>   |
>    -- drivers
>           |
>            -- ojdbc.jar .....
> 
> 
> 
> I have multiple services which use the iBATIS tool and all my services
> need the same drivers. It will be redundant to have the same files copied
> in n number of locations. I would like to know if there is a way to custom
> configure the driver path, so that the tool can load all the drivers from
> a central location? 
> 
> I did modify the BaseCommand to cater to this need. I have attached the
> code review with this post. If this feature is already existing, please do
> let me know how to use the same. Else, i would suggest that my code be
> reviewed and let me know if i can submit the patch.
> http://old.nabble.com/file/p26225652/custom-driver-ibatis-3.patch
> custom-driver-ibatis-3.patch 
> 

-- 
View this message in context: http://old.nabble.com/Custom-path-for-drivers-tp26225652p26225655.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org