public class Hdb extends Object
Hdb hdb = new Hdb();
try {
hdb.connect();
String[] attList = hdb.getReader().getAttributeList();
ArrayList<HdbData> data = hdb.getReader().getData(attName[0],"09/07/2015 12:00:00","10/07/2015 12:00:00");
for(int i=0;i<data.size();i++)
System.out.println(" Rec #"+i+" :"+data.get(i));
} catch (HdbFailed e) {
System.out.println(e.getMessage());
}
Modifier and Type | Field and Description |
---|---|
static int |
HDB_CASSANDRA
Cassandra HDB++
|
static int |
HDB_MYSQL
MySQL HDB++
|
static int |
HDB_ORACLE
Oracle HDB
|
static SimpleDateFormat |
hdbDateFormat
Date format used in getDataFromDB calls
|
Constructor and Description |
---|
Hdb()
Constructs a Hdb Object
|
Modifier and Type | Method and Description |
---|---|
void |
connect()
Connect to HDB either using MySQL or Cassandra according to the following environment variables.
|
void |
connectCassandra()
Connects to a Cassandra HDB.
|
void |
connectCassandra(String[] contacts,
String db,
String user,
String passwd)
Connects to a Cassandra HDB.
|
void |
connectMySQL()
Connects to a MySQL HDB.
|
void |
connectMySQL(String host,
String db,
String user,
String passwd,
short port)
Connects to a MySQL HDB.
|
void |
connectOracle()
Connects to a Oracle HDB.
|
void |
disconnect()
Close connection to HDB
|
int |
getDBType()
Returns type of connection
|
String |
getDBTypeName()
Returns type of connection
|
HdbReader |
getReader()
Returns a handle to the HDB reader
|
static String |
getVersion() |
static void |
main(String[] args) |
static void |
test(Hdb hdb,
String start,
String stop,
String attName) |
public static final SimpleDateFormat hdbDateFormat
public static final int HDB_CASSANDRA
public static final int HDB_MYSQL
public static final int HDB_ORACLE
public HdbReader getReader()
public int getDBType()
public String getDBTypeName()
public void connectMySQL(String host, String db, String user, String passwd, short port) throws HdbFailed
host
- MySQL hostnamedb
- Database name (default is "hdb")user
- MySQL user namepasswd
- MySQL user passwordport
- MySQL databse port (pass 0 for default Mysql port)HdbFailed
- in case of failurepublic void connectCassandra(String[] contacts, String db, String user, String passwd) throws HdbFailed
contacts
- List of contact points (at least one of the hostname of the cassandra cluster)db
- Database name (default is "hdb")user
- Cassandra user namepasswd
- Cassandra user passwordHdbFailed
public void connectCassandra() throws HdbFailed
HdbFailed
public void connectOracle() throws HdbFailed
HdbFailed
public void connect() throws HdbFailed
HdbFailed
public void disconnect()
public static void test(Hdb hdb, String start, String stop, String attName) throws HdbFailed
HdbFailed
public static String getVersion()
public static void main(String[] args)
Copyright © 2017. All rights reserved.