Once connected to DB i want to fetch data with the help of a SQL statement and expoet that data in a Excel sheet and then i need to send an email to few ppl.
An alternative with no sw cost is JAVA JDBC tool xigole jisql.
Converting delimited text to proper CSV is a task for a serious tool, but if you have no ',' or '"' in your data, you can just change the delimiter to comma. Now you have a CSV file. You need an attaching batch email client like mutt to send the file as an attachment with your message to your distribution list. Sometimes you can use uuencode to pack the csv for you, or you can send it as a 8 bit binary, using sendmail and various tricks.
You could turn it into an HTML table and send an HTML email. Users can paste the html table into excel.