C++ (Qt)#include <QtCore/QCoreApplication> #include <QtSql/QSqlDatabase>#include <QtSql/QSqlError>#include <QtSql/QSqlQuery> int main(int argc, char** argv){ QCoreApplication app(argc, argv); QSqlDatabase base = QSqlDatabase::addDatabase("QPSQL"); base.setHostName("localhost"); base.setUserName("postgres"); base.setPassword("postgres"); if (!base.open()) { qDebug(base.lastError().text().toLocal8Bit()); } QSqlQuery query; query.exec("CREATE DATABASE tmp_base"); qDebug(query.lastError().text().toLocal8Bit()); base.close(); return 0;}