<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Running a stored procedure with DB Connect app in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Running-a-stored-procedure-with-DB-Connect-app/m-p/103127#M183049</link>
    <description>&lt;P&gt;I'm trying to get Splunk to login to a MS SQL database and execute a stored procedure based upon data in the events.  This is currently running on a Windows 2008 server (but may be moving to Linux shortly).&lt;/P&gt;

&lt;P&gt;Based on what read here (&lt;A href="http://docs.splunk.com/Documentation/DBX/latest/DeployDBX/Setupadatabaselookuptable"&gt;http://docs.splunk.com/Documentation/DBX/latest/DeployDBX/Setupadatabaselookuptable&lt;/A&gt;), I should be able to specify the datatype for each field.  How do I determine if my JDBC driver supports parameter metadata?&lt;/P&gt;

&lt;P&gt;The definition for the lookup is:&lt;/P&gt;

&lt;P&gt;[Bit9_Local_Approval]&lt;BR /&gt;&lt;BR /&gt;
advanced = 1&lt;BR /&gt;&lt;BR /&gt;
database = Bit9Alpha&lt;BR /&gt;&lt;BR /&gt;
input_fields = host_id,hash,file_state,ret_val&lt;BR /&gt;&lt;BR /&gt;
query = DECLARE @ret INTEGER\&lt;BR /&gt;&lt;BR /&gt;
EXEC @ret = bit9_public.ChangeLocalFileState @computerId=$host_id:INTEGER$, @fileHash = $hash:NVARCHAR$, @fileState=$file_state:INTEGER$,\&lt;BR /&gt;&lt;BR /&gt;
SELECT ret_val = @ret&lt;/P&gt;

&lt;P&gt;I see the folloiwng error in the dbx.log:&lt;BR /&gt;&lt;BR /&gt;
2013-07-22 12:56:43.741 dbx7931:ERROR:BridgeSession - Exception occured while executing command:   java.lang.AbstractMethodError:   net.sourceforge.jtds.jdbc.JtdsPreparedStatement.setNString(ILjava/lang/String;)V&lt;BR /&gt;&lt;BR /&gt;
java.lang.AbstractMethodError:   net.sourceforge.jtds.jdbc.JtdsPreparedStatement.setNString(ILjava/lang/String;)V&lt;BR /&gt;&lt;BR /&gt;
    at com.splunk.util.Utils$SQL.applyArgumentAsSqlType(Utils.java:1305)&lt;BR /&gt;&lt;BR /&gt;
    at com.splunk.dbx.sql.util.NamedPreparedStatement.set(NamedPreparedStatement.java:108)&lt;BR /&gt;&lt;BR /&gt;
    at com.splunk.dbx.sql.util.NamedPreparedStatement.set(NamedPreparedStatement.java:118)&lt;BR /&gt;&lt;BR /&gt;
    at com.splunk.dbx.lookup.DatabaseLookupExecutor.performAdvancedLookup(DatabaseLookupExecutor.java:174)&lt;BR /&gt;&lt;BR /&gt;
    at com.splunk.dbx.lookup.DatabaseLookupExecutor.performLookup(DatabaseLookupExecutor.java:39)&lt;BR /&gt;&lt;BR /&gt;
    at com.splunk.runtime.SplunkLookup.invoke(SplunkLookup.java:26)&lt;BR /&gt;&lt;BR /&gt;
    at com.splunk.bridge.session.BridgeSession.call(BridgeSession.java:92)&lt;BR /&gt;&lt;BR /&gt;
    at com.splunk.bridge.session.BridgeSession.call(BridgeSession.java:30)  &lt;/P&gt;</description>
    <pubDate>Mon, 22 Jul 2013 20:05:09 GMT</pubDate>
    <dc:creator>responsys_cm</dc:creator>
    <dc:date>2013-07-22T20:05:09Z</dc:date>
    <item>
      <title>Running a stored procedure with DB Connect app</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Running-a-stored-procedure-with-DB-Connect-app/m-p/103127#M183049</link>
      <description>&lt;P&gt;I'm trying to get Splunk to login to a MS SQL database and execute a stored procedure based upon data in the events.  This is currently running on a Windows 2008 server (but may be moving to Linux shortly).&lt;/P&gt;

&lt;P&gt;Based on what read here (&lt;A href="http://docs.splunk.com/Documentation/DBX/latest/DeployDBX/Setupadatabaselookuptable"&gt;http://docs.splunk.com/Documentation/DBX/latest/DeployDBX/Setupadatabaselookuptable&lt;/A&gt;), I should be able to specify the datatype for each field.  How do I determine if my JDBC driver supports parameter metadata?&lt;/P&gt;

&lt;P&gt;The definition for the lookup is:&lt;/P&gt;

&lt;P&gt;[Bit9_Local_Approval]&lt;BR /&gt;&lt;BR /&gt;
advanced = 1&lt;BR /&gt;&lt;BR /&gt;
database = Bit9Alpha&lt;BR /&gt;&lt;BR /&gt;
input_fields = host_id,hash,file_state,ret_val&lt;BR /&gt;&lt;BR /&gt;
query = DECLARE @ret INTEGER\&lt;BR /&gt;&lt;BR /&gt;
EXEC @ret = bit9_public.ChangeLocalFileState @computerId=$host_id:INTEGER$, @fileHash = $hash:NVARCHAR$, @fileState=$file_state:INTEGER$,\&lt;BR /&gt;&lt;BR /&gt;
SELECT ret_val = @ret&lt;/P&gt;

&lt;P&gt;I see the folloiwng error in the dbx.log:&lt;BR /&gt;&lt;BR /&gt;
2013-07-22 12:56:43.741 dbx7931:ERROR:BridgeSession - Exception occured while executing command:   java.lang.AbstractMethodError:   net.sourceforge.jtds.jdbc.JtdsPreparedStatement.setNString(ILjava/lang/String;)V&lt;BR /&gt;&lt;BR /&gt;
java.lang.AbstractMethodError:   net.sourceforge.jtds.jdbc.JtdsPreparedStatement.setNString(ILjava/lang/String;)V&lt;BR /&gt;&lt;BR /&gt;
    at com.splunk.util.Utils$SQL.applyArgumentAsSqlType(Utils.java:1305)&lt;BR /&gt;&lt;BR /&gt;
    at com.splunk.dbx.sql.util.NamedPreparedStatement.set(NamedPreparedStatement.java:108)&lt;BR /&gt;&lt;BR /&gt;
    at com.splunk.dbx.sql.util.NamedPreparedStatement.set(NamedPreparedStatement.java:118)&lt;BR /&gt;&lt;BR /&gt;
    at com.splunk.dbx.lookup.DatabaseLookupExecutor.performAdvancedLookup(DatabaseLookupExecutor.java:174)&lt;BR /&gt;&lt;BR /&gt;
    at com.splunk.dbx.lookup.DatabaseLookupExecutor.performLookup(DatabaseLookupExecutor.java:39)&lt;BR /&gt;&lt;BR /&gt;
    at com.splunk.runtime.SplunkLookup.invoke(SplunkLookup.java:26)&lt;BR /&gt;&lt;BR /&gt;
    at com.splunk.bridge.session.BridgeSession.call(BridgeSession.java:92)&lt;BR /&gt;&lt;BR /&gt;
    at com.splunk.bridge.session.BridgeSession.call(BridgeSession.java:30)  &lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2013 20:05:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Running-a-stored-procedure-with-DB-Connect-app/m-p/103127#M183049</guid>
      <dc:creator>responsys_cm</dc:creator>
      <dc:date>2013-07-22T20:05:09Z</dc:date>
    </item>
    <item>
      <title>Re: Running a stored procedure with DB Connect app</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Running-a-stored-procedure-with-DB-Connect-app/m-p/103128#M183050</link>
      <description>&lt;P&gt;I tried the same lookup on a RHEL 6 box and got the same exception.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jul 2013 21:46:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Running-a-stored-procedure-with-DB-Connect-app/m-p/103128#M183050</guid>
      <dc:creator>responsys_cm</dc:creator>
      <dc:date>2013-07-22T21:46:59Z</dc:date>
    </item>
    <item>
      <title>Re: Running a stored procedure with DB Connect app</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Running-a-stored-procedure-with-DB-Connect-app/m-p/103129#M183051</link>
      <description>&lt;P&gt;The database connection was set to read-only.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jul 2013 01:01:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Running-a-stored-procedure-with-DB-Connect-app/m-p/103129#M183051</guid>
      <dc:creator>responsys_cm</dc:creator>
      <dc:date>2013-07-23T01:01:36Z</dc:date>
    </item>
    <item>
      <title>Re: Running a stored procedure with DB Connect app</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Running-a-stored-procedure-with-DB-Connect-app/m-p/103130#M183052</link>
      <description>&lt;P&gt;Looks like the JDBC driver doesn't support the NVARCHAR datatype for the prepared statement. You can try VARCHAR instead:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;...  @fileHash = $hash:VARCHAR$, ...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 21 Aug 2013 15:19:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Running-a-stored-procedure-with-DB-Connect-app/m-p/103130#M183052</guid>
      <dc:creator>ziegfried</dc:creator>
      <dc:date>2013-08-21T15:19:26Z</dc:date>
    </item>
  </channel>
</rss>

