3

after installing wso2 ei, i download sql server jdbc driver and copy it in wso2home/lib, i want to create service via sql query so i define below data service :

<data name="BankDB" transports="http https local">
<config enableOData="false" id="sql">
  <property name="dataSourceClassName">com.microsoft.sqlserver.jdbc.SQLServerDriver</property>
  <property name="dataSourceProps">
     <property name="url">jdbc:sqlserver://x.x.x.x:1433/databaseName=ApiDB</property>
     <property name="username">username</property>
     <property name="password">password</property>
  </property>
</config>
<query id="MappedFaults" useConfig="sql">
  <sql>select BankCode from ApiDB.dbo.MappedFaults</sql>
  <result element="BankCode" rowName="">
     <element column="BankCode" name="BankCode" namespace="BankCode" xsdType="string"/>
  </result>
</query>
<operation name="select">
  <call-query href="MappedFaults"/>
</operation>
</data>

but i get this error :

DS Fault Message: Error creating JDBC Pool SQL Config: Error in creating external data source: Setter method for property 'password' cannot be found DS Code: UNKNOWN_ERROR Source Data Service:- Name: BankDB Location: \BankDB.dbs Description: N/A Default Namespace: http://ws.wso2.org/dataservice Nested Exception:- org.wso2.carbon.ndatasource.common.DataSourceException: Error in creating external data source: Setter method for property 'password' cannot be found at org.wso2.carbon.dataservices.core.JDBCPoolSQLConfig.getDataSource(JDBCPoolSQLConfig.java:66) at
Community
  • 1
  • 1
behzad
  • 194
  • 6
  • 21
  • I don't know exactly what is wrong here but looking at comparable configurations I think the username and password are not part of 'dataSourceProps'. I would suggest though to create a datasource manually and just reference it like so: ApiDB_datasource – Jan Sep 05 '17 at 12:05
  • i change config section to com.microsoft.sqlserver.jdbc.SQLServerDriver jdbc:sqlserver://x.x.x.x:1433;databaseName=ApiDB username password and now get this error : DS Fault Message: DataSource is of unknown class:class com.microsoft.sqlserver.jdbc.SQLServerDriver DS Code: CONNECTION_UNAVAILABLE_ERROR Source Data Service:- Name: APIDB – behzad Sep 05 '17 at 17:42
  • i added sqljdbc.jar in wso2home/bin and run project but get above error – behzad Sep 06 '17 at 07:26
  • in wso2 dataservice it is ok when i copy jar files in wso2dsshome/repository/compounents/lib and it is ok but in wso2eihome we haven't this root – behzad Sep 06 '17 at 08:27
  • 1
    I think you can copy the jar into /lib – Vivekananthan Sivanayagam Sep 07 '17 at 01:13
  • 1
    Ah, but why not first create a datasource as shown here: https://docs.wso2.com/display/EI611/Datasource+Configuration+Parameters and then use this in your service? This allows for easier configuration and also a 'test' button that tests basic connectivity. – Jan Sep 08 '17 at 08:29

0 Answers0