Urgent!! Does PHP Java supports JDBC?

From: Date: Wed, 18 Oct 2000 02:10:53 +0000
Subject: Urgent!! Does PHP Java supports JDBC?
Groups: php.pear 
Request: Send a blank email to php-pear+get-403@lists.php.net to get a copy of this message
Hi,PEAR: Recently I set up my php to support Java, and it does support some easy functions. But when I want to connect to a Oracle server through JDBC, it crashes. I hope anyone can give me a hint a.s.a.p. It's urgent for me. Error Message: IE always resports the message: "oracle.jdbc.driver.OracleDriver" Below is the source: 1: Sources of PHP, it's so easy. <? $b = new Java("tests.test3") or die ("Error!"); $s = $b->getUserNM("0000001"); echo $s; ?> 2: Sources of test3.java, it's a little long. But I can get the right answer if I run it with java.exe. package tests; import java.util.*; import java.sql.*; public class test3 { /* public static void main(String[] args){ log(getUserNM("0000001")); } */ public String getUserNM(String sUserID) { String sTmp = ""; Connection Connrs = null; PreparedStatement Statementrs = null; ResultSet rs = null; try { sUserID = sUserID.trim(); Driver Driverrs = (Driver)Class.forName("oracle.jdbc.driver.OracleDriver").newInstance(); Connrs = DriverManager.getConnection("jdbc:oracle:thin:@192.168.0.100:1521:ORCL","SCOTT","TIGER"); Statementrs = Connrs.prepareCall("select ProdNM from productmst WHERE rTrim(ProdCD) = ? "); Statementrs.setString(1, sUserID); rs = Statementrs.executeQuery(); if (rs.next()) { sTmp = getValue(rs.getString(1)); } else { sTmp = "No Records!"; } } catch (SQLException sqe) { log("getUserNM: SqlException: " + sqe.getMessage()); sqe.printStackTrace(); sTmp = sqe.getMessage(); } catch (Exception e) { log("Exception: " + e.getMessage()); e.printStackTrace(); sTmp = e.getMessage(); } return sTmp; } private static String getValue(String s) { if(s == null) s = ""; return s.trim(); } private static void log(String s) { System.out.println(s.trim()); } } Regards. Edward Wong wyuanzheng@21cn.com

« previous php.pear (#403) next »