All Apps and Add-ons

splunk db connect: java.lang.StringIndexOutOfBoundsException: String index out of range

vijaynsheth
New Member

Splunk Enterprise: 7.2.5
Using Splunk DB Connect for Oracle and running into error when adding an Input and on "execute SQL"
message: java.lang.StringIndexOutOfBoundsException: String index out of range

Looked at various Answers but don't see any solution

0 Karma

markvanber
New Member

Since the string stores an array of characters, just like arrays the position of each character is represented by an index (starting from 0). If you try to access the character of a String at the index is either negative or greater than the size of the string, a StringIndexOutOfBoundsException is thrown. For some methods such as the java substring, charAt method, this exception also is thrown when the index is equal to the size of the string.

How to solve the StringIndexOutOfBoundsException

  • Check the length of the string before using substring()
  • Exception handling using try...catch.

 

0 Karma

Prewin27
New Member
0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...