0

I have created a simple Groovy project in GGTS IDE that connects to Oracle and SQLServer. The Program runs fine within the IDE but when I run the program through the command line I seem to get some sort of enconding error in MANIFEST.MF?. See the stacktrace below:

Command Line

groovy -cp lib\ojdbc14_g.jar lib\sqljdbc4.jar src\Starter.groovy

Result

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
C:\workspace-ggts-3.1.0.RELEASE\Test\lib\sqljdbc4.jar: 1: unexpected char: 0x3 @ line 1, column 3.
   PK♥ h?I@            ¶   META-INF/MANIFEST.MF¡|GôΓ┌▓εⁿD∞ ░=x/êsä      8◄o ï∟B▲
ë╔
     ^

1 error

In the past to connect to MSSQLServer I have used the following jars:

  • msbase.jar
  • msutil.jar
  • mssqlserver.jar

This time though, when I looked for jdbc jars for 2008 I got the sqljdbc4.jar. Again it works from within the IDE but not from command line. I have singled out the problem to be in the sqljdbc4.jar because I commented all the code related to that and the program ran fine with just the oracle jar references.

  1. Anybody know why this is happening?
  2. What jars are you using to connect to sqlserver 2008 from the command line with groovy?

Thanks.

Viriato
  • 2,981
  • 7
  • 40
  • 54

1 Answers1

1

You need semi-colons between classpath entries (assuming you are on Windows)

groovy -cp lib\ojdbc14_g.jar;lib\sqljdbc4.jar src\Starter.groovy

Or colons if you're on Linux/Mac

groovy -cp lib/ojdbc14_g.jar:lib/sqljdbc4.jar src/Starter.groovy
tim_yates
  • 167,322
  • 27
  • 342
  • 338
  • Thanks for your input but it did not work. I still get the exact same error. – Viriato Nov 13 '12 at 16:33
  • @Viriato what version of Groovy are you using? I can find a [bug report](http://jira.codehaus.org/browse/GROOVY-2037) for versions less than 1.7.1 – tim_yates Nov 13 '12 at 16:37
  • Groovy 2.0.5 and Java 1.6.0_20 – Viriato Nov 13 '12 at 19:23
  • the exact one. It's weird because If I remove the sqlserver code and just keep the oracle one it works. It feels like there is something wrong with the sqljdbc4.jar – Viriato Nov 13 '12 at 19:28
  • and it's exactly the same copy of the jar that works with the ide? – tim_yates Nov 13 '12 at 19:31
  • I'm all out of ideas then :-( sorry – tim_yates Nov 13 '12 at 19:38
  • Very strange. Created a new project connecting only to just MSSQLSERVER 2008 and it worked fine. But when I add the oracle jar to issue my query against the oracle database then the error comes up again. – Viriato Nov 13 '12 at 19:49
  • Thanks Tim. Apparently I was putting a space after the semicolon and that was yielding the same error. My apologies. – Viriato Nov 19 '12 at 14:48