/** * Makes a database query using the query set through the -Q option to convert * a table into a set of instances * * @return the instances contained in the result of the query * @throws Exception if an error occurs */ public Instances retrieveInstances() throws Exception { return retrieveInstances(m_Query); }
/** * Makes a database query using the query set through the -Q option to convert * a table into a set of instances * * @return the instances contained in the result of the query * @throws Exception if an error occurs */ public Instances retrieveInstances() throws Exception { return retrieveInstances(m_Query); }
/** * Queries a database to load results from the specified table name. The * database connection must have already made by m_InstanceQuery. * * @param tableName the name of the table containing results to retrieve. */ protected void setInstancesFromDatabaseTable(String tableName) { try { m_FromLab.setText("Reading from database, please wait..."); final Instances i = m_InstanceQuery.retrieveInstances("SELECT * FROM " + tableName); SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { setInstances(i); } }); m_InstanceQuery.disconnectFromDatabase(); } catch (Exception ex) { m_FromLab.setText(ex.getMessage()); } }
/** * Queries a database to load results from the specified table name. The * database connection must have already made by m_InstanceQuery. * * @param tableName the name of the table containing results to retrieve. */ protected void setInstancesFromDatabaseTable(String tableName) { try { m_FromLab.setText("Reading from database, please wait..."); final Instances i = m_InstanceQuery.retrieveInstances("SELECT * FROM " + tableName); SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { setInstances(i); } }); m_InstanceQuery.disconnectFromDatabase(); } catch (Exception ex) { m_FromLab.setText(ex.getMessage()); } }
@Override public void run() { try { m_Log.statusMessage("Reading from database..."); final Instances i = iq.retrieveInstances(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { setInstances(new Instances(i)); } }); iq.disconnectFromDatabase(); } catch (Exception ex) { m_Log.statusMessage("Problem executing DB query " + m_SQLQ); JOptionPane.showMessageDialog(PreprocessPanel.this, "Couldn't read from database:\n" + ex.getMessage(), "Load Instances", JOptionPane.ERROR_MESSAGE); } m_IOThread = null; } };
@Override public void run() { try { m_Log.statusMessage("Reading from database..."); final Instances i = iq.retrieveInstances(); SwingUtilities.invokeAndWait(new Runnable() { public void run() { setInstances(new Instances(i)); } }); iq.disconnectFromDatabase(); } catch (Exception ex) { m_Log.statusMessage("Problem executing DB query " + m_SQLQ); JOptionPane.showMessageDialog(PreprocessPanel.this, "Couldn't read from database:\n" + ex.getMessage(), "Load Instances", JOptionPane.ERROR_MESSAGE); } m_IOThread = null; } };
Instances result = retrieveInstances(this, rs); close(rs);
Instances result = retrieveInstances(this, rs); close(rs);
Instances aha = iq.retrieveInstances(); iq.disconnectFromDatabase();
Instances aha = iq.retrieveInstances(); iq.disconnectFromDatabase();
Instances data = null; try { DatabaseUtils utils = new DatabaseUtils(); InstanceQuery query = new InstanceQuery(); query.setUsername(username); query.setPassword(password); query.setQuery(pSql); data = query.retrieveInstances(); data.setRelationName(pInstanceRelationName); if (data.classIndex() == -1) { data.setClassIndex(data.numAttributes() - 1); } // this line will print out your header + data. // add your header information to your question. System.out.println(data) } catch (Exception e) { throw new RuntimeException(e); }
m_FromLab.setText("Getting experiment index"); Instances index = m_InstanceQuery.retrieveInstances("SELECT * FROM " + InstanceQuery.EXP_INDEX_TABLE); if (index.numInstances() == 0) {
m_FromLab.setText("Getting experiment index"); Instances index = m_InstanceQuery.retrieveInstances("SELECT * FROM " + InstanceQuery.EXP_INDEX_TABLE); if (index.numInstances() == 0) {
iq.setSparseData(m_CreateSparseData); result = iq.retrieveInstances();
iq.setSparseData(m_CreateSparseData); result = iq.retrieveInstances();