[Anthill-pro] Io exception: While opening a DB connection

Antoine Levy-Lambert antoine at gmx.de
Mon Jul 17 17:10:15 CDT 2006


Hello Anoop,

you might want to have a look at the <sql/> task of ant.
With this task it is possible to do some database work in process.

It is even possible to call an Oracle stored procedure which has no arguments.

This ant fragment works for us using Ant 1.6.5 :


            <sql
            driver="oracle.jdbc.driver.OracleDriver"
            url="${database.url}"
            userid="${database.user}"
            password="${database.pwd}"
            classpath="${lib.dir}/ojdbc14_9.2.0.6.jar"
            onerror="continue"
            delimiter="/"
            delimitertype="row"
        >
            begin
               schema_owner.procedure_name;
            end;
            /
        </sql>

where you replace schema_owner by the name of a schema in your DB, and procedure_name by the name of a procedure doing what you want.

I also found an article about capturing dbms_output in ant, under this URL : http://technology.amis.nl/blog/?p=696

Regards,

Antoine

-------- Original-Nachricht --------
Datum: Fri, 14 Jul 2006 15:50:46 -0400
Von: Anoop Raj R <anoop.raj at gmail.com>
An: anthill-pro at lists.urbancode.com
Betreff: [Anthill-pro] Io exception: While opening a DB connection

> All,
> 
> I am trying to run a small java program to open a connection thru
> Anthill Pro.  I have my anthill running as a Windows Service using
> Apache tomcar Webserver in a Win3K box. I am able to run the java
> program and the ant (from command promt) successfuly. But, Anthill Pro
> throwing " Io exception: The Network Adapter could not establish the
> connection"
> 
> The windows service also has a logon as user permissions. All the
> files that i am using (Java, Ant & the Anthill Error) is pasted in
> this. Can any one point me what is the silly mistake that i am doing.
> 
>  I have a whole set of Junits waiting to be executed thru Anthill build
> process.
> 
> thank you,
> Anoop
> 
> Files:
> ---------------Build file
> ----------------------------------------------------
> <project name="test" basedir="." default="help">
>  <target name="build">
>      <exec dir="." executable="java">
>          <arg line="-classpath
> C:\oracle\ora92\jdbc\lib\classes12.zip;.; com.test.ConnectToDB" />
>      </exec>
>  </target>
> </project>
> 
> 
> -----------Java File----------------------------------------------
> package com.test;
> import java.sql.*;
> 
> public class ConnectToDB {
> 
>   public static void main (String args []) throws SQLException
>   {
>     // Load the Oracle JDBC driver
>     try {
> 	Class.forName("oracle.jdbc.driver.OracleDriver");
>       // Connect to the database
> 	    Connection conn =
> 	      DriverManager.getConnection
> ("jdbc:oracle:thin:@abcd0103:1521:MYDB", "scott", "tiger");
> 	    System.out.println("conn :"+conn);
> 
> 	} catch (SQLException e) {
> 		e.printStackTrace();	
> 	} catch (ClassNotFoundException e1) {
> 		e1.printStackTrace();
> 	}	
> 	  }
> }
> 
> ------------------Error---------------------------------------
> INFO - Executing Ant command: cmd /x/c C:\ANT\bin\ant
> "-Danthill.version=1.0.3" "-Danthill.user.name=Unknown"
> "-Danthill.project.name=test" "-Danthill.branch.name=db_test"
> "-Danthill.build_track.name=a_test" "-Danthill.build.tag_built="
> "-Danthill.build.date_time=Fri Jul 14 15:36:42 EDT 2006" -buildfile
> build.xml build
> INFO - Explicity set environment variables:
> INFO - JAVA_HOME=C:\j2sdk1.4.2_03
> INFO - ANT_HOME=C:\ANT
> INFO - CLASSPATH=
> INFO - ANT_OPTS=
> INFO - Execute:Java13CommandLauncher: Executing 'cmd' with arguments:
> '/x/c'
> 'C:\ANT\bin\ant'
> '-Danthill.version=1.0.3'
> '-Danthill.user.name=Unknown'
> '-Danthill.project.name=test'
> '-Danthill.branch.name=db_test'
> '-Danthill.build_track.name=a_test'
> '-Danthill.build.tag_built='
> '-Danthill.build.date_time=Fri Jul 14 15:36:42 EDT 2006'
> '-buildfile'
> 'build.xml'
> 'build'
> 
> The ' characters around the executable and arguments are
> not part of the command.
> 
> WorkingDir: C:\Shared\src
> 
> DEBUG -
> Environment Variables:
> JAVA_HOME=C:\j2sdk1.4.2_03
> ANT_HOME=C:\ANT
> CLASSPATH=
> ANT_OPTS=
> INFO - Buildfile: build.xml
> INFO -
> INFO - build:
> INFO -      [exec] java.sql.SQLException: Io exception: The Network
> Adapter could not establish the connection
> INFO -      [exec] 	at
> oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
> INFO -      [exec] 	at
> oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
> INFO -      [exec] 	at
> oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
> INFO -      [exec] 	at
> oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:404)
> 
> --------------------------------------
> _______________________________________________
> Anthill-pro mailing list
> Anthill-pro at lists.urbancode.com
> http://lists.urbancode.com/mailman/listinfo/anthill-pro
> 


More information about the Anthill-pro mailing list