All Apps and Add-ons

db connect 2.3 runtime error

kenkenou
Explorer

splunk enterprise free license:6.3.3
db connect:2.3
driver:mysql 5.1
DB:mysql

when i excuse dbxquery command or set db input, i got the error message below.

ERROR MESSAGE:
External search command 'dbxquery' returned error code 1. Script output = "RuntimeError: Failed to run query: "SELECT * FROM XXXX.XXXX", params: "None", caused by: TypeError('string indices must be integers',). "mm

| dbxquery query="SELECT%20*%20FROM%20%60XXXX%60.%60XXXX%60" connection="XXXX"

Please help!!!

1 Solution

kenkenou
Explorer

It has been solved.
After replace the "*" to the columns it works.
for example "selcect * from XXX.XXX" -> "select columnA, columnB from XXX.XXX"

but, why the * doesn't work...

View solution in original post

gyarici
Path Finder

I am not sure if it is buggy behavior or not, but it seems it could be come from db connect python script to determine indexes of the string in the db table.

Example:

>>>string = 'hi'
>>>print string[0]

Output is 'h' as a first string.

If you run the similar command , but string index is string instead of integer,

  >>>string = 'hi'
   >>>print string['hi']

Output is :
  File "<pyshell#12>", line 1, in <module>
    print string['hi']
TypeError: string indices must be integers, not str

You can have the same error, Therefore it is more likely incompatibility of the column types with db-connect.

As I mentioned it before, blob object is causing such kind of issue as well. Make sure that there is no blob object in your table. If you have, please take a look the link for it.
link text

0 Karma

kenkenou
Explorer

It has been solved.
After replace the "*" to the columns it works.
for example "selcect * from XXX.XXX" -> "select columnA, columnB from XXX.XXX"

but, why the * doesn't work...

hartfoml
Motivator

SOOOO why doesn't the "*" work?????

0 Karma

gyarici
Path Finder

It sometimes happens, if there is a binary content data in one of the columns are not supposed to read/browse from db .Thus most of the times, you should exclude such kind of columns in order to get proper output.

0 Karma

hartfoml
Motivator

Sounds logical but there is no binary data in my output only about 60 colunm's and 1200 rows of text readable data

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 ...