Getting Data In

JDBC Scripted input

macwin
Explorer

I am using this app for querying database (Sql server logs). I have completed all the steps in read.txt file provided in app directory but I get "Error: Could not find or load main class lib\sqljdbc.jar". Indexer is on Windows machine.

How can I solve this error?

Thanks.

0 Karma

Cuyose
Builder

I have SPLUNK_HOME set, however I am still getting this error

0 Karma

Jon_Webster
Splunk Employee
Splunk Employee

I did not duplicate this on Windows, but on OS X I received the linux comparable error. Setting the SPLUNK_HOME variable fixed this.

0 Karma

chetu
New Member

Error: Could not find or load main class com.splunk.jdbcscriptedinput.Main

i am having a similar issue

0 Karma

bmacias84
Champion

Ok, I dont see anything wrong with your stanza, but i think i know whats happening. To be sure you mind posting your bat script ommitting anything confidental. Here is my though in your bat file you need to fully quilify your paths for both java and your jar file or add ENV variables for each.

Example of a commandline jar I use.


d:/java/jdk1.6.0_31/bin/java.exe -jar d:/mycustomjars/cmdline-jmxclient-0.10.5.jar
#note: if there are any spaces in your paths single or double quote them.

0 Karma

macwin
Explorer

Should I share query.propertues and query.properties.mssql file contents?

Thanks.

0 Karma

bmacias84
Champion

I've installed JDK 7u9 with no problems on a win2k8 server with splunk 4.3.x. I am unable to replicate your issues. Not sure what the minimium JRE requirements are for this app. Also make sure you have correctly defined your query.properties and query.properties.mssql.

0 Karma

macwin
Explorer

The file says : Error: Could not find or load main class com.splunk.jdbcscriptedinput.Main
Thanks.

0 Karma

bmacias84
Champion

I'm reaching my limit of knowledge here but post your $SPLUNK_HOME/var/log/splunk/jdbcscriptedinput.yourqueryname.log

0 Karma

macwin
Explorer

No luck. If you need any other information, please let me know. I have done everything accoerding to your instructions.

java -cp "lib*" com.splunk.jdbcscriptedinput.Main %QUERY_NAME%\query.properties %QUERY_NAME%\query.pointer 2> %LOG_PATH%

Do I need to change %QUERY_NAME% information in this command.

Thanks.

0 Karma

bmacias84
Champion

Not this particular error, I work with Java/JVMs in a mixed environments. Its usually path or missing lib issue when working with CLI.

0 Karma

macwin
Explorer

Yeah.It changed. Now it is able to find the JAR ( I guess). Have you face this error before?

Thanks.

0 Karma

bmacias84
Champion

The error changed? If thats the case copy the splunkjdbcscriptedinput-0.3.jar and log4j-1.2.16.jar from $SPLUNK_HOME/etc/apps/splunkjdbcscriptedinput/bin/lib/ to your new location.

0 Karma

macwin
Explorer

Thanks. The error is "Could not find or load main class com.splunk.jdbcscriptedinput.Main"

0 Karma

bmacias84
Champion

Ok, Have you placed your libsqljdbc.jar in $SPLUNK_HOME/etc/apps/splunkjdbcscriptedinput/bin/lib/. All jar(s) for youjdbc driver have to be placed in that location or edit the script to reference you jar locations.

Line 14 of the bat file java -cp "lib\*" change lib to the location of your jdbc driver .jar location.

0 Karma

macwin
Explorer

Thanks for help. I am using the same bat file with as given by the app. Here are the contents.

@echo off
cd %~dp0
SET QUERY_NAME=%1

SET LOG_NAME=jdbcscriptedinput.%QUERY_NAME%.log
SET LOG_PATH="........\var\log\splunk\%LOG_NAME%"
del %LOG_PATH%.5
rename %LOG_PATH%.4 %LOG_NAME%.5
rename %LOG_PATH%.3 %LOG_NAME%.4
rename %LOG_PATH%.2 %LOG_NAME%.3
rename %LOG_PATH%.1 %LOG_NAME%.2
rename %LOG_PATH% %LOG_NAME%.1

java -cp "lib*" com.splunk.jdbcscriptedinput.Main %QUERY_NAME%\query.properties %QUERY_NAME%\query.pointer 2> %LOG_PATH%

Thanks.

0 Karma

macwin
Explorer

According to the app, I need to create one inputs.conf file. The stanza is :

[script://./bin/run.bat example]
interval = 60
sourcetype = example
source = jdbc

index = jdbc

Thanks.

0 Karma

bmacias84
Champion

Could you provide your stanza for your scripted input?

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...