Connecting to a database from another application
Since you asked, the "correct" way would be to implement a simple web-service in Drupal in order to perform these tasks remotely from your application.  You could build a simple RESTful API to handle all your CRUD needs, for example.

The Services module is an excellent starting-point.

The reasoning for this is that you should really avoid modifying your Drupal database directly (unless you really know what youy are doing) and even if you must, connecting to it directly from another application is not only bad practice but a security risk too!

Please reconsider and use a webservice-approach, think of the kittens! :)