Le 5 mars 04, ? 14:01, Anders Bengtsson a ?crit : > --- Yvon Thoraval <yvon.thoravalNO-SPAM / free.fr> wrote: >> >> i want get a connection to a PostgreSQL database then i wrote a JRuby >> script : > [---] >> 9 JavaLang::Class.forName("org.postgresql.Driver") > > I think the "Class" constant here will refer to Ruby's Class, not > Java's. You'll have to use an alias for that constant. > tanxs for your answer, i did some progress in the meantime pgd = Java::JavaClass.for_name("org.postgresql.Driver") then replacing forName by for_name works... pSQL = JavaSQL::DriverManager.getConnection("jdbc:postgresql:macave", "postgresql", "yvon5533") right now, i"m stuck with the above line raising a "run time" error : (eval):4:in 'getConnection': Native Exception: 'class java.sql.SQLException'; Message: No suitable driver; StackTrace: java.sql.SQLException: No suitable driver (RuntimeError) at java.sql.DriverManager.getConnection(DriverManager.java:532) at java.sql.DriverManager.getConnection(DriverManager.java:171) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav a:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor Impl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.jruby.javasupport.JavaMethod.invokeWithExceptionHandling(JavaMethod. java:148) at org.jruby.javasupport.JavaMethod.invoke_static(JavaMethod.java:135) at org.jruby.javasupport.JavaMethod.callIndexed(JavaMethod.java:197) at org.jruby.runtime.IndexedCallback.execute(IndexedCallback.java:72) at org.jruby.internal.runtime.methods.CallbackMethod.call(CallbackMethod.ja va:63) at org.jruby.RubyModule.call0(RubyModule.java:758) at org.jruby.RubyModule.call(RubyModule.java:719) at org.jruby.evaluator.EvaluateVisitor.visitCallNode(EvaluateVisitor.java: 427) at org.jruby.ast.CallNode.accept(CallNode.java:64) at org.jruby.evaluator.EvaluateVisitor.eval(EvaluateVisitor.java:218) at org.jruby.evaluator.EvaluateVisitor.visitLocalAsgnNode(EvaluateVisitor.j ava:934) at org.jruby.ast.LocalAsgnNode.accept(LocalAsgnNode.java:57) at org.jruby.evaluator.EvaluateVisitor.eval(EvaluateVisitor.java:218) at org.jruby.evaluator.EvaluateVisitor.visitNewlineNode(EvaluateVisitor.jav a:1020) at org.jruby.ast.NewlineNode.accept(NewlineNode.java:65) at org.jruby.evaluator.EvaluateVisitor.eval(EvaluateVisitor.java:218) at org.jruby.evaluator.EvaluateVisitor.visitBlockNode(EvaluateVisitor.java: 323) at org.jruby.ast.BlockNode.accept(BlockNode.java:89) at org.jruby.evaluator.EvaluateVisitor.eval(EvaluateVisitor.java:218) at org.jruby.RubyObject.eval(RubyObject.java:362) at org.jruby.internal.runtime.methods.DefaultMethod.call(DefaultMethod.java :73) at org.jruby.RubyModule.call0(RubyModule.java:758) at org.jruby.RubyModule.call(RubyModule.java:719) at org.jruby.evaluator.EvaluateVisitor.visitCallNode(EvaluateVisitor.java: 427) at org.jruby.ast.CallNode.accept(CallNode.java:64) at org.jruby.evaluator.EvaluateVisitor.eval(EvaluateVisitor.java:218) at org.jruby.evaluator.EvaluateVisitor.visitLocalAsgnNode(EvaluateVisitor.j ava:934) at org.jruby.ast.LocalAsgnNode.accept(LocalAsgnNode.java:57) at org.jruby.evaluator.EvaluateVisitor.eval(EvaluateVisitor.java:218) at org.jruby.evaluator.EvaluateVisitor.visitNewlineNode(EvaluateVisitor.jav a:1020) at org.jruby.ast.NewlineNode.accept(NewlineNode.java:65) at org.jruby.evaluator.EvaluateVisitor.eval(EvaluateVisitor.java:218) at org.jruby.evaluator.EvaluateVisitor.visitBlockNode(EvaluateVisitor.java: 323) at org.jruby.ast.BlockNode.accept(BlockNode.java:89) at org.jruby.evaluator.EvaluateVisitor.eval(EvaluateVisitor.java:218) at org.jruby.runtime.ThreadContext.eval(ThreadContext.java:116) at org.jruby.Ruby.eval(Ruby.java:243) at org.jruby.Main.runInterpreter(Main.java:122) at org.jruby.Main.main(Main.java:89) from (eval):4:in 'getConnection' from connect2macave.rb:11 from :0