Bug#705645: Sqlline fails with MS SQL Server JDBC data sources

Emmanuel Bourg ebourg at apache.org
Thu Mar 6 10:41:32 UTC 2014

The java.ext.dirs trick doesn't seem to work anymore with OpenJDK 7u51
in unstable. When running sqlline with debugging enabled we get:

[debug] /usr/bin/sqlline: Runnning /usr/lib/jvm/default-java/bin/java
-Djava.ext.dirs=/usr/share/java/:/usr/local/share/java/ -classpath
/usr/share/java/jline.jar:/usr/share/java/sqlline.jar sqlline.SqlLine
Error: Could not find or load main class sqlline.SqlLine

I tried replacing the java.ext.dirs property with a classpath with a
wildcard, but it didn't work. With the classpath set to
/usr/share/java/* java fails to find the sqlline.SqlLine class. And with
a classpath set to /usr/share/java/sqlline.jar:/usr/share/java/* it
throws an IOException because it opens too many files:

$ java  -classpath '/usr/share/java/sqlline.jar:/usr/share/java/*'
java.io.IOException: Cannot run program "sh": error=24, Too many open files
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1041)
        at java.lang.Runtime.exec(Runtime.java:617)
        at java.lang.Runtime.exec(Runtime.java:485)
        at jline.UnixTerminal.exec(UnixTerminal.java:292)
        at jline.UnixTerminal.exec(UnixTerminal.java:277)
        at jline.UnixTerminal.stty(UnixTerminal.java:268)
        at jline.UnixTerminal.initializeTerminal(UnixTerminal.java:71)
        at jline.Terminal.setupTerminal(Terminal.java:75)
        at sqlline.SqlLine$Opts.<init>(Unknown Source)
        at sqlline.SqlLine.<init>(Unknown Source)
        at sqlline.SqlLine.mainWithInputRedirection(Unknown Source)
        at sqlline.SqlLine.main(Unknown Source)
Caused by: java.io.IOException: error=24, Too many open files
        at java.lang.UNIXProcess.forkAndExec(Native Method)
        at java.lang.UNIXProcess.<init>(UNIXProcess.java:135)
        at java.lang.ProcessImpl.start(ProcessImpl.java:130)
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1022)
        ... 11 more

The best we can do at this point is to list explicitly the known JDBC
drivers in the classpath. That's less flexible but it will be good
enough in most cases.

Emmanuel Bourg

More information about the pkg-java-maintainers mailing list