Последовательный запуск файлов *.sql из XML-файла с помощью команды ant (создание базы данных онтологии i2b2 на SQL Server 2008 Express)?

Ниже приведены команды из учебника по настройке базы данных i2b2 для создания набора таблиц и загрузки данных для конкретной базы данных. Я только запускал команды *.sql вручную (в новом окне запросов) в SQL Server Management Studio (SSMS). Это то, что должно быть запущено из Java, или я могу сделать это прямо из командной строки где-нибудь? Если да, можете ли вы помочь мне с необходимыми шагами, пожалуйста? (то есть: мне нужно ссылаться на стороннюю сборку, я думаю, мне нужно настроить строку подключения к базе данных и т. д.)

ant –f data_build.xml create_workdata_tables_release_1-6

ant –f data_build.xml db_workdata_load_data

Сразу после наведения на "муравей" (тэг Stackru) кажется, что это какой-то инструмент Java.

"Apache Ant (ранее Jakarta Ant) - это декларативный инструмент сборки на основе XML для проектов Java. Он предоставляет богатый набор стандартных задач для выполнения наиболее распространенных операций сборки, таких как компиляция с использованием 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.

Я вижу фактические файлы *.sql, перечисленные в файле XML, и я предполагаю, что они упорядочены особым образом, так что связанные (содержащие первичные ключи) данные загружаются в них первыми, а мост / родитель / владелец Таблицы / 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>

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

Обновлено 6.06.2012 @ 6:52 утра:

Настройка SQL Server Management Studio:

  • SQL Server Management Studio> создать новую базу данных под названием "i2b2_demo"

Установите Oracle JDK:

Установите Apache Ant:

  • скачать бинарные файлы на http://ant.apache.org/
  • перейдите по этому пути для получения инструкций по установке: Руководство> Установка Apache Ant > Получение Ant > .. следуйте инструкциям
  • переместить извлеченную папку (содержащую папку bin) внутри C:\source_code\apache-ant-1.8.3\ или каталог, используемый в переменной среды%ANT_HOME%

Настройка переменной среды Windows 7 для Java и Ant:

Windows 7> Панель управления> Система> нажмите кнопку "Переменные среды">

(не забывайте завершающий "\") * [MacGyver 5/6/2012 @ 14:45 - игнорируйте это... удалите завершающий символ "\"... см. мой комментарий ниже в вопросе]

в разделе "Системные переменные" нажмите "Добавить"> Имя переменной: 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

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

Обновлено 06.05.2012 @ 7:33 утра... нашел эту страницу с этой ошибкой...

Установка Ant:

Либо нажмите здесь: 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

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

Обновлено 6/6/2012 @ 13:33 вечера

Я прочитал этот фрагмент и понял, что поставил "\" в конце двух переменных среды (ANT_HOME & JAVA_HOME). Я думаю, вы не можете этого сделать. Виноват.

Примечание для Windows:

"Сценарий 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

2 ответа

Решение

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> IP-адреса (вкладка)> установить IP2 (раздел) > IP-адрес на локальный IP-адрес (например, 192.168.1.101)

(3) SSCM - Свойства TCP/IP> IP-адреса (вкладка) > IPAll (раздел)> удалить динамический порт

(4) SSCM - Свойства TCP/IP> IP-адреса (вкладка) > IPAll (раздел)> добавить статический порт 1435 (по умолчанию 1433, но там было два экземпляра)

(5) JDBC - не используйте файл jar apache ant для JDBC при подключении к SQL Server 2008 .. вместо этого скачайте JDBC версии 4 и используйте "sqljdbc.jar", а затем используйте его в своем списке jar-пути к классам build.xml

(6) JDBC - поместите "sqljdbc_auth.dll" в эти папки (внутри каталога ant run):

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

(7) JDBC - если вы подключаетесь к этому блоку SQL с другого компьютера, создайте правило входящего брандмауэра, чтобы разрешить порт (1433, 1434 или 1435 ... или любой другой вариант) для TCP.

(8) JDBC - строка подключения

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

(9) Загрузка Apache Ant - если вы решите использовать двоичные файлы, вам не нужно называть "build install". В этом случае пропустите 10-12. Если вы решите загрузить файлы src, перед запуском "build install" вы сделаете 3 вещи, иначе будет "BUILD FAILED", а не "BUILD SUCCESSFUL"

(10) "сборка установки" - удален test-jar из списка lite в build.xml (первоначально назывался "data_build.xml")

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

to

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

(11) "build install" - добавьте папку с именем "extra" в папку "lib"

(12) "build install" - следуйте ответу здесь:

Временное решение для установки Apache Ant Bug

(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 Compare и Red Gate SQL Data Compare.

Кажется, что Ant просто не установлен на вашем компьютере. Поэтому я думаю, что вы должны скачать и установить его:

http://ant.apache.org/

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

Другие вопросы по тегам