Below are commands in an i2b2 database setup tutorial to create a bunch of tables and load the data for a particular database. I've only run *.sql commands manually (in a new query window) in SQL Server Management Studio (SSMS) before. Is this something that must be run from Java, or can I do this directly from a command prompt somewhere? If so, can you help me with the necessary steps please? (ie: do I need to reference a 3rd party assembly, I'm guessing I need to configure my database connection string, etc..)
ant –f data_build.xml create_workdata_tables_release_1-6
ant –f data_build.xml db_workdata_load_data
Just after hovering over "ant" (StackOverflow tag), it appears that it's some Java tool.
"Apache Ant (formerly Jakarta Ant) is a declarative, XML-based build tool for Java projects. It provides a rich set of standard tasks for performing most common build operations, such as compilation with javac, building archives and running tests. Ant's functionality can be extended through custom tasks and macros."
I tried running this from the command prompt in Windows, but got an error.
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.
I see the actual *.sql files listed in the XML file, and I'm guessing they are ordered in a particular way so that the associated (containing primary keys) have the data loaded into them first, and the bridge/parent/owner/base tables (containing foreign keys) are run last, since they are dependent on the associated tables. If all else fails, I can probably just run these commands directly from SSMS in the order listed, but I'm curious to give this "ant" command a try.
Setup instructions:
download "i2b2createdb-1602.zip" and extract.
download "i2b2core-doc-1602.zip" and extract (use these PDF documents for install instructions)
=====================================
It appears that I have to define the variables defined within the XML file.
<?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>
=====================================
SQL Server Management Studio Setup:
Install Oracle JDK:
Install Apache Ant:
C:\source_code\apache-ant-1.8.3\
or directory used in %ANT_HOME% environment variableWindows 7 Environment Variable Setup for Java and Ant:
Windows 7 > Control Panel > System > click "Environment Variables" button >
(don't forget the trailing "\") *[MacGyver 5/6/2012 @2:45pm - ignore this... remove the trailing "\" character ... see my comment below in the question]
under the "System Variables" section, click "Add" >
Variable Name: JAVA_HOME
Variable Value: C:\Program Files\Java\jdk1.7.0_02\
under the "System Variables" section, click "Add" >
Variable Name: ANT_HOME
Variable Value: C:\source_code\apache-ant-1.8.3\
under the "System Variables" section, click "Path" environment variable, click "Edit" >
Variable Name: Path
Variable Value: {value before editing};%JAVA_HOME%\bin;%ANT_HOME%\bin;
restart command prompt (Run As Administrator)
replace each of the C:\source_code\i2b2\i2b2createdb-1602\edu.harvard.i2b2.data\Release_1-6\NewInstall\{folder}\db.properties
files with the appropriate values. Replace "?" with correct values.
"db.properties" file:
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
Getting this error:
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
=====================================
Installing Ant:
Either click this: http://ant.apache.org/manual/index.html
or...
navigate to http://ant.apache.org/ > Manual > Installing Apache Ant > Install 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.
...... then noticed that I missed the parameter on the command.. it still fails though!
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
=====================================
I read this snippet, and realized I had put the "\" at the end of the two environment variables (ANT_HOME & JAVA_HOME). I guess you cannot do that. My bad.
Windows Note:
"The ant.bat script makes use of three environment variables - ANT_HOME, CLASSPATH and JAVA_HOME. Ensure that ANT_HOME and JAVA_HOME variables are set, and that they do not have quotes (either ' or ") and they do not end with \ or with /. CLASSPATH should be unset or empty."
It seems like it worked better before. Notice it isn't doing much below. It's still failing. Or perhaps it doesn't need them because it found them from the previous time running.
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
Apache Ant doesn't do a very good job of showing the actual stack trace. So for troubleshooting Ant issues, that can also be done in Java, debug from Java. In my example, I was able to troubleshoot by running this code. You will need to place "sqljdbc_auth.dll" into the run directory to get this to work. This assumes you've allowed the permissions for the i2b2 user.
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();
}
}
};
Steps necessary to get i2b2 Ontology Database built:
(1) All Programs > SQL Server 2008 R2 Express > Configuration Tools > SQL Server Configuration Manager (SSCM) > right click instance TCP/IP protocol > select Enable
(2) SSCM - TCP/IP Properties > IP Addresses (tab) > set IP2 (section) > IP address to local IP address (192.168.1.101 for example)
(3) SSCM - TCP/IP Properties > IP Addresses (tab) > IPAll (section) > remove dynamic port
(4) SSCM - TCP/IP Properties > IP Addresses (tab) > IPAll (section) > add static port of 1435 (default is 1433 but I had two instances in there)
(5) JDBC - don't use the apache ant jar file for JDBC if connecting to SQL Server 2008 .. instead download JDBC version 4 and use "sqljdbc.jar" then use that in your build.xml classpath jar list
(6) JDBC - place "sqljdbc_auth.dll" in these folders (inside of ant run directory):
C:\source_code\i2b2\i2b2createdb-1602\edu.harvard.i2b2.data\Release_1-6\NewInstall\{folder}\
(7) JDBC - if you are connecting to this SQL box from another machine, create a firewall incoming rule to allow the port (1433, 1434 or 1435 ... or whatever you chose) for TCP.
(8) JDBC - connection string
db.url=jdbc:sqlserver://LAPTOP-INSPIRON\\SQLEXPRESS:1435;databaseName=i2b2_demo;
(9) Apache Ant download - if you choose to use the binaries, you don't need to call "build install". In that case, skip 10-12. If you choose download the src files, you will do 3 things before running "build install" or else it'll say "BUILD FAILED" rather than "BUILD SUCCESSFUL"
(10) "build install" - removed test-jar from the lite list in build.xml (originally named "data_build.xml")
<target name="dist-lite"
depends="jars,test-jar"
to
<target name="dist-lite"
depends="jars"
(11) "build install" - add a folder called "optional" under the "lib" folder
(12) "build install" - follow the answer here:
Workaround for Apache Ant Install Bug
(13) Fetch process - run "ant -f fetch.xml -Ddest=system"
(14) Ant command - run this "ant create_workdata_tables_release_1-6" .. in other words, don't use -f .. if you don't want to rename "data_build.xml" to "build.xml" use the -buildfile (not the -f) parameter with the path and filename of your build file.
(15) Perform the commands in the correct order so the database is built correctly .. if you don't, start over.
FYI: This would have been much easier if we used Red Gate SQL Compare and Red Gate SQL Data Compare tools.