From: <php...@li...> - 2008-01-07 23:19:36
|
G'day, Thanks for the prompt reply, i did see that note in the readme of PJB Ive just had another go (I think i was instantiating a class object for the forname call rather than using the java method) but i am still getting no love require_once("./pjb/java/Java.inc"); java_require("mysql-connector-java-5.1.5-bin.jar"); $class = java("java.lang.Class"); $loader = java("java.lang.Thread")->currentThread()->getContextClassLoader(); $class->forName("com.mysql.jdbc.Driver",true,$loader); $driverManager = new JavaClass("java.sql.DriverManager"); $thiscon = $driverManager->getConnection("jdbc:mysql://xxx/xxx?user=xxx&password=xxx"); Yields the error: PHP Fatal error: Uncaught [[o:Exception]:"java.lang.Exception: Invoke failed: [[c:DriverManager]]->getConnection((o:String)[o:String]). Cause: java.sql.SQLException: No suitable driver found for jdbc:mysql://xxx/xxx?user=xxx&password=xxx Responsible VM: 1.6.0_03@http://java.sun.com/" at: #-11 java.sql.DriverManager.getConnection(Unknown Source) #-10 java.sql.DriverManager.getConnection(Unknown Source) #-9 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) #0 C:\Inetpub\wwwroot\app\webroot\test\pjb\java\Java.inc(259): java_ThrowExceptionProxyFactory->getProxy(7, 'php.java.bridge...', true) #1 C:\Inetpub\wwwroot\app\webroot\test\pjb\java\Java.inc(409): java_Arg->getResult(true) #2 C:\Inetpub\wwwroot\app\webroot\test\pjb\java\Java.inc(415): java_Client->getWrappedResult(true) #3 C:\Inetpub\wwwroot\app\webroot\test\pjb\java\Java.inc(619): java_Client->getResult() #4 C:\Inetpub\wwwroot\app\webroot\test\pjb\java\Java.inc(1730): java_Client->invokeMethod(6, 'getConnection', Array) #5 C:\Inetpub\wwwroot\app\webroot\test\ in C:\xxx\pjb\java\Java.inc on line 222 Im not sure what im doing wrong, it appears the java_require call is finding the file because if i change the path i get an error. Regards, Phillip Savage php...@li... wrote: > Hi, > > >> Forgive me if i am blind, but I can't find anything in the FAQ located >> at http://php-java-bridge.sourceforge.net/pjb/faq.php >> > > the up-to-date FAQ is here: > > http://php-java-bridge.cvs.sourceforge.net/*checkout*/php-java-bridge/php-java-bridge/FAQ.html > > I think > > java_require ("yourDriver.jar"); > $Clazz = java("java.lang.Class"); > $loader = java("java.lang.Thread")->currentThread()->getContextClassLoader(); > $Clazz->forName("yourDriver", true, $loader); > > should do what you want. > > > Regards, > Jost Boekemeier > > > > > Machen Sie Yahoo! zu Ihrer Startseite. Los geht's: > http://de.yahoo.com/set > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > php-java-bridge-users mailing list > php...@li... > https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users > |