1

I'm experimenting with Scala macros, and I'm using Eclipse and the ScalaIDE plugin. Following this question and answer, I created a separate Eclipse project for the macros.

That worked, but then I tried to write a macro implementation that calls JDBC to help generate code.

I have the postgresql-9.1-901.jbc4.jar in the build path of both projects, but macro expansion gives this error:

java.sql.SQLException: No suitable driver found for jdbc:postgresql://...

Q: How do I control the classpath used for macro expansion, and fix this?

Update

I've partly answered my questions... I can add Class.forName("org.postgresql.Driver") to the macro implementation and then everything works. But I still don't know why that is different from normal code, where I don't have to write that. Usually having the postgres jar on the classpath is enough.

Community
  • 1
  • 1
Rob N
  • 11,371
  • 11
  • 72
  • 126

0 Answers0