Hi,

How do I set database properties in latest carbon-datasources?
https://github.com/wso2/carbon-datasources

As mentioned below, Metrics component needs database properties to work
with Oracle database.


On Mon, Oct 12, 2015 at 11:54 AM, Kalpa Welivitigoda <[email protected]>
wrote:

> Hi all,
>
> This is merged to release-4.4.2.
>
> Madhawa is working on the PR for master branch.
>
> On Mon, Oct 12, 2015 at 10:08 AM, Isuru Perera <[email protected]> wrote:
>
>> Hi Carbon Team,
>>
>> I really appreciate if you can review and merge the PR before Carbon
>> 4.4.2 release. I also don't see any breaking changes and we should be able
>> to include this in a patch release.
>>
>> The MB issue is blocked by this Carbon issue [2]
>>
>> [1] https://wso2.org/jira/browse/MB-1271
>> [2] https://wso2.org/jira/browse/CARBON-15497
>>
>> On Fri, Oct 9, 2015 at 6:57 PM, Anjana Fernando <[email protected]> wrote:
>>
>>> It is not actually adding a new config, it is just adding a new config
>>> section to an already existing configuration file. So I hope that's not a
>>> problem.
>>>
>>> Cheers,
>>> Anjana.
>>>
>>> On Fri, Oct 9, 2015 at 5:07 PM, Madhawa Gunasekara <[email protected]>
>>> wrote:
>>>
>>>> Hi Kalpa,
>>>>
>>>> I didn't do any API additions in the fix. just added a config only. I
>>>> think we can configs in patch releases?
>>>>
>>>> Thanks,
>>>> Madhawa
>>>>
>>>> On Fri, Oct 9, 2015 at 4:57 PM, Kalpa Welivitigoda <[email protected]>
>>>> wrote:
>>>>
>>>>> Hi Madhawa,
>>>>>
>>>>> I made some comments in [1], please have a look.
>>>>>
>>>>> On Fri, Oct 9, 2015 at 3:21 PM, Madhawa Gunasekara <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> Hi Kalpa,
>>>>>>
>>>>>> Can we have this improvement in 4.4.2 carbon release. I have sent a
>>>>>> pull request with tests.
>>>>>>
>>>>>> [1] https://github.com/wso2/carbon-kernel/pull/528/files
>>>>>> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fwso2%2Fcarbon-kernel%2Fpull%2F528%2Ffiles&sa=D&sntz=1&usg=AFQjCNFR2r3QSggZwV3Vtpcs4kwvoGqIaA>
>>>>>>
>>>>>> Thanks,
>>>>>> Madhawa
>>>>>>
>>>>>> On Thu, Oct 8, 2015 at 8:14 PM, Isuru Perera <[email protected]> wrote:
>>>>>>
>>>>>>> Created a JIRA: https://wso2.org/jira/browse/CARBON-15497
>>>>>>>
>>>>>>> On Thu, Oct 8, 2015 at 6:13 PM, Madhawa Gunasekara <
>>>>>>> [email protected]> wrote:
>>>>>>>
>>>>>>>> Hi Anjana,
>>>>>>>>
>>>>>>>> Sure will do it.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>> Madhawa
>>>>>>>>
>>>>>>>> On Thu, Oct 8, 2015 at 6:05 PM, Anjana Fernando <[email protected]>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> I think this functionality is not exposed from our ndatasource
>>>>>>>>> RDBMSDataSourceReader implementation. We would have to put a new 
>>>>>>>>> property
>>>>>>>>> to set these "DB properties". I think, these must be the properties 
>>>>>>>>> passed
>>>>>>>>> into when creating a new connection with this [1]. @Madhawa, shall we
>>>>>>>>> implement this for a future Kernel release, by adding a new section 
>>>>>>>>> to put
>>>>>>>>> these properties in the configuration.
>>>>>>>>>
>>>>>>>>> [1] http://docs.oracle.com/javase/7/docs/api/java/sql/DriverMana
>>>>>>>>> ger.html#getConnection(java.lang.String,%20java.util.Properties)
>>>>>>>>>
>>>>>>>>> Cheers,
>>>>>>>>> Anjana.
>>>>>>>>>
>>>>>>>>> On Thu, Oct 8, 2015 at 3:33 PM, Isuru Perera <[email protected]>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> With Carbon Metrics, I need to save some "double" values in the
>>>>>>>>>> database. Sometimes the Oracle JDBC Driver throws "Underflow" 
>>>>>>>>>> exceptions
>>>>>>>>>> [1] when trying to set a double to a prepared statement.
>>>>>>>>>>
>>>>>>>>>> To solve that issue, I changed the database columns to "
>>>>>>>>>> BINARY_DOUBLE
>>>>>>>>>> <https://docs.oracle.com/cd/E11882_01/timesten.112/e21642/types.htm#BABIGDEA>"
>>>>>>>>>> [2] and I want to set the property "SetFloatAndDoubleUseBinary" to 
>>>>>>>>>> true.
>>>>>>>>>>
>>>>>>>>>> I tested this with a standalone app with Tomcat JDBC and it works.
>>>>>>>>>>
>>>>>>>>>> import org.apache.tomcat.jdbc.pool.DataSource;
>>>>>>>>>> import org.apache.tomcat.jdbc.pool.PoolProperties;
>>>>>>>>>> ...
>>>>>>>>>>
>>>>>>>>>> PoolProperties p = new PoolProperties();
>>>>>>>>>> p.setUrl("jdbc:oracle:thin:@localhost:1521/metrics");
>>>>>>>>>> p.setDriverClassName("oracle.jdbc.OracleDriver");
>>>>>>>>>> p.setUsername("USER");
>>>>>>>>>> p.setPassword("PASSWD");
>>>>>>>>>> ....
>>>>>>>>>> DataSource datasource = new DataSource();
>>>>>>>>>> datasource.setPoolProperties(p);
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> *Properties properties = new
>>>>>>>>>> Properties();properties.setProperty("SetFloatAndDoubleUseBinary",
>>>>>>>>>> "true");p.setDbProperties(properties);*
>>>>>>>>>>
>>>>>>>>>> I thought there is a way to set these kinds of properties in
>>>>>>>>>> *-datasources.xml file. However I don't see a way to do that in
>>>>>>>>>> configuration [3].
>>>>>>>>>>
>>>>>>>>>> I don't want to change the double values and I want to save it
>>>>>>>>>> directly in the database. How do we fix this?
>>>>>>>>>>
>>>>>>>>>> Thanks!
>>>>>>>>>>
>>>>>>>>>> Best Regards,
>>>>>>>>>>
>>>>>>>>>> [1] https://wso2.org/jira/browse/MB-1271
>>>>>>>>>> [2] https://docs.oracle.com/cd/E11882_01/timesten.112/e21642/typ
>>>>>>>>>> es.htm#BABIGDEA
>>>>>>>>>> [3] https://github.com/wso2/carbon-kernel/blob/v4.4.1/core/org.
>>>>>>>>>> wso2.carbon.ndatasource.rdbms/src/main/java/org/wso2/carbon/
>>>>>>>>>> ndatasource/rdbms/RDBMSConfiguration.java
>>>>>>>>>> --
>>>>>>>>>> Isuru Perera
>>>>>>>>>> Associate Technical Lead | WSO2, Inc. | http://wso2.com/
>>>>>>>>>> Lean . Enterprise . Middleware
>>>>>>>>>>
>>>>>>>>>> about.me/chrishantha
>>>>>>>>>> Contact: +IsuruPereraWSO2
>>>>>>>>>> <https://www.google.com/+IsuruPereraWSO2/about>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> *Anjana Fernando*
>>>>>>>>> Senior Technical Lead
>>>>>>>>> WSO2 Inc. | http://wso2.com
>>>>>>>>> lean . enterprise . middleware
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> *Madhawa Gunasekara*
>>>>>>>> Software Engineer
>>>>>>>> WSO2 Inc.; http://wso2.com
>>>>>>>> lean.enterprise.middleware
>>>>>>>>
>>>>>>>> mobile: +94 719411002 <+94+719411002>
>>>>>>>> blog: *http://madhawa-gunasekara.blogspot.com
>>>>>>>> <http://madhawa-gunasekara.blogspot.com>*
>>>>>>>> linkedin: *http://lk.linkedin.com/in/mgunasekara
>>>>>>>> <http://lk.linkedin.com/in/mgunasekara>*
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Isuru Perera
>>>>>>> Associate Technical Lead | WSO2, Inc. | http://wso2.com/
>>>>>>> Lean . Enterprise . Middleware
>>>>>>>
>>>>>>> about.me/chrishantha
>>>>>>> Contact: +IsuruPereraWSO2
>>>>>>> <https://www.google.com/+IsuruPereraWSO2/about>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> *Madhawa Gunasekara*
>>>>>> Software Engineer
>>>>>> WSO2 Inc.; http://wso2.com
>>>>>> lean.enterprise.middleware
>>>>>>
>>>>>> mobile: +94 719411002 <+94+719411002>
>>>>>> blog: *http://madhawa-gunasekara.blogspot.com
>>>>>> <http://madhawa-gunasekara.blogspot.com>*
>>>>>> linkedin: *http://lk.linkedin.com/in/mgunasekara
>>>>>> <http://lk.linkedin.com/in/mgunasekara>*
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Best Regards,
>>>>>
>>>>> Kalpa Welivitigoda
>>>>> Software Engineer, WSO2 Inc. http://wso2.com
>>>>> Email: [email protected]
>>>>> Mobile: +94776509215
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> *Madhawa Gunasekara*
>>>> Software Engineer
>>>> WSO2 Inc.; http://wso2.com
>>>> lean.enterprise.middleware
>>>>
>>>> mobile: +94 719411002 <+94+719411002>
>>>> blog: *http://madhawa-gunasekara.blogspot.com
>>>> <http://madhawa-gunasekara.blogspot.com>*
>>>> linkedin: *http://lk.linkedin.com/in/mgunasekara
>>>> <http://lk.linkedin.com/in/mgunasekara>*
>>>>
>>>
>>>
>>>
>>> --
>>> *Anjana Fernando*
>>> Senior Technical Lead
>>> WSO2 Inc. | http://wso2.com
>>> lean . enterprise . middleware
>>>
>>
>>
>>
>> --
>> Isuru Perera
>> Associate Technical Lead | WSO2, Inc. | http://wso2.com/
>> Lean . Enterprise . Middleware
>>
>> about.me/chrishantha
>> Contact: +IsuruPereraWSO2 <https://www.google.com/+IsuruPereraWSO2/about>
>>
>
>
>
> --
> Best Regards,
>
> Kalpa Welivitigoda
> Software Engineer, WSO2 Inc. http://wso2.com
> Email: [email protected]
> Mobile: +94776509215 <077%20650%209215>
>



-- 
Isuru Perera
Technical Lead | WSO2, Inc. | http://wso2.com/
Lean . Enterprise . Middleware

about.me/chrishantha
Contact: +IsuruPereraWSO2 <https://www.google.com/+IsuruPereraWSO2/about>
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to