当前位置: 首页>>代码示例>>Java>>正文


Java InstanceQuery.connectToDatabase方法代码示例

本文整理汇总了Java中weka.experiment.InstanceQuery.connectToDatabase方法的典型用法代码示例。如果您正苦于以下问题:Java InstanceQuery.connectToDatabase方法的具体用法?Java InstanceQuery.connectToDatabase怎么用?Java InstanceQuery.connectToDatabase使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在weka.experiment.InstanceQuery的用法示例。


在下文中一共展示了InstanceQuery.connectToDatabase方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setInstancesFromDBQ

import weka.experiment.InstanceQuery; //导入方法依赖的package包/类
/**
  * Loads instances from an SQL query the user provided with the
  * SqlViewerDialog, then loads the instances in a background process. This is
  * done in the IO thread, and an error message is popped up if the IO thread
  * is busy.
  * 
  * @param url		the database URL
  * @param user	the user to connect as
  * @param pw		the password of the user
  * @param query	the query for retrieving instances from
  * @param sparse	whether to create sparse or non-sparse instances
  */
 public void setInstancesFromDBQ(String url, String user, 
                                 String pw, String query,
                                 boolean sparse) {
   if (m_IOThread == null) {
     try {
InstanceQuery InstQ = new InstanceQuery();
       InstQ.setDatabaseURL(url);
       InstQ.setUsername(user);
       InstQ.setPassword(pw);
       InstQ.setQuery(query);
       InstQ.setSparseData(sparse);

       // we have to disconnect, otherwise we can't change the DB!
       if (InstQ.isConnected())
         InstQ.disconnectFromDatabase();

InstQ.connectToDatabase();      
try {
  addUndoPoint();
} catch (Exception ignored) {}
setInstancesFromDB(InstQ);
     } catch (Exception ex) {
JOptionPane.showMessageDialog(this,
			      "Problem connecting to database:\n"
			      + ex.getMessage(),
			      "Load Instances",
			      JOptionPane.ERROR_MESSAGE);
     }
     
   } else {
     JOptionPane.showMessageDialog(this,
			     "Can't load at this time,\n"
			    + "currently busy with other IO",
			    "Load Instances",
			    JOptionPane.WARNING_MESSAGE);
   }
 }
 
开发者ID:mydzigear,项目名称:repo.kmeanspp.silhouette_score,代码行数:50,代码来源:PreprocessPanel.java

示例2: setInstancesFromDBQ

import weka.experiment.InstanceQuery; //导入方法依赖的package包/类
/**
  * Loads instances from an SQL query the user provided with the
  * SqlViewerDialog, then loads the instances in a background process. This is
  * done in the IO thread, and an error message is popped up if the IO thread
  * is busy.
  * @param url           the database URL
  * @param user          the user to connect as
  * @param pw            the password of the user
  * @param query         the query for retrieving instances from
  */
 public void setInstancesFromDBQ(String url, String user, 
                                 String pw, String query) {
   if (m_IOThread == null) {
     try {
InstanceQuery InstQ = new InstanceQuery();
       InstQ.setDatabaseURL(url);
       InstQ.setUsername(user);
       InstQ.setPassword(pw);
       InstQ.setQuery(query);

       // we have to disconnect, otherwise we can't change the DB!
       if (InstQ.isConnected())
         InstQ.disconnectFromDatabase();

InstQ.connectToDatabase();      
try {
  addUndoPoint();
} catch (Exception ignored) {}
setInstancesFromDB(InstQ);
     } catch (Exception ex) {
JOptionPane.showMessageDialog(this,
		Messages.getInstance().getString("PreprocessPanel_SetInstancesFromDBQ_JOptionPaneShowMessageDialog_Text_First")
			      + ex.getMessage(),
			      Messages.getInstance().getString("PreprocessPanel_SetInstancesFromDBQ_JOptionPaneShowMessageDialog_Text_Second"),
			      JOptionPane.ERROR_MESSAGE);
     }
     
   } else {
     JOptionPane.showMessageDialog(this,
   		  Messages.getInstance().getString("PreprocessPanel_SetInstancesFromDBQ_JOptionPaneShowMessageDialog_Text_Third"),
			    Messages.getInstance().getString("PreprocessPanel_SetInstancesFromDBQ_JOptionPaneShowMessageDialog_Text_Fourth"),
			    JOptionPane.WARNING_MESSAGE);
   }
 }
 
开发者ID:williamClanton,项目名称:jbossBA,代码行数:45,代码来源:PreprocessPanel.java


注:本文中的weka.experiment.InstanceQuery.connectToDatabase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。