Class JDBCOutputSynapse
- java.lang.Object
-
- org.joone.engine.Synapse
-
- org.joone.io.StreamOutputSynapse
-
- org.joone.io.JDBCOutputSynapse
-
- All Implemented Interfaces:
- java.io.Serializable, InputPatternListener, Learnable, LearnableSynapse, NeuralElement, OutputPatternListener, Inspectable, PlugInListener
public class JDBCOutputSynapse extends StreamOutputSynapse
The JDBCOutputSynapse provides support for data input to a database. To use this synapse the user should ensure a JDBC Type 4 Driver is in the class path. It is possible to use other JDBC driver types though you will have to refer to the vendors documentation, it may require extra software insallation and this may limit your distributtion to certain Operating Systems.
The properties required by this JDBCOutputSynapse Plugin are the following
Database Driver Name - e.g sun.jdbc.odbc.JdbcOdbcDriver
Database URL - e.g jdbc:mysql://localhost/MyDb?user=myuser&password=mypass
SQLAmendment - e.g "INSERT INTO MY_RESULT_TABLE (RESULT1,RESULT2) VALUES(JOONE[1],JOONE[2])" where JOONE[1] is the first value of the current output.
Note : The database URL uses specific protocol after the "jdbc:" section check with the jdbc driver vendor for specific info.
Some commonly used Driver protocols shown below ...
Driver {com.mysql.jdbc.Driver}
Protocol {jdbc:mysql://[hostname][,failoverhost...][:port]/[dbname][?param1=value1][¶m2=value2].....} MySQL Protool
Example {jdbc:mysql://localhost/test?user=blah&password=blah}
Web Site {http://www.mysql.com}
Driver {sun.jdbc.odbc.JdbcOdbcDriver}
Protocol { jdbc:odbc:
[; = ]* } ODBC Protocol Example {jdbc:odbc:mydb;UID=me;PWD=secret}
Web Site {http://www.java.sun.com}
Data Types
Any fields receiving a value should be able to contain a single double. The data type is not so important it can be text or a number field so long as can hold a double value.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description JDBCOutputSynapse()Constructor for the JDBCOutputSynapse objectJDBCOutputSynapse(java.lang.String newDrivername, java.lang.String newdbURL, java.lang.String newSQLAmendment, boolean buffered)Constructor for the JDBCInputSynapse object that allows all options.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description java.util.TreeSetcheck()Check that parameters are set correctly for the this JDBCInputSynapse object.java.lang.StringgetdbURL()Gets the name of the database Universal Resource Location (URL)java.lang.StringgetdriverName()Gets the name of the database jdbc driver used by this JDBC input syanpse.java.lang.StringgetSQLAmendment()Gets the SQL Query used to select data from the database.voidsetdbURL(java.lang.String newdbURL)Gets the name of the database Universal Resource Location (URL)voidsetdriverName(java.lang.String newDriverName)Sets the name of the database jdbc driver.voidsetSQLAmendment(java.lang.String newSQLAmendment)Sets the SQLAmendment attribute of the JDBCInputSynapse objectvoidwrite(Pattern pattern)Writes the pattern data to the database specified in the dbURL.-
Methods inherited from class org.joone.io.StreamOutputSynapse
addPlugIn, dataChanged, fwdPut, getPlugIn, getSeparator, isBuffered, removeAllPlugIns, revGet, setBuffered, setPlugIn, setSeparator
-
Methods inherited from class org.joone.engine.Synapse
addNoise, canCountSteps, fwdGet, getIgnoreBefore, getInputDimension, getLearner, getLearningRate, getMomentum, getMonitor, getName, getOutputDimension, getWeights, init, initLearner, InspectableTitle, Inspections, isEnabled, isInputFull, isLoopBack, isOutputFull, randomize, reset, revPut, setEnabled, setIgnoreBefore, setInputDimension, setInputFull, setLearningRate, setLoopBack, setMomentum, setMonitor, setName, setOutputDimension, setOutputFull, setWeights
-
-
-
-
Constructor Detail
-
JDBCOutputSynapse
public JDBCOutputSynapse()
Constructor for the JDBCOutputSynapse object
-
JDBCOutputSynapse
public JDBCOutputSynapse(java.lang.String newDrivername, java.lang.String newdbURL, java.lang.String newSQLAmendment, boolean buffered)Constructor for the JDBCInputSynapse object that allows all options. Allows the user to construct a JDBCInputSynapse in one call.
- Parameters:
newDrivername- The class name of the database driver to use.newdbURL- The Universal Resource Locator to enable connection to the database.newSQLAmendment- The database SQL amendment to apply to the database.buffered- Whether this synapse is buffered or not.
-
-
Method Detail
-
getdriverName
public java.lang.String getdriverName()
Gets the name of the database jdbc driver used by this JDBC input syanpse.- Returns:
- The JDBC Driver name
-
getdbURL
public java.lang.String getdbURL()
Gets the name of the database Universal Resource Location (URL)- Returns:
- The database URL used by this JDBC input syanpse.
-
getSQLAmendment
public java.lang.String getSQLAmendment()
Gets the SQL Query used to select data from the database.- Returns:
- The SQLAmendment used by this JDBC input syanpse.
-
setdriverName
public void setdriverName(java.lang.String newDriverName)
Sets the name of the database jdbc driver.- Parameters:
newDriverName- The JDBC Driver name
-
setdbURL
public void setdbURL(java.lang.String newdbURL)
Gets the name of the database Universal Resource Location (URL)- Parameters:
newdbURL- The database URL to use for selecting input. See the notes on this class for usage.
-
setSQLAmendment
public void setSQLAmendment(java.lang.String newSQLAmendment)
Sets the SQLAmendment attribute of the JDBCInputSynapse object- Parameters:
newSQLAmendment- The new database SQL Amendment.
-
check
public java.util.TreeSet check()
Check that parameters are set correctly for the this JDBCInputSynapse object.- Specified by:
checkin interfaceNeuralElement- Overrides:
checkin classStreamOutputSynapse- Returns:
- validation errors.
- See Also:
Synapse
-
write
public void write(Pattern pattern) throws JooneRuntimeException
Writes the pattern data to the database specified in the dbURL. The SQLAmendment proprty should contain an SQL amendment using JOONE[X] to obtain the Xth pattern value where X=1 is the first value. E.g. "INSERT INTO MY_RESULTS (RESULT1,RESULT2) VALUES('JOONE[1]','JOONE[2]')"- Specified by:
writein classStreamOutputSynapse- Parameters:
pattern- The values to write to the database.- Throws:
JooneRuntimeException
-
-
DataMelt 3.0 © DataMelt by jWork.ORG