1

以下是 i2b2 数据库设置教程中的命令,用于创建一堆表并为特定数据库加载数据。我之前只在 SQL Server Management Studio (SSMS) 中手动(在新的查询窗口中)运行 *.sql 命令。这是必须从 Java 运行的东西,还是我可以直接从某个命令提示符处执行此操作?如果是这样,你能帮我完成必要的步骤吗?(即:我是否需要引用第 3 方程序集,我猜我需要配置我的数据库连接字符串等。)

ant –f data_build.xml create_workdata_tables_release_1-6

ant –f data_build.xml db_workdata_load_data

将鼠标悬停在“ant”(StackOverflow 标签)上之后,它似乎是一些 Java 工具。

“Apache Ant(以前称为 Jakarta Ant)是用于 Java 项目的声明式、基于 XML 的构建工具。它提供了一组丰富的标准任务来执行最常见的构建操作,例如使用 javac 编译、构建档案和运行测试。Ant 的功能可以通过自定义任务和宏进行扩展。”

我尝试在 Windows 的命令提示符下运行它,但出现错误。

C:\Source\i2b2\i2b2createdb-1602\edu.harvard.i2b2.data\Release_1-6\NewInstall\Metadata>ant -f data_build.xml create_crcdata_tables_release_1-6
'ant' is not recognized as an internal or external command,
operable program or batch file.

我看到了 XML 文件中列出的实际 *.sql 文件,我猜它们是以特定方式排序的,以便关联的(包含主键)首先将数据加载到它们中,然后桥/父/所有者/base 表(包含外键)最后运行,因为它们依赖于关联的表。如果一切都失败了,我可能可以按照列出的顺序直接从 SSMS 运行这些命令,但我很想试试这个“ant”命令。

设置说明:

http://www.i2b2.org

下载“i2b2createdb-1602.zip”并解压。

下载“i2b2core-doc-1602.zip”并解压(使用这些 PDF 文档获取安装说明)

======================================

看来我必须定义 XML 文件中定义的变量。

<?xml version="1.0" encoding="UTF-8"?>
<!--
$Id: data_build.xml,v 1.5 2010/06/04 15:33:06 lcp5 Exp $
-->
<project name="Ontology/Metadata data" basedir=".">

    <property environment="env" />

    <property file="./db.properties" />

    <!-- =================================================================== -->
    <!--                                INIT                                 -->
    <!-- =================================================================== -->
    <target name="init"  description="Prepare for build">
        <path id="classpath">
            <pathelement location="../ojdbc14.jar" />
            <pathelement location="../sqljdbc.jar"/>
        </path>
    </target>



    <!-- =================================================================== -->
    <!--            DATABASE SETUP TARGETS                                   -->
    <!-- =================================================================== -->
    <target name="db_create_user" depends="init">
        <sql driver="${db.driver}" url="${db.url}" userid="${db.username}" password="${db.password}" classpathref="classpath" onerror="continue" print="true">
                    CREATE USER  i2b2metadata IDENTIFIED BY   i2b2metadata;
                </sql>
    </target>

    <target name="create_metadata_tables_release_1-6" depends="init">
        <sql driver="${db.driver}" url="${db.url}" userid="${db.username}" password="${db.password}" classpathref="classpath" onerror="continue" print="true">
            <transaction src="./scripts/create_${db.type}_i2b2metadata_tables.sql" />
        </sql>
    </target>

    <target name="db_metadata_load_data" depends="init">
        <echo message="Loading metadata -- may take a while; over 10 min" />
        <sql driver="${db.driver}" url="${db.url}" userid="${db.username}" password="${db.password}" classpathref="classpath" onerror="continue" print="true">
            <transaction src="./${db.project}/scripts/schemes_insert_data.sql" />
            <transaction src="./${db.project}/scripts/table_access_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/birn_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/custom_meta_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/i2b2_metadata_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/i2b2_metadata_demographics_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/i2b2_metadata_diagnoses_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/i2b2_metadata_expressions_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/i2b2_metadata_labtests_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/i2b2_metadata_medications_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/i2b2_metadata_modifiers_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/i2b2_metadata_procedures_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/i2b2_metadata_providers_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/i2b2_metadata_reports_insert_data.sql" />
            <transaction src="./${db.project}/scripts/${db.type}/i2b2_metadata_visitDetails_insert_data.sql" />
        </sql>
    </target>

</project>

======================================

2012 年 5 月 6 日上午 6:52 更新:

SQL Server Management Studio 设置:

  • SQL Server Management Studio > 创建名为“i2b2_demo”的新数据库

安装 Oracle JDK:

安装 Apache Ant:

  • 在http://ant.apache.org/下载二进制文件
  • 导航到此路径以获取安装说明:手册 > 安装 Apache Ant > 获取 Ant > ..follow instructions
  • 将提取的文件夹(包含 bin 文件夹)移动到C:\source_code\apache-ant-1.8.3\%ANT_HOME% 环境变量中使用的目录或目录中

Java 和 Ant 的 Windows 7 环境变量设置:

Windows 7 > 控制面板 > 系统 > 单击“环境变量”按钮 >

(不要忘记尾随的“\”) *[ MacGyver 5/6/2012 @2:45pm - 忽略这个...删除尾随的“\”字符...请参阅我在问题下方的评论]

在“系统变量”部分下,单击“添加”> 变量名称:JAVA_HOME 变量值:C:\Program Files\Java\jdk1.7.0_02\

在“系统变量”部分下,单击“添加”> 变量名称:ANT_HOME 变量值:C:\source_code\apache-ant-1.8.3\

在“系统变量”部分下,单击“路径”环境变量,单击“编辑”> 变量名称:Path 变量值:{value before editing};%JAVA_HOME%\bin;%ANT_HOME%\bin;

  • 重新启动命令提示符(以管理员身份运行)

  • C:\source_code\i2b2\i2b2createdb-1602\edu.harvard.i2b2.data\Release_1-6\NewInstall\{folder}\db.properties用适当的值替换每个文件。代替 ”?” 具有正确的值。

“db.properties”文件:

db.type=sqlserver
db.username=?
db.password=?
db.server=LAPTOP-INSPIRON\SQLEXPRESS
db.driver=com.microsoft.sqlserver.jdbc.SQLServerDriver
db.url=jdbc:sqlserver:LAPTOP-INSPIRON\SQLEXPRESS;databasename=i2b2_demo
db.project=demo

收到此错误:

C:\source_code\i2b2\i2b2createdb-1602\edu.harvard.i2b2.data\Release_1-6\NewInsta
ll\Crcdata>ant -f data_build.xml upgrade_metadata_tables_release_1-6
Buildfile: build.xml does not exist!
Build failed

======================================

更新于 2012 年 5 月 6 日 @ 上午 7:33 ... 发现此页面出现错误 ...

安装蚂蚁:

要么点击这个:http ://ant.apache.org/manual/index.html

或者...

导航到http://ant.apache.org/ > 手册 > 安装 Apache Ant > 安装 Ant >

C:\source_code\apache-ant-1.8.3>ant -version
Apache Ant(TM) version 1.8.3 compiled on February 26 2012

C:\source_code\apache-ant-1.8.3>ant -f fetch.xml
Buildfile: C:\source_code\apache-ant-1.8.3\fetch.xml

pick-dest:

BUILD FAILED
C:\source_code\apache-ant-1.8.3\fetch.xml:70: ERROR
Set -Ddest=LOCATION on the command line
  -Ddest=user     user lib dir  C:\Users\Keith/.ant/lib
  -Ddest=system   ant lib dir   C:\source_code\apache-ant-1.8.3/lib
  -Ddest=optional optional dir  ${basedir}/lib/optional  (for Ant developers)

Total time: 0 seconds

C:\source_code\apache-ant-1.8.3>build install
'build' is not recognized as an internal or external command,
operable program or batch file.

......然后注意到我错过了命令上的参数..它仍然失败了!

C:\source_code\apache-ant-1.8.3>ant -f fetch.xml -Ddest=system
Buildfile: C:\source_code\apache-ant-1.8.3\fetch.xml

pick-dest:
     [echo] Downloading to C:\source_code\apache-ant-1.8.3\lib

probe-m2:

download-m2:
     [echo] Downloading to C:\source_code\apache-ant-1.8.3\lib
      [get] Getting: http://repo1.maven.org/maven2/org/apache/maven/maven-artifa
ct-ant/2.0.4/maven-artifact-ant-2.0.4-dep.jar
      [get] To: C:\source_code\apache-ant-1.8.3\lib\maven-artifact-ant-2.0.4-dep
.jar
      [get] ...................................

dont-validate-m2-checksum:

validate-m2-checksum:

checksum-mismatch:

checksum-match:

get-m2:

macros:

init:

logging:
[artifact:dependencies] Downloading: log4j/log4j/1.2.14/log4j-1.2.14.pom
[artifact:dependencies] Transferring 2K
[artifact:dependencies] Downloading: log4j/log4j/1.2.14/log4j-1.2.14.jar
[artifact:dependencies] Transferring 358K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib
[artifact:dependencies] Downloading: commons-logging/commons-logging-api/1.1/com
mons-logging-api-1.1.pom
[artifact:dependencies] Transferring 5K
[artifact:dependencies] Downloading: commons-logging/commons-logging-api/1.1/com
mons-logging-api-1.1.jar
[artifact:dependencies] Transferring 43K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib

junit:
[artifact:dependencies] Downloading: junit/junit/4.8.1/junit-4.8.1.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: junit/junit/4.8.1/junit-4.8.1.jar
[artifact:dependencies] Transferring 231K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib

xml:
[artifact:dependencies] Downloading: xalan/xalan/2.7.1/xalan-2.7.1.pom
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: org/apache/apache/4/apache-4.pom
[artifact:dependencies] Transferring 4K
[artifact:dependencies] Downloading: xalan/serializer/2.7.1/serializer-2.7.1.pom

[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.po
m
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: org/apache/apache/3/apache-3.pom
[artifact:dependencies] Transferring 3K
[artifact:dependencies] Downloading: xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.ja
r
[artifact:dependencies] Transferring 189K
[artifact:dependencies] Downloading: xalan/serializer/2.7.1/serializer-2.7.1.jar

[artifact:dependencies] Transferring 271K
[artifact:dependencies] Downloading: xalan/xalan/2.7.1/xalan-2.7.1.jar
[artifact:dependencies] Transferring 3101K
     [copy] Copying 3 files to C:\source_code\apache-ant-1.8.3\lib
[artifact:dependencies] Downloading: xml-resolver/xml-resolver/1.2/xml-resolver-
1.2.pom
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: xml-resolver/xml-resolver/1.2/xml-resolver-
1.2.jar
[artifact:dependencies] Transferring 82K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib

networking:
[artifact:dependencies] Downloading: commons-net/commons-net/1.4.1/commons-net-1
.4.1.pom
[artifact:dependencies] Transferring 4K
[artifact:dependencies] Downloading: oro/oro/2.0.8/oro-2.0.8.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: oro/oro/2.0.8/oro-2.0.8.jar
[artifact:dependencies] Transferring 63K
[artifact:dependencies] Downloading: commons-net/commons-net/1.4.1/commons-net-1
.4.1.jar
[artifact:dependencies] Transferring 176K
     [copy] Copying 2 files to C:\source_code\apache-ant-1.8.3\lib
[artifact:dependencies] Downloading: com/jcraft/jsch/0.1.42/jsch-0.1.42.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: com/jcraft/jsch/0.1.42/jsch-0.1.42.jar
[artifact:dependencies] Transferring 181K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib

regexp:
[artifact:dependencies] Downloading: regexp/regexp/1.3/regexp-1.3.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: regexp/regexp/1.3/regexp-1.3.jar
[artifact:dependencies] Transferring 24K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib

antlr:
[artifact:dependencies] Downloading: antlr/antlr/2.7.7/antlr-2.7.7.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: antlr/antlr/2.7.7/antlr-2.7.7.jar
[artifact:dependencies] Transferring 434K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib

bcel:
[artifact:dependencies] Downloading: bcel/bcel/5.1/bcel-5.1.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: regexp/regexp/1.2/regexp-1.2.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: regexp/regexp/1.2/regexp-1.2.jar
[artifact:dependencies] Transferring 29K
[artifact:dependencies] Downloading: bcel/bcel/5.1/bcel-5.1.jar
[artifact:dependencies] Transferring 503K
     [copy] Copying 2 files to C:\source_code\apache-ant-1.8.3\lib

jdepend:
[artifact:dependencies] Downloading: jdepend/jdepend/2.9.1/jdepend-2.9.1.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: jdepend/jdepend/2.9.1/jdepend-2.9.1.jar
[artifact:dependencies] Transferring 56K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib

bsf:
[artifact:dependencies] Downloading: bsf/bsf/2.4.0/bsf-2.4.0.pom
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: commons-logging/commons-logging/1.0.4/commo
ns-logging-1.0.4.pom
[artifact:dependencies] Transferring 5K
[artifact:dependencies] Downloading: commons-logging/commons-logging/1.0.4/commo
ns-logging-1.0.4.jar
[artifact:dependencies] Transferring 37K
[artifact:dependencies] Downloading: bsf/bsf/2.4.0/bsf-2.4.0.jar
[artifact:dependencies] Transferring 110K
     [copy] Copying 2 files to C:\source_code\apache-ant-1.8.3\lib

debugging:
[artifact:dependencies] Downloading: which/which/1.0/which-1.0.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: which/which/1.0/which-1.0.jar
[artifact:dependencies] Transferring 16K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib

jruby:
[artifact:dependencies] Downloading: org/jruby/jruby/0.9.8/jruby-0.9.8.pom
[artifact:dependencies] Transferring 5K
[artifact:dependencies] Downloading: org/jruby/shared/0.9.8/shared-0.9.8.pom
[artifact:dependencies] Transferring 4K
[artifact:dependencies] Downloading: asm/asm-commons/2.2.3/asm-commons-2.2.3.pom

[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: asm/asm-parent/2.2.3/asm-parent-2.2.3.pom
[artifact:dependencies] Transferring 2K
[artifact:dependencies] Downloading: asm/asm-tree/2.2.3/asm-tree-2.2.3.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: asm/asm/2.2.3/asm-2.2.3.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: asm/asm-commons/2.2.3/asm-commons-2.2.3.jar

[artifact:dependencies] Transferring 14K
[artifact:dependencies] Downloading: org/jruby/jruby/0.9.8/jruby-0.9.8.jar
[artifact:dependencies] Transferring 1644K
[artifact:dependencies] Downloading: asm/asm/2.2.3/asm-2.2.3.jar
[artifact:dependencies] Transferring 34K
[artifact:dependencies] Downloading: asm/asm-tree/2.2.3/asm-tree-2.2.3.jar
[artifact:dependencies] Transferring 15K
     [copy] Copying 4 files to C:\source_code\apache-ant-1.8.3\lib

beanshell:
[artifact:dependencies] Downloading: org/beanshell/bsh/2.0b4/bsh-2.0b4.pom
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: org/beanshell/beanshell/2.0b4/beanshell-2.0
b4.pom
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: org/beanshell/bsh/2.0b4/bsh-2.0b4.jar
[artifact:dependencies] Transferring 275K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib
[artifact:dependencies] Downloading: org/beanshell/bsh-core/2.0b4/bsh-core-2.0b4
.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: org/beanshell/bsh-core/2.0b4/bsh-core-2.0b4
.jar
[artifact:dependencies] Transferring 140K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib

rhino:
[artifact:dependencies] Downloading: rhino/js/1.6R7/js-1.6R7.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: rhino/js/1.6R7/js-1.6R7.jar
[artifact:dependencies] Transferring 794K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib

script:

javamail:
[artifact:dependencies] Downloading: javax/mail/mail/1.4/mail-1.4.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: javax/activation/activation/1.1/activation-
1.1.pom
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: javax/mail/mail/1.4/mail-1.4.jar
[artifact:dependencies] Transferring 379K
[artifact:dependencies] Downloading: javax/activation/activation/1.1/activation-
1.1.jar
[artifact:dependencies] Transferring 61K
     [copy] Copying 2 files to C:\source_code\apache-ant-1.8.3\lib

jspc:
[artifact:dependencies] Downloading: tomcat/jasper-compiler/4.1.36/jasper-compil
er-4.1.36.pom
[artifact:dependencies] [WARNING] Unable to get resource from repository remote
(http://repo1.maven.org/maven2/)
[artifact:dependencies] Downloading: tomcat/jasper-compiler/4.1.36/jasper-compil
er-4.1.36.pom
[artifact:dependencies] [WARNING] Unable to get resource from repository central
 (http://repo1.maven.org/maven2)
[artifact:dependencies] Downloading: tomcat/jasper-compiler/4.1.36/jasper-compil
er-4.1.36.jar
[artifact:dependencies] Transferring 179K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib
[artifact:dependencies] Downloading: tomcat/jasper-runtime/4.1.36/jasper-runtime
-4.1.36.pom
[artifact:dependencies] [WARNING] Unable to get resource from repository remote
(http://repo1.maven.org/maven2/)
[artifact:dependencies] Downloading: tomcat/jasper-runtime/4.1.36/jasper-runtime
-4.1.36.pom
[artifact:dependencies] [WARNING] Unable to get resource from repository central
 (http://repo1.maven.org/maven2)
[artifact:dependencies] Downloading: tomcat/jasper-runtime/4.1.36/jasper-runtime
-4.1.36.jar
[artifact:dependencies] Transferring 70K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib
[artifact:dependencies] Downloading: javax/servlet/servlet-api/2.3/servlet-api-2
.3.pom
[artifact:dependencies] Transferring 0K
[artifact:dependencies] Downloading: javax/servlet/servlet-api/2.3/servlet-api-2
.3.jar
[artifact:dependencies] Transferring 76K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib

jai:
[artifact:dependencies] Downloading: javax/media/jai-core/1.1.3/jai-core-1.1.3.p
om
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: javax/media/jai-core/1.1.3/jai-core-1.1.3.j
ar
[artifact:dependencies] Transferring 1856K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib
[artifact:dependencies] Downloading: com/sun/media/jai-codec/1.1.3/jai-codec-1.1
.3.pom
[artifact:dependencies] Transferring 1K
[artifact:dependencies] Downloading: com/sun/media/jai-codec/1.1.3/jai-codec-1.1
.3.jar
[artifact:dependencies] Transferring 252K
     [copy] Copying 1 file to C:\source_code\apache-ant-1.8.3\lib

nonm2-macros:

init-no-m2:

init-cache:

-setup-temp-cache:
    [mkdir] Created dir: C:\Users\{user name}\.ant\tempcache

-fetch-netrexx:

-fetch-netrexx-no-commons-net:
      [get] Getting: ftp://ftp.software.ibm.com/software/awdtools/netrexx/NetRex
x.zip
      [get] To: C:\Users\{user name}\.ant\tempcache\NetRexx.zip
      [get] Error opening connection java.net.SocketException: Permission denied
: recv failed
      [get] Error opening connection java.net.SocketException: Connection reset
      [get] Error opening connection java.net.SocketException: Connection reset
      [get] Can't get ftp://ftp.software.ibm.com/software/awdtools/netrexx/NetRe
xx.zip to C:\Users\{user name}\.ant\tempcache\NetRexx.zip

BUILD FAILED
C:\source_code\apache-ant-1.8.3\fetch.xml:328: Can't get ftp://ftp.software.ibm.
com/software/awdtools/netrexx/NetRexx.zip to C:\Users\{user name}\.ant\tempcache\NetRe
xx.zip

Total time: 49 seconds

======================================

更新于 2012 年 5 月 6 日@下午 1:33

我阅读了这个片段,并意识到我把“\”放在了两个环境变量(ANT_HOME 和 JAVA_HOME)的末尾。我想你不能那样做。我的错。

视窗注意:

"ant.bat 脚本使用三个环境变量 - ANT_HOME、CLASSPATH 和 JAVA_HOME。确保设置了 ANT_HOME 和 JAVA_HOME 变量,并且它们没有引号(' 或 ")并且它们不以 \ 或以/。CLASSPATH 应该未设置或为空。”

  • 再一次,我不得不重新打开我的 Windows“cmd”窗口,因为我做了这些环境变量更改。

好像以前效果更好。请注意,它在下面没有做太多。它仍然失败。或者它可能不需要它们,因为它在上次运行时找到了它们。

C:\Windows\system32>cd %ANT_HOME%

C:\source_code\apache-ant-1.8.3>ant -f fetch.xml -Ddest=system
Buildfile: C:\source_code\apache-ant-1.8.3\fetch.xml

pick-dest:
     [echo] Downloading to C:\source_code\apache-ant-1.8.3\lib

probe-m2:

download-m2:

dont-validate-m2-checksum:

validate-m2-checksum:

checksum-mismatch:

checksum-match:

get-m2:

macros:

init:

logging:

junit:

xml:

networking:

regexp:

antlr:

bcel:

jdepend:

bsf:

debugging:

jruby:

beanshell:

rhino:

script:

javamail:

jspc:
[artifact:dependencies] Downloading: tomcat/jasper-compiler/4.1.36/jasper-compil
er-4.1.36.pom
[artifact:dependencies] [WARNING] Unable to get resource from repository remote
(http://repo1.maven.org/maven2/)
[artifact:dependencies] Downloading: tomcat/jasper-compiler/4.1.36/jasper-compil
er-4.1.36.pom
[artifact:dependencies] [WARNING] Unable to get resource from repository central
 (http://repo1.maven.org/maven2)
[artifact:dependencies] Downloading: tomcat/jasper-runtime/4.1.36/jasper-runtime
-4.1.36.pom
[artifact:dependencies] [WARNING] Unable to get resource from repository remote
(http://repo1.maven.org/maven2/)
[artifact:dependencies] Downloading: tomcat/jasper-runtime/4.1.36/jasper-runtime
-4.1.36.pom
[artifact:dependencies] [WARNING] Unable to get resource from repository central
 (http://repo1.maven.org/maven2)

jai:

nonm2-macros:

init-no-m2:

init-cache:

-setup-temp-cache:

-fetch-netrexx:
      [ftp] getting files

BUILD FAILED
C:\source_code\apache-ant-1.8.3\fetch.xml:325: The following error occurred whil
e executing this line:
C:\source_code\apache-ant-1.8.3\fetch.xml:144: java.net.SocketException: Permiss
ion denied: recv failed
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(SocketInputStream.java:150)
        at java.net.SocketInputStream.read(SocketInputStream.java:121)
        at java.io.BufferedInputStream.read1(BufferedInputStream.java:273)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:334)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:254)
        at org.apache.commons.net.telnet.TelnetInputStream.__read(TelnetInputStr
eam.java:114)
        at org.apache.commons.net.telnet.TelnetInputStream.run(TelnetInputStream
.java:535)
        at java.lang.Thread.run(Thread.java:722)

Total time: 4 seconds
4

2 回答 2

1

看来您的计算机上根本没有安装 Ant。所以我认为你必须下载并安装它:

http://ant.apache.org/

http://ant.apache.org/manual/index.html

于 2012-05-06T09:45:08.527 回答
1

Apache Ant 在显示实际堆栈跟踪方面做得不是很好。因此,对于 Ant 问题的故障排除,也可以在 Java 中完成,从 Java 中进行调试。在我的示例中,我能够通过运行此代码进行故障排除。您需要将“sqljdbc_auth.dll”放入运行目录以使其正常工作。这假定您已授予 i2b2 用户的权限。

import java.sql.*;

public class TestConnection
{
    public static void main(String[] args)
    {
        DB db = new DB();
        db.dbConnect("jdbc:sqlserver://LAPTOP-INSPIRON\\SQLEXPRESS:1435;databaseName=i2b2_demo;integratedSecurity=true;","i2b2","i2b2");
    }
}

class DB
{
    public DB() {}

    public void dbConnect(String db_connect_string, String db_userid, String db_password)
    {
        try
        {
            Connection conn = DriverManager.getConnection(db_connect_string, db_userid, db_password);
            System.out.println("connected");
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
};

构建 i2b2 本体数据库所需的步骤:

(1) 所有程序 > SQL Server 2008 R2 Express > 配置工具 > SQL Server 配置管理器 (SSCM) > 右键单击​​实例 TCP/IP 协议 > 选择启用

(2) SSCM - TCP/IP Properties > IP Addresses (tab) > set IP2 (section) > IP address to local IP address (例如192.168.1.101)

(3) SSCM - TCP/IP 属性 > IP 地址(选项卡)> IPAll(部分)> 删除动态端口

(4) SSCM - TCP/IP 属性 > IP 地址(选项卡)> IPAll(部分)> 添加静态端口 1435(默认为 1433,但我有两个实例)

(5) JDBC - 如果连接到 SQL Server 2008,请不要为 JDBC 使用 apache ant jar 文件 .. 而是下载 JDBC 版本 4 并使用“sqljdbc.jar”,然后在 build.xml 类路径 jar 列表中使用它

(6) JDBC - 将“sqljdbc_auth.dll”放在这些文件夹中(在 ant 运行目录内):

C:\source_code\i2b2\i2b2createdb-1602\edu.harvard.i2b2.data\Release_1-6\NewInstall\{folder}\

(7) JDBC - 如果您从另一台机器连接到此 SQL 框,请创建防火墙传入规则以允许 TCP 端口(1433、1434 或 1435 ... 或任何您选择的端口)。

(8) JDBC——连接字符串

db.url=jdbc:sqlserver://LAPTOP-INSPIRON\\SQLEXPRESS:1435;databaseName=i2b2_demo;

(9) Apache Ant 下载 - 如果您选择使用二进制文件,则无需调用“build install”。在这种情况下,请跳过 10-12。如果您选择下载 src 文件,您将在运行“构建安装”之前做 3 件事,否则它会显示“构建失败”而不是“构建成功”

(10) "build install" - 从 build.xml 的 lite 列表中移除 test-jar (最初命名为 "data_build.xml")

  <target name="dist-lite"
    depends="jars,test-jar"

to

  <target name="dist-lite"
    depends="jars"

(11)“build install”——在“lib”文件夹下添加一个名为“optional”的文件夹

(12)“构建安装” - 按照这里的答案:

Apache Ant 安装错误的解决方法

(13) 取进程——运行“ant -f fetch.xml -Ddest=system”

(14) Ant 命令 - 运行这个 "ant create_workdata_tables_release_1-6" .. 换句话说,不要使用 -f .. 如果你不想将 "data_build.xml" 重命名为 "build.xml" 使用 - buildfile(不是 -f)参数和构建文件的路径和文件名。

(15) 以正确的顺序执行命令,以便正确构建数据库.. 如果不这样做,请重新开始。

仅供参考:如果我们使用 Red Gate SQL 比较和 Red Gate SQL 数据比较工具,这会容易得多。

于 2012-05-07T04:59:32.277 回答