|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectweka.core.converters.AbstractSaver
weka.core.converters.DatabaseSaver
public class DatabaseSaver
Writes to a database (tested with MySQL, InstantDB, HSQLDB).
Valid options are:-url <JDBC URL> The JDBC URL to connect to. (default: from DatabaseUtils.props file)
-user <name> The user to connect with to the database. (default: none)
-password <password> The password to connect with to the database. (default: none)
-T <table name> The name of the table. (default: the relation name)
-P
Add an ID column as primary key. The name is specified
in the DatabaseUtils file ('idColumn'). The DatabaseLoader
won't load this column.
-i <input file name> Input file in arff format that should be saved in database.
| Field Summary |
|---|
| Fields inherited from interface weka.core.converters.Saver |
|---|
BATCH, INCREMENTAL, NONE |
| Constructor Summary | |
|---|---|
DatabaseSaver()
Constructor. |
|
| Method Summary | |
|---|---|
String |
autoKeyGenerationTipText()
Returns the tip text for this property. |
void |
cancel()
Cancels the incremental saving process and tries to drop the table if the write mode is CANCEL. |
void |
connectToDatabase()
Opens a connection to the database. |
boolean |
getAutoKeyGeneration()
Gets whether or not a primary key will be generated automatically. |
Capabilities |
getCapabilities()
Returns the Capabilities of this saver. |
String[] |
getOptions()
Gets the setting. |
String |
getPassword()
Returns the database password. |
boolean |
getRelationForTableName()
Gets whether or not the relation name is used as name of the table. |
String |
getRevision()
Returns the revision string. |
String |
getTableName()
Gets the table's name. |
String |
getUrl()
Gets the database URL. |
String |
getUser()
Gets the database user. |
String |
globalInfo()
Returns a string describing this Saver. |
Enumeration |
listOptions()
Lists the available options. |
static void |
main(String[] options)
Main method. |
String |
passwordTipText()
Returns the tip text for this property. |
String |
relationForTableNameTipText()
Returns the tip text fo this property. |
void |
resetOptions()
Resets the Saver ready to save a new data set. |
void |
setAutoKeyGeneration(boolean flag)
En/Dis-ables the automatic generation of a primary key. |
void |
setDestination()
Sets the database url using the DatabaseUtils file. |
void |
setDestination(String url)
Sets the database url. |
void |
setDestination(String url,
String userName,
String password)
Sets the database url. |
void |
setOptions(String[] options)
Sets the options. |
void |
setPassword(String password)
Sets the database password. |
void |
setRelationForTableName(boolean flag)
En/Dis-ables that the relation name is used for the name of the table (default enabled). |
void |
setTableName(String tn)
Sets the table's name. |
void |
setUrl(String url)
Sets the database URL. |
void |
setUser(String user)
Sets the database user. |
String |
tableNameTipText()
Returns the tip text for this property. |
String |
urlTipText()
Returns the tip text for this property. |
String |
userTipText()
Returns the tip text for this property. |
void |
writeBatch()
Writes a Batch of instances. |
void |
writeIncremental(Instance inst)
Saves an instances incrementally. |
| Methods inherited from class weka.core.converters.AbstractSaver |
|---|
filePrefix, getFileExtension, getInstances, getWriteMode, resetStructure, retrieveDir, setDestination, setDestination, setDir, setDirAndPrefix, setFile, setFilePrefix, setInstances, setRetrieval, setStructure |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DatabaseSaver()
throws Exception
Exception - throws Exception if property file cannot be read| Method Detail |
|---|
public void resetOptions()
resetOptions in class AbstractSaverpublic void cancel()
cancel in class AbstractSaverpublic String globalInfo()
public void setTableName(String tn)
tn - the name of the tablepublic String getTableName()
public String tableNameTipText()
public void setAutoKeyGeneration(boolean flag)
flag - flag for automatic key-genererationpublic boolean getAutoKeyGeneration()
public String autoKeyGenerationTipText()
public void setRelationForTableName(boolean flag)
flag - if true the relation name is used as table namepublic boolean getRelationForTableName()
public String relationForTableNameTipText()
public void setUrl(String url)
setUrl in interface DatabaseConverterurl - the URLpublic String getUrl()
getUrl in interface DatabaseConverterpublic String urlTipText()
public void setUser(String user)
setUser in interface DatabaseConverteruser - the user namepublic String getUser()
getUser in interface DatabaseConverterpublic String userTipText()
public void setPassword(String password)
setPassword in interface DatabaseConverterpassword - the passwordpublic String getPassword()
public String passwordTipText()
public void setDestination(String url,
String userName,
String password)
url - the database urluserName - the user namepassword - the passwordpublic void setDestination(String url)
url - the database urlpublic void setDestination()
public Capabilities getCapabilities()
getCapabilities in interface CapabilitiesHandlergetCapabilities in class AbstractSaverCapabilitiespublic void connectToDatabase()
public void writeIncremental(Instance inst)
throws IOException
writeIncremental in interface SaverwriteIncremental in class AbstractSaverinst - the instance to save
IOException - throws IOEXception.
public void writeBatch()
throws IOException
writeBatch in interface SaverwriteBatch in class AbstractSaverIOException - throws IOExceptionpublic String[] getOptions()
getOptions in interface OptionHandlerpublic Enumeration listOptions()
listOptions in interface OptionHandler
public void setOptions(String[] options)
throws Exception
-url <JDBC URL> The JDBC URL to connect to. (default: from DatabaseUtils.props file)
-user <name> The user to connect with to the database. (default: none)
-password <password> The password to connect with to the database. (default: none)
-T <table name> The name of the table. (default: the relation name)
-P
Add an ID column as primary key. The name is specified
in the DatabaseUtils file ('idColumn'). The DatabaseLoader
won't load this column.
-i <input file name> Input file in arff format that should be saved in database.
setOptions in interface OptionHandleroptions - the options
Exception - if options cannot be setpublic String getRevision()
getRevision in interface RevisionHandlerpublic static void main(String[] options)
options - should contain the options of a Saver.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||