use DBI;
my $master_dsn = 'DBI:mysql:firstpost:172.29.40.16';
my $master_db_user = 'ir_fprw';
my $master_db_paswd = 'wPFXScND19';

my $master_dbh = DBI->connect ($master_dsn, $master_db_user, $master_db_paswd, {mysql_auto_reconnect => 1});

my $master_sth = $master_dbh->prepare ("select topic_name  as entityname from topics_master order by ent_date desc");

$master_sth->execute ();

open (MYFILE, ' > entities_firstpost.txt');
while (my ($entityname) = $master_sth->fetchrow_array ())
{

	print MYFILE $entityname . "\n";
            
}
	close (MYFILE);            


$master_sth->finish;
