[Wsf-general] The configuration file for the database service

sumedha rubasinghe sumedha at wso2.com
Mon Feb 26 20:09:44 PST 2007


Hi Chamil,
1. Term 'protocol' seems to be bit confusing. How about something like 
'connection-url'?

2. Although you may not need following properties at this stage, I am 
sure you might need it down the line.

<!-- The minimum connections in a pool/sub-pool -->
<min-pool-size>5</min-pool-size>

<!-- The maximum connections in a pool/sub-pool -->
<max-pool-size>100</max-pool-size>

<!-- The time before an unused connection is destroyed -->
<idle-timeout-minutes>5</idle-timeout-minutes>


3. Since your going to support multiple databases, you might need to 
keep a parameter to load correct type-mappings.

<type-mapping>${VALUE}</type-mapping>, where VALUE can be any of 
mysql,Oracle,PostgreSQL 7.2,DB/2,etc.....


Based on above three points I would like to suggest the following for 
the connections section.

<connection>
<driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
<connection-url>jdbc:derby:../database/WSO2WSAS_DB</connection-url>
<user>wso2wsas</user>
<password>wso2wsas</password>

<min-pool-size>5</min-pool-size>
<max-pool-size>100</max-pool-size>
<idle-timeout-minutes>5</idle-timeout-minutes>

<type-mapping>Derby</type-mapping>
</connection>


/sumedha







Chamil Thanthrimudalige wrote:
> hi all,
>
> The configurations for the DBService will be in a file with the 
> extension "dbs". The configuration file so far looks like below.
>
> <data-service name="UserDataService" 
> targetNameSpace="http://www.wso2.org/types">
> <connection>
> <driver>org.apache.derby.jdbc.EmbeddedDriver</driver>
> <protocol>jdbc:derby:../database/WSO2WSAS_DB</protocol>
> <user>wso2wsas</user>
> <password>wso2wsas</password>
> </connection>
> <operation name="getUser">
> <input/>
> <output/>
> </operation>
> </data-service>
>
> Details on the connection section needs to be generalized. So I would 
> like get some input from a JDBC expert no how best we can capture the 
> details.
>
> The input element will take the form of a list of parameters and a 
> prepared sql statement. The question marks in the statement will be 
> replaced with the values of the parameters in order when being 
> executed. The parameter element will include the xpath expression to 
> get the parameter value from the input message.
> Eg:
> <input>
> <parameter>row/name</parameter>
> <parameter>row/age</parameter>
> <sqlStatement>select * from user where name=? or age = ?</sqlStatement>
> </input>
>
> In JDBC the following bit code will create and execute the prepared 
> statement.
>
> PreparedStatement updateSales = con.prepareStatement(
> "UPDATE COFFEES SET SALES = ? WHERE COF_NAME LIKE ? ");
> updateSales.setInt(1, 75);
> updateSales.setString(2, "Colombian");
> updateSales.executeUpdate():
>
>
> The output can be custom formated in two easy ways. The type attribute 
> will say which format is being used. "rename" means that it is a 
> simple column rename and "template" will indicate that an xml template 
> will be used.
>
> First way is by doing a simple rename of the columns. Here the rename 
> element will indicate the source column name by "from" attribute and 
> target from "to" attribute.
> Eg:
> <output wrap-rows="rowName">
> <rename xmlns:my="http://www.wso2.org/types" from="ISINDEX" 
> to="IndexedState"/>
> </output>
>
> Or else it can be formated using a xml template. Here the param 
> element will indicate the column of the dataset.
> Eg:
> <output type="template" wrap-rows="rowName">
> <name><param colName="name"/></name>
> <age><param colName="age"/></age>
> </optput>
>
> The wrap-rows attribute on the output element will give the repeating 
> container element for grouping the individual records. If it is not 
> given then it is assumed that only a single row will be returned, if 
> more than one result is returned then the system will throw an error.
>
> If the output element is not given the output data will be formated 
> using the default settings. Where no modifications of the column names 
> will be done and an element called row will be used to wrap the column 
> data. The values will be in an element with it's column name.
> Eg:
> <getUser>
> <row>
> <id>1</id>
> <name>x</name >
> <age>12</age>
> </row>
> </getUser >
>
> Comments about this approach and the format of the configuration file 
> are most welcome and greatly appreciated.
>
> Best Regards,
> Chamil Thanthrimudalige
>
>
>
>
>
> _______________________________________________
> Wsf-general mailing list
> Wsf-general at wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/wsf-general
>





More information about the Wsf-general mailing list