help using Java and jdbc driver

From: Date: Mon, 31 Jan 2000 19:41:36 +0000
Subject: help using Java and jdbc driver
Groups: php.version4 
Request: Send a blank email to php-version4+get-9599@lists.php.net to get a copy of this message
I'm trying to use the php Java stuff to compare a jsp and php page, but get errors all over. These 2 files are trying to use a JDBC driver on a db to extract the data. I know I could use the direct access, but I want a code comparison for the most part. this is what my php code looks like, any suggestions? $driver = new Java("java.lang.Class.forName", "org.gjt.mm.mysql.Driver"); $inst = new Java($driver->newInstance); $conn = new Java("java.sql.DriverManager.getConnection", "jdbc:mysql://localhost/php?user=phpuser&password=php"); $stat = new Java($conn->createStatement); $res = new Java($stat->executeQuery, "select * from auth_user"); $metaData = new Java("java.sql.ResultSetMetaData"); $metaData = $res->getMetaData() ; jsp looks like this and works: <%@ page import="java.sql.*" %> <% Class.forName ("org.gjt.mm.mysql.Driver").newInstance(); Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/php?user=phpuser&pas sword=php"); Statement statement = connection.createStatement(); ResultSet resultSet = statement.executeQuery("select * from auth_user"); ResultSetMetaData metaData = null ; %> ini Java lines: [Java] java.library=/usr/lib//kaffe/libkaffevm.so java.library.path=/usr/lib/kaffe:/tmp/al/php4/modules java.class.path=/usr/share/kaffe/Klasses.jar:/tmp/al/php4/ext/java/php_j ava.jar:/home/httpd/classes/mysql_uncomp.jar extension_dir=/usr/lib/php/modules extension=libphp_java.so it gives error or blowing-up and error_log says: Internal error. Please check your CLASSPATH and your installation. Exception thrown was of type `Java/lang/NullPointerException' NULL message php error: Parse error: parse error, expecting T_STRING' or T_VARIABLE' or `'{'' or `'$'' in /home/httpd/html/php/dbDemo.php on line 20 *********************************** AL Lewis Systems Engineer Evolutionary Systems Inc. http://www.es-inc.com (831)392.1092 (831)392.1192 fax

« previous php.version4 (#9599) next »