public class DataStoreConnection
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
db |
static java.lang.String |
host |
static int |
MYSQL |
static java.lang.String |
pass |
static java.lang.String |
user |
Constructor and Description |
---|
DataStoreConnection() |
DataStoreConnection(java.lang.String testHost,
java.lang.String testUser,
java.lang.String testPass,
java.lang.String testDb)
Tests the connection
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
byteArrayToHexString(byte[] b)
Function taken from http://www.rgagnon.com/javadetails/java-0400.html
|
void |
close()
Close the connection to the DataStore
|
static java.lang.String |
encrypt(java.lang.String aString)
Pattern taken from http://www.rgagnon.com/javadetails/java-0400.html
TODO: Properly cite usage!
Performs a SHA-1 encryption algorithm on a string
|
java.sql.Connection |
get()
Retrieves the connection
|
void |
MySQLConnection(java.lang.String host,
java.lang.String db,
java.lang.String user,
java.lang.String pass)
Creates the MYSQL Connection
|
java.sql.ResultSet |
query(java.lang.String query)
Queries the DataStore and retrieves the results
|
static java.lang.Object |
readBytes(byte[] byteObject)
Reads in the data from the DataStore
|
static byte[] |
writeBytes(java.lang.Object anObject)
Writes out the data from the DataStore
|
public static java.lang.String host
public static java.lang.String user
public static java.lang.String pass
public static java.lang.String db
public static final int MYSQL
public DataStoreConnection() throws DbConnectionException
DbConnectionException
public DataStoreConnection(java.lang.String testHost, java.lang.String testUser, java.lang.String testPass, java.lang.String testDb) throws DbConnectionException
testHost
- testUser
- testPass
- testDb
- DbConnectionException
public void MySQLConnection(java.lang.String host, java.lang.String db, java.lang.String user, java.lang.String pass) throws DbConnectionException
DbConnectionException
public java.sql.ResultSet query(java.lang.String query) throws java.sql.SQLException
java.sql.SQLException
public void close()
public java.sql.Connection get()
public static byte[] writeBytes(java.lang.Object anObject) throws java.io.IOException
anObject
- java.io.IOException
public static java.lang.Object readBytes(byte[] byteObject) throws java.io.IOException, java.lang.ClassNotFoundException
byteObject
- java.io.IOException
java.lang.ClassNotFoundException
public static java.lang.String encrypt(java.lang.String aString) throws java.security.NoSuchAlgorithmException
aString
- java.security.NoSuchAlgorithmException
public static java.lang.String byteArrayToHexString(byte[] b)
Consumes
- a byte array to a String