dboo::odb::constructor
odb(); 1)
odb( const std::string& host, int port, 2)
const database_name& databaseid,
const user_id& username,
const password& password);
odb() 1)
odb( host, port, databaseid 2)
username, password )
Initializes the odb object and possibly connects to a database.
- 1
Constructs the odb object.
- 2
Constructs the odb object and connects to the specified database.
Parameters
- host
host name for server
- port
port number
- databaseid
the database to connect to
- username
the user name to connect as
- password
the password for specified user
Exceptions
None
- exception_auth_fail
Authentication failed.
- exception_objectmodel_not_found
No database with given name exist.
Example
int main() {
dboo::odb db;
db.connect("localhost", 8823,
"my_database",
"usr132",
"password");
}
const dboo = require('dboo');
dboo.argv(process.argv);
const config = require('config');
dbConfig = config.get('dbConfig');
dboo.init();
const odb = new dboo.odb();
odb.connect(dbConfig.host, Number(dbConfig.port),
dbConfig.dbName, dbConfig.webUserName,
dbConfig.webUserPwd);
or…
int main() {
dboo::odb db("localhost", 8823,
"my_database",
"usr132",
"password");
}
const dboo = require('dboo');
dboo.argv(process.argv);
const config = require('config');
dbConfig = config.get('dbConfig');
dboo.init();
const odb = new dboo.odb(dbConfig.host, Number(dbConfig.port),
dbConfig.dbName, dbConfig.webUserName,
dbConfig.webUserPwd);