If you don't want to use DB connect you will have to build your own scripted or modular input - essentially you would have to reimplement DB Connect.
You mean i need to write a script which queries the DB and saves the results into a text file which can be supplied to Splunk for indexing.
Before DB Connect existed, we wrote Java programs to read data from databases. Those programs are still used. The programs are launched by a shell script as a Splunk scripted input and anything the program writes to stdout is indexed by Splunk so there's no need for a text file. Of course, your program could be written in python or perl or anything you like.
Our Java programs seem to be able to handle more complex queries than DB Connect. The programs also transform some data before passing it to Splunk - something DB Connect cannot do.
Sorry, but I'm not allowed to share our code. It's pretty basic stuff, though, using standard Java SQL classes to send a query and retrieve the results.