Insert data via plugin

Is it possible to write a plugin where I can write data and store it some database? I need insert some values via plugin to modify some global variables.