Skip to content
Snippets Groups Projects
Commit 8ce56341 authored by Ruud Overeem's avatar Ruud Overeem
Browse files

Bug 1143: hostname can now be specified during load of components.

Default hostname is still dop50.astron.nl.
parent df19dd48
No related branches found
No related tags found
No related merge requests found
......@@ -36,24 +36,36 @@ int main (int argc, char* argv[]) {
INIT_LOGGER ("logger.log_prop");
// check invocation syntax
if (argc != 3) {
cout << "Usage: load_all_comps databasename orderFile" << endl;
return (1);
}
string dbName, hostname, orderFile;
switch (argc) {
case 3:
dbName = argv[1];
hostname = "dop50.astron.nl";
orderFile = argv[2];
break;
case 4:
dbName = argv[1];
hostname = argv[2];
orderFile = argv[3];
break;
default:
cout << "Usage: load_all_comps databasename [hostname] orderFile" << endl;
cout << " hostname defaults to dop50.astron.nl" << endl;
return (1);
}
// check if file can be opened
ifstream inFile;
inFile.open(argv[2]);
inFile.open(orderFile.c_str());
if (!inFile) {
cout << "ERROR: can not open order-file: " << argv[2] << endl;
cout << "ERROR: can not open order-file: " << orderFile << endl;
return (1);
}
// Open the database connection
string dbName(argv[1]);
cout << "### Using database " << dbName << " ###" << endl;
OTDBconnection conn("paulus", "boskabouter", dbName);
cout << "### Using database " << dbName << " at " << hostname << " ###" << endl;
OTDBconnection conn("paulus", "boskabouter", dbName, hostname);
try {
if (!conn.connect()) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment