|
|||||||||
| Home >> All >> org >> enableit >> [ db overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.enableit.db
Class DataLoader

java.lang.Objectorg.enableit.db.AbstractDBUtility
org.enableit.db.DataLoader
- public class DataLoader
- extends AbstractDBUtility
A class to read CSV files and load data into a database.
- Version:
- v1.3
| Field Summary | |
static java.lang.String |
about
CVS info about this class and its current version |
private java.util.ArrayList |
columns
The columns to load into. |
private static java.lang.String |
COMMA
|
private java.sql.Connection |
conn
|
private java.lang.String |
dataSourceName
The datasource name to use to get a database connection. |
private java.io.File |
file
The file to read. |
private static org.apache.log4j.Logger |
logger
The Log4J Logger doing the logging. |
private java.lang.String |
sql
The SQL to do load. |
private java.lang.String |
table
The Table to load into. |
| Fields inherited from class org.enableit.db.AbstractDBUtility |
driver, password, url, userid |
| Constructor Summary | |
DataLoader()
Default Constructor |
|
DataLoader(java.lang.String file)
Constructor setting mandatory properties. |
|
| Method Summary | |
void |
execute()
Do the load. |
static void |
main(java.lang.String[] args)
Used as a simple test of the class. |
private void |
process(java.lang.String line)
Processes a data line. |
private void |
processComment(java.lang.String line)
Processes a comment line, looking for meta data. |
void |
setColumnDatatypes(java.lang.String datatypes)
Set the datatypes of the columns to be inserted into. |
void |
setColumnNames(java.lang.String columns)
Set the names of columns to be inserted into. |
void |
setDataSourceName(java.lang.String dataSourceName)
Set the datasource name to get connections from. |
void |
setFile(java.io.File file)
Set the file to be loaded. |
void |
setFile(java.lang.String file)
Set the file to be loaded. |
private void |
setSqlStatement()
Prepares the SQL statement based on column names and datatypes. |
void |
setTable(java.lang.String table)
Set the file to be loaded. |
| Methods inherited from class org.enableit.db.AbstractDBUtility |
setConnectionProperties |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
logger
private static org.apache.log4j.Logger logger
- The Log4J
Loggerdoing the logging.
file
private java.io.File file
- The file to read.
table
private java.lang.String table
- The Table to load into.
sql
private java.lang.String sql
- The SQL to do load.
columns
private java.util.ArrayList columns
- The columns to load into.
dataSourceName
private java.lang.String dataSourceName
- The datasource name to use to get a database connection.
conn
private java.sql.Connection conn
COMMA
private static final java.lang.String COMMA
- See Also:
- Constant Field Values
about
public static final java.lang.String about
- CVS info about this class and its current version
- See Also:
- Constant Field Values
| Constructor Detail |
DataLoader
public DataLoader()
- Default Constructor
DataLoader
public DataLoader(java.lang.String file)
- Constructor setting mandatory properties.
| Method Detail |
setFile
public void setFile(java.io.File file)
- Set the file to be loaded.
setFile
public void setFile(java.lang.String file)
- Set the file to be loaded.
setTable
public void setTable(java.lang.String table)
- Set the file to be loaded.
This field is not mandatory if metadat is supplied at the top of the CSV file.
setColumnNames
public void setColumnNames(java.lang.String columns)
- Set the names of columns to be inserted into.
setColumnDatatypes
public void setColumnDatatypes(java.lang.String datatypes) throws DBException
- Set the datatypes of the columns to be inserted into.
setSqlStatement
private void setSqlStatement()
throws DBException
- Prepares the SQL statement based on column names and datatypes.
setDataSourceName
public void setDataSourceName(java.lang.String dataSourceName)
- Set the datasource name to get connections from.
execute
public void execute()
throws DBException
- Do the load.
processComment
private void processComment(java.lang.String line) throws DBException
- Processes a comment line, looking for meta data.
process
private void process(java.lang.String line)
- Processes a data line.
main
public static void main(java.lang.String[] args)
- Used as a simple test of the class.
|
|||||||||
| Home >> All >> org >> enableit >> [ db overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC