Added database connection function to rain.c