|
From: <php...@li...> - 2008-01-07 05:21:03
|
G'day,
Ive tried all sorts of things and im starting to pull my hair out.
Im trying to create a JDBC Connection with php-java-bridge which i can
pass to BIRT to override the reports connection.
The code i started with is bellow:
$class = new JavaClass("java.lang.Class");
$class->forName("com.mysql.jdbc.Driver");
$driverManager = new JavaClass("java.sql.DriverManager");
$conn =
$driverManager->getConnection("jdbc:mysql://xxxx/xxxx?user=xxx&password=xxxx");
Which gave me a class not found on the forName call. The wierd thing is
i can instantiate a driver object manually by typing $driver = new
Java("com.mysql.jdbc.Driver"); so obviously php-java-bridge can see the
class file.
I'm at a loss as to what the problem is right now, here is a quick run
down of the things I've tried so far:
* Getting the current thread & using the context class loader
$thread = java("java.lang.Thread")->currentThread();
$class->forName("com.mysql.jdbc.Driver",true,$thread->getContextClassLoader());
* Just instantiating the driver as normal (java.sql.SQLException: No
suitable driver found thrown)
* Creating an instance of the driver and calling
$driverManager->registerDriver($driver) (java.sql.SQLException: No
suitable driver found thrown)
Any help would be appreciated,
Regards,
Phillip Savage
|