You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Rick Genter <rg...@silverlink.com> on 2005/12/07 19:11:15 UTC

Error establishing socket from task?

I'm trying to bring up our app suite on Linux (Fedora Core 4). One of
the earliest apps uses the <sql> task in its build script to initialize
the database we use. We call <sql> like this:

        <sql driver="com.microsoft.jdbc.sqlserver.SQLServerDriver"
             classpathref="jdbc.driver.path"
 
url="jdbc:microsoft:sqlserver://${test.db.host}:1433;DatabaseName=master
;ProgramName=Object API Test"
             userid="${test.db.userid}"
             password="${test.db.password}"
             src="${sql.master}/Data/sql_sysmessages.sql"
             delimiter="GO"/>

When I run the build script in verbose mode I get the following:

[rgenter@rgenter-vdt Object]$ ant -verbose sql
Apache Ant version 1.6.2 compiled on May 23 2005
Buildfile: build.xml
Detected Java version: 1.4 in: /usr/java/j2sdk1.4.2_05/jre
Detected OS: Linux
parsing buildfile /home/rgenter/src/Object/build.xml with URI =
file:///home/rgenter/src/Object/build.xml
Project base dir set to: /home/rgenter/src/Object
Build sequence for target `sql' is [sql]
Complete build sequence is [sql, local-file-test-setup,
remote-test-execute, local-test-setup, local-test-execute,
local-test-cleanup, local-test, remote-test-cleanup, compile, jar, dist,
proxy-dist, proxy-config-dist, all, remote-test-run, remote-test-setup,
local-test-run, other-projects, local-file-test-execute,
local-file-test-cleanup, local-file-test, remote-test, clean, test,
local-file-test-run, ]

sql:
     [echo] Installation system messages...
      [sql] connecting to
jdbc:microsoft:sqlserver://10.100.7.217:1433;DatabaseName=master;Program
Name=Object API Test
      [sql] Loading com.microsoft.jdbc.sqlserver.SQLServerDriver using
AntClassLoader with classpath
/opt/savvi/lib/ext/msbase.jar:/opt/savvi/lib/ext/mssqlserver.jar:/opt/sa
vvi/lib/ext/msutil.jar

BUILD FAILED
/home/rgenter/src/Object/build.xml:200: java.sql.SQLException:
[Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.
        at
org.apache.tools.ant.taskdefs.JDBCTask.getConnection(JDBCTask.java:314)
        at
org.apache.tools.ant.taskdefs.SQLExec.execute(SQLExec.java:347)
        at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
        at
org.apache.tools.ant.Project.executeTargets(Project.java:1062)
        at org.apache.tools.ant.Main.runBuild(Main.java:673)
        at org.apache.tools.ant.Main.startAnt(Main.java:188)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)
Caused by: java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for
JDBC]Error establishing socket.
        at
com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
        at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown
Source)
        at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown
Source)
        at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown
Source)
        at
com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown
Source)
        at
com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown
Source)
        at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
        at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
        at
org.apache.tools.ant.taskdefs.JDBCTask.getConnection(JDBCTask.java:304)
        ... 11 more
--- Nested Exception ---
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]Error
establishing socket.
        at
com.microsoft.jdbc.base.BaseExceptions.createException(Unknown Source)
        at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown
Source)
        at com.microsoft.jdbc.base.BaseExceptions.getException(Unknown
Source)
        at com.microsoft.jdbc.sqlserver.tds.TDSConnection.<init>(Unknown
Source)
        at
com.microsoft.jdbc.sqlserver.SQLServerImplConnection.open(Unknown
Source)
        at
com.microsoft.jdbc.base.BaseConnection.getNewImplConnection(Unknown
Source)
        at com.microsoft.jdbc.base.BaseConnection.open(Unknown Source)
        at com.microsoft.jdbc.base.BaseDriver.connect(Unknown Source)
        at
org.apache.tools.ant.taskdefs.JDBCTask.getConnection(JDBCTask.java:304)
        at
org.apache.tools.ant.taskdefs.SQLExec.execute(SQLExec.java:347)
        at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1214)
        at
org.apache.tools.ant.Project.executeTargets(Project.java:1062)
        at org.apache.tools.ant.Main.runBuild(Main.java:673)
        at org.apache.tools.ant.Main.startAnt(Main.java:188)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:196)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:55)

Total time: 1 second
[rgenter@rgenter-vdt Object]$

The problem is not a basic networking error, though, because I can
telnet to the server on port 1433 just fine:

[rgenter@rgenter-vdt Object]$ telnet 10.100.7.217 1433
Trying 10.100.7.217...
Connected to rgenter-dt2.hq.silverlink.local (10.100.7.217).
Escape character is '^]'.
fdsafdsafdsa
Connection closed by foreign host.
[rgenter@rgenter-vdt Object]$ 

Any ideas? The same build script works fine on Windows, BTW...

--
Rick Genter
Principal Engineer
Silverlink Communications

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Error establishing socket from task?

Posted by Antoine Levy-Lambert <an...@gmx.de>.
Hello Rick,

I am not sure what this is.
Try to set the jars of the mssql driver in the CLASSPATH env var before
starting ant. Maybe this helps.
Try also to find out if there are bugs reported against this driver
under linux independently of ant ?
Maybe try to make a HelloWorldJDBC program running without ant under
Linux with the same connection params
to see if the error is reproducable. If it is, then it could be a
Microsoft problem, or less probably a JDK/JRE problem.
If you do not get the error with HelloWorldJDBC, then it could be an ant
bug, or a build file issue.
Find out if the MSSQL driver can be made to make a debug log, maybe with
some -D properties ?
Cheers,
Antoine

Rick Genter wrote:

>I'm trying to bring up our app suite on Linux (Fedora Core 4). One of
>the earliest apps uses the <sql> task in its build script to initialize
>the database we use. We call <sql> like this:
>
>        <sql driver="com.microsoft.jdbc.sqlserver.SQLServerDriver"
>             classpathref="jdbc.driver.path"
> 
>url="jdbc:microsoft:sqlserver://${test.db.host}:1433;DatabaseName=master
>;ProgramName=Object API Test"
>             userid="${test.db.userid}"
>             password="${test.db.password}"
>             src="${sql.master}/Data/sql_sysmessages.sql"
>             delimiter="GO"/>
>
>  
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org