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


Java Database.create方法代码示例

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


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

示例1: OpenFile

import com.healthmarketscience.jackcess.Database; //导入方法依赖的package包/类
private boolean OpenFile() throws Exception
{
	data.oneFileOpened=true;
       String realFilename = environmentSubstitute(meta.getFilename());
       if(log.isBasic())
       	logBasic(Messages.getString("AccessOutput.log.WritingToFile", realFilename));
       FileObject fileObject = KettleVFS.getFileObject(realFilename);
       File file = new File(KettleVFS.getFilename(fileObject));
       
       // First open or create the access file
       if (!file.exists())
       {
           if (meta.isFileCreated())
           {
               data.db = Database.create(file);
           }
           else
           {
               logError(Messages.getString("AccessOutput.InitError.FileDoesNotExist", realFilename));
               return false;
           }
       }
       else
       {
           data.db = Database.open(file);
       }
       
       // Add the filename to the result object...
       //
       if(meta.isAddToResultFiles())
       {
		ResultFile resultFile = new ResultFile(ResultFile.FILE_TYPE_GENERAL, fileObject, getTransMeta().getName(), toString());
		resultFile.setComment("This file was created with an access output step");
		addResultFile(resultFile);
       }
       
       return true;
}
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:39,代码来源:AccessOutput.java

示例2: OpenFile

import com.healthmarketscience.jackcess.Database; //导入方法依赖的package包/类
private boolean OpenFile() throws Exception
{
	data.oneFileOpened=true;
       String realFilename = environmentSubstitute(meta.getFilename());
       if(log.isBasic())
       	logBasic(BaseMessages.getString(PKG, "AccessOutput.log.WritingToFile", realFilename));
       FileObject fileObject = KettleVFS.getFileObject(realFilename, getTransMeta());
       File file = FileUtils.toFile(fileObject.getURL());
       
       // First open or create the access file
       if (!file.exists())
       {
           if (meta.isFileCreated())
           {
               data.db = Database.create(file);
           }
           else
           {
               logError(BaseMessages.getString(PKG, "AccessOutput.InitError.FileDoesNotExist", realFilename));
               return false;
           }
       }
       else
       {
           data.db = Database.open(file);
       }
       
       // Add the filename to the result object...
       //
       if(meta.isAddToResultFiles())
       {
		ResultFile resultFile = new ResultFile(ResultFile.FILE_TYPE_GENERAL, fileObject, getTransMeta().getName(), toString());
		resultFile.setComment("This file was created with an access output step");
		addResultFile(resultFile);
       }
       
       return true;
}
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:39,代码来源:AccessOutput.java

示例3: importFile

import com.healthmarketscience.jackcess.Database; //导入方法依赖的package包/类
private boolean importFile(String sourceFilename, String delimiter,String targetFilename,
  		String tablename,LogWriter log,Result result,Job parentJob)
  {
  	boolean retval=false;
  	
try{
	
   	incrFilesToProcess();
   	
	File sourceDataFile = new File(sourceFilename);
	File targetDbFile = new File(targetFilename);
	
	// create database if needed
	if(!targetDbFile.exists()) 
	{
		Database.create(targetDbFile);
		log.logBasic(toString(),Messages.getString("JobEntryMSAccessBulkLoad.Log.DbCreated",targetFilename));
	}else
	{
		// Database exists
		Database db=Database.open(targetDbFile);
		log.logBasic(toString(),Messages.getString("JobEntryMSAccessBulkLoad.Log.DbOpened",targetFilename));
		// Let's check table
		if(db.getTable(tablename)!=null)
		{
			log.logBasic(toString(), Messages.getString("JobEntryMSAccessBulkLoad.Log.TableExists",tablename));
		}
		
		// close database
		if(db!=null) db.close();
		log.logBasic(toString(),Messages.getString("JobEntryMSAccessBulkLoad.Log.DbCosed",targetFilename));
	}
	// load data from file
	Database.open(targetDbFile).importFile(tablename, sourceDataFile, delimiter);
	
	log.logBasic(toString(), Messages.getString("JobEntryMSAccessBulkLoad.Log.FileImported",sourceFilename,	tablename,targetFilename));
	
	// add filename to result filename
	if(add_result_filenames)
		addFileToResultFilenames(sourceFilename,log,result,parentJob);

	
	retval=true;
}
catch ( Exception e )
{
	log.logError(toString(), Messages.getString("JobEntryMSAccessBulkLoad.Error.LoadingDataToFile",
			sourceFilename,targetFilename,e.getMessage()));
	
}	
if(retval)
	incrSuccess();
else
	incrErrors();
  	return retval;
  }
 
开发者ID:icholy,项目名称:geokettle-2.0,代码行数:57,代码来源:JobEntryMSAccessBulkLoad.java

示例4: importFile

import com.healthmarketscience.jackcess.Database; //导入方法依赖的package包/类
private boolean importFile(String sourceFilename, String delimiter,String targetFilename,
  		String tablename, Result result,Job parentJob)
  {
  	boolean retval=false;
  	
try{
	
   	incrFilesToProcess();
   	
	File sourceDataFile = new File(sourceFilename);
	File targetDbFile = new File(targetFilename);
	
	// create database if needed
	if(!targetDbFile.exists()) 
	{
		Database.create(targetDbFile);
		logBasic(BaseMessages.getString(PKG, "JobEntryMSAccessBulkLoad.Log.DbCreated",targetFilename));
	}else
	{
		// Database exists
		Database db=Database.open(targetDbFile);
		logBasic(BaseMessages.getString(PKG, "JobEntryMSAccessBulkLoad.Log.DbOpened",targetFilename));
		// Let's check table
		if(db.getTable(tablename)!=null)
		{
			logBasic(BaseMessages.getString(PKG, "JobEntryMSAccessBulkLoad.Log.TableExists",tablename));
		}
		
		// close database
		if(db!=null) db.close();
		logBasic(BaseMessages.getString(PKG, "JobEntryMSAccessBulkLoad.Log.DbCosed",targetFilename));
	}
	// load data from file
	Database.open(targetDbFile).importFile(tablename, sourceDataFile, delimiter);
	
	logBasic(BaseMessages.getString(PKG, "JobEntryMSAccessBulkLoad.Log.FileImported",sourceFilename,	tablename,targetFilename));
	
	// add filename to result filename
	if(add_result_filenames)
		addFileToResultFilenames(sourceFilename, result, parentJob);

	
	retval=true;
}
catch ( Exception e )
{
	logError(BaseMessages.getString(PKG, "JobEntryMSAccessBulkLoad.Error.LoadingDataToFile",
			sourceFilename,targetFilename,e.getMessage()));
	
}	
if(retval)
	incrSuccess();
else
	incrErrors();
  	return retval;
  }
 
开发者ID:yintaoxue,项目名称:read-open-source-code,代码行数:57,代码来源:JobEntryMSAccessBulkLoad.java

示例5: createDatabase

import com.healthmarketscience.jackcess.Database; //导入方法依赖的package包/类
void createDatabase( File databaseFile ) throws IOException {
  db = Database.create( databaseFile );
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:4,代码来源:AccessOutputData.java

示例6: importFile

import com.healthmarketscience.jackcess.Database; //导入方法依赖的package包/类
private boolean importFile( String sourceFilename, String delimiter, String targetFilename, String tablename,
  Result result, Job parentJob ) {
  boolean retval = false;

  try {

    incrFilesToProcess();

    File sourceDataFile = new File( sourceFilename );
    File targetDbFile = new File( targetFilename );

    // create database if needed
    if ( !targetDbFile.exists() ) {
      Database.create( targetDbFile );
      logBasic( BaseMessages.getString( PKG, "JobEntryMSAccessBulkLoad.Log.DbCreated", targetFilename ) );
    } else {
      // Database exists
      Database db = Database.open( targetDbFile );
      logBasic( BaseMessages.getString( PKG, "JobEntryMSAccessBulkLoad.Log.DbOpened", targetFilename ) );
      // Let's check table
      if ( db.getTable( tablename ) != null ) {
        logBasic( BaseMessages.getString( PKG, "JobEntryMSAccessBulkLoad.Log.TableExists", tablename ) );
      }

      // close database
      if ( db != null ) {
        db.close();
      }
      logBasic( BaseMessages.getString( PKG, "JobEntryMSAccessBulkLoad.Log.DbCosed", targetFilename ) );
    }
    // load data from file
    Database.open( targetDbFile ).importFile( tablename, sourceDataFile, delimiter );

    logBasic( BaseMessages.getString(
      PKG, "JobEntryMSAccessBulkLoad.Log.FileImported", sourceFilename, tablename, targetFilename ) );

    // add filename to result filename
    if ( add_result_filenames ) {
      addFileToResultFilenames( sourceFilename, result, parentJob );
    }

    retval = true;
  } catch ( Exception e ) {
    logError( BaseMessages.getString(
      PKG, "JobEntryMSAccessBulkLoad.Error.LoadingDataToFile", sourceFilename, targetFilename, e.getMessage() ) );

  }
  if ( retval ) {
    incrSuccess();
  } else {
    incrErrors();
  }
  return retval;
}
 
开发者ID:pentaho,项目名称:pentaho-kettle,代码行数:55,代码来源:JobEntryMSAccessBulkLoad.java


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