[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [golo-dev] Can apparently not import java.sql.DriverManager
|
Hello Vincent, thanks for your interest in Golo.
The `java.sql.DriverManager` defines a
`static void println(String message)` method that
"Prints a message to the current JDBC log stream."
When importing the class, the static methods became available in the
current module scope, and thus this `println` function shadows the
builtin one. The script actually does not crash, but does not print on
stdout!
Replace your `println` with the explicit `gololang.Predefined.println`
to be convinced.
Vincent (2018-02-10 15:14):
> Hello,
>
> I forgot the import statement works differently than Java.
>
> DriverManager (including loading of the JDBC drivers) works fine when doing "import java.sql"
>
> It's still a bug that the script silently crashes with the noted import statement, I guess.
>
> Kind regards,
> Vincent
>
> On Sat, Feb 10, 2018, at 1:47 PM, Vincent wrote:
> > Hello,
> >
> > Wanted to write a script that converts the content of an old Derby
> > database to CouchDB JSON documents and wanted to use Golo for this.
> >
> > However I encounter some strange behavior. When importing the
> > java.sql.DriverManager class, the program quits without writing anything
> > to the console.
> >
> > Smallest script to reproduce (tried on Golo 3.2.0):
> >
> > ===
> >
> > module wut
> >
> > import java.sql.DriverManager
> >
> > function main = |args| {
> > println("??!!")
> > }
> >
> > ===
> >
> > When running the script above (using the golo golo --files XXX.golo)
> > command , nothing is printed to the console when the program exits.
> >
> > I assume DriverManager is doing some magic to the classpath to add the
> > database drivers (I use golo's handy shebang command to automatically
> > load my JDBC driver which is in the "libs" subdir of my script), perhaps
> > that is causing some problems, but it would have been nice to at least
> > see an exception of some sort.
> >
> > Best regards,
> > Vincent
> _______________________________________________
> golo-dev mailing list
> golo-dev@xxxxxxxxxxx
> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
> https://dev.eclipse.org/mailman/listinfo/golo-dev
>