Data Source SQL Tool

The Data Source SQL Tool allows you to run SQL statements to query data in the datasource(s) (which are listed in the Data Sources Tool) to ensure that your query is correct and will return the correct results.

e.g. select * from <database.schema.tablename>

select * from gis.assetlife.asset

 

Using the Data Source SQL Tool for Debugging

This tool is useful if you're not getting the results you were expecting in a search, data grid, etc. Use it to run the SQL command that is being sent to Weave (and has been constructed from the content of your XML files) and then check the results of this query. 

To get the SQL that is being sent to Weave, open your Weave log file (e.g. C:\weave\logs\weave.log), search for "NativeSQL" in the file and copy the SQL command that follows this search term (remember to search from the bottom of the log file and search for the "previous" occurrence if you're looking for the last instance of the term "NativeSQL"). And enter the values for parameters if they do not appear in the log file. An example of this is shown below:

From weave.log file:

16:18:54,397 DEBUG [qtp228750133-114] com.cohga.server.search.database.internal.attribute.AttributeSearchProvider "NativeSQL: SELECT DISTINCT mann.zones.ogc_fid FROM mann.zones WHERE (mann.zones.zone_code = ?)"
16:18:54,402 DEBUG [qtp228750133-114] com.cohga.server.search.database.internal.attribute.BaseSearchProvider "Result=[263, 134, 119, 247, 112, 264, 282, 118]"

The same query applied in the Data Source SQL Tool: