use of org.voltdb.client.ClientConfig in project voltdb by VoltDB.
the class TestCSVLoader method startDatabase.
@BeforeClass
public static void startDatabase() throws Exception {
prepare();
String pathToCatalog = Configuration.getPathToCatalogForTest("csv.jar");
String pathToDeployment = Configuration.getPathToCatalogForTest("csv.xml");
VoltProjectBuilder builder = new VoltProjectBuilder();
builder.addLiteralSchema("create table BLAH (" + "clm_integer integer not null, " + "clm_tinyint tinyint default 0, " + "clm_smallint smallint default 0, " + "clm_bigint bigint default 0, " + "clm_string varchar(20) default null, " + "clm_decimal decimal default null, " + "clm_float float default null, " + "clm_timestamp timestamp default null, " + "clm_point geography_point default null, " + "clm_geography geography default null, " + "PRIMARY KEY(clm_integer) " + ");");
builder.addPartitionInfo("BLAH", "clm_integer");
boolean success = builder.compile(pathToCatalog, 2, 1, 0);
assertTrue(success);
MiscUtils.copyFile(builder.getPathToDeployment(), pathToDeployment);
Configuration config = new Configuration();
config.m_pathToCatalog = pathToCatalog;
config.m_pathToDeployment = pathToDeployment;
localServer = new ServerThread(config);
client = null;
localServer.start();
localServer.waitForInitialization();
client = ClientFactory.createClient(new ClientConfig());
client.createConnection("localhost");
}
use of org.voltdb.client.ClientConfig in project voltdb by VoltDB.
the class VerifierUtils method dbconnect.
/**
* Connect to one or more VoltDB servers.
*
* @param servers A comma separated list of servers using the hostname:port
* syntax (where :port is optional). Assumes 21212 if not specified otherwise.
* @throws IOException
* @throws UnknownHostException
* @throws InterruptedException if anything bad happens with the threads.
*/
static Client dbconnect(String servers, int ratelimit) throws UnknownHostException, IOException {
//final Splitter COMMA_SPLITTER = Splitter.on(",").omitEmptyStrings().trimResults();
System.out.println("Connecting to VoltDB Interface...");
ClientConfig clientConfig = new ClientConfig();
clientConfig.setMaxTransactionsPerSecond(ratelimit);
clientConfig.setReconnectOnConnectionLoss(true);
Client client = ClientFactory.createClient(clientConfig);
for (String server : servers.split(",")) {
System.out.println("..." + server);
client.createConnection(server);
}
return client;
}
use of org.voltdb.client.ClientConfig in project voltdb by VoltDB.
the class VoltDBOsmSink method connect.
private void connect(String servers) throws InterruptedException, ClassNotFoundException, SQLException {
System.out.println("Connecting to VoltDB...");
ClientConfig clientConfig = new ClientConfig("", "", new VoltDBOsmSink.StatusListener());
clientConfig.setMaxTransactionsPerSecond(10000);
client = ClientFactory.createClient(clientConfig);
try {
// if we have more then one server, we would connect to each one
// individually inside a loop.
client.createConnection(servers);
} catch (UnknownHostException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
periodicStatsContext = client.createStatsContext();
fullStatsContext = client.createStatsContext();
}
Aggregations