Calling mysql_query() on another database, assumes WordPress using that database

Use a new instance of wpdb to connect and read from the other database:

$mydb = new wpdb('blah','blah','dkpldump','localhost');
$event_categories = $mydb->get_results("SELECT * FROM calendar_cats");
foreach( $event_categories as $event_category ){
    //create term!
    $term = wp_insert_term(
        $event_category->categoryId,
        'event_category',
        array(
            'slug' => $event_category->categoryName
        )
    );
}

tech