php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #4648 odbc and oci8 can't link to dbase
Submitted: 2000-05-28 03:25 UTC Modified: 2000-06-20 12:46 UTC
From: znsoft at sy163 dot net Assigned:
Status: Closed Package: ODBC related
PHP Version: 4.0.0 Release OS: windows 98
Private report: No CVE-ID: None
 [2000-05-28 03:25 UTC] znsoft at sy163 dot net
<?php
//////////////////////////////////////////////////////////////////////////////////
//ԭʼ?ļ?????odbc.php4
//??      ?ߣ?mayong
//??      ?ڣ?
//??      ;??odbc tester
/////////////////////////////////////////////////////////////////////////////////

$conn = odbc_connect("xxcx", "xxcx", "xxcx");
$query = "select userid,sortid from subscibe";

$result_id = odbc_do($conn, $query);
while(odbc_fetch_row($result_id)) {
  $user = odbc_result($result_id, 1);
  $idno = odbc_result($result_id, 2);
  echo $user."??????֤?ֺ?Ϊ".$idno."<br>\n";
}
odbc_close($conn);
?> 
//above is odbc linking
Threr is a DSN of name "xxcx" in odbc of my machine.
this file is renamed to odbc.php3 ,it can normal running!

error information after run above script:
Warning: SQL error: [Microsoft][ODBC driver for Oracle][Oracle]ORA-12154: TNS:could not resolve service name, SQL state 08001 in SQLConnect in e:\my\odbc.php4 on line 9


<?php
  /* OCIDefineByPos example thies@digicol.de (980219) */
 
  $conn = OCILogon("XXCX","xxcx","xxcx");
  
  $stmt = OCIParse($conn,"select * from reguser where userid='znsoft'");
  
  /* the define MUST be done BEFORE ociexecute! */
  
  OCIDefineByName($stmt,"USERID",&$empno);
  OCIDefineByName($stmt,"PASSWORD",&$ename);
  
  OCIExecute($stmt);
  
  while (OCIFetch($stmt)) {
      echo "empno:".$empno."\n";
      echo "ename:".$ename."\n";
  }
  
  OCIFreeStatement($stmt);
  OCILogoff($conn);
  ?>
//above is oci8 linking
this file is renamed to test.php3 ,it can normal running!
error information after run above script
Warning: _oci_open_server: ORA-12154: TNS:could not resolve service name in e:\my\test.php4 on line 5


//a part of php.ini file
;Windows Extensions
;extension=php_sybase_ct.dll
;extension=php_mysql.dll
;extension=php_nsmail.dll
;extension=php_dbase.dll
;extension=php_filepro.dll
;extension=php_dbm.dll
;extension=php_mssql65.dll
;extension=php_mcrypt.dll
;extension=php_msql2.dll
;extension=php_odbc.dll
extension=php_exif.dll
;extension=php_swf.dll
extension=php_ftp.dll
extension=php_calendar.dll
extension=php_oracle.dll
extension=php_gd.dll
extension=php_zlib.dll
extension=php_imap.dll
extension=php_ldap.dll
extension=php_java.dll
extension=php_oci8.dll
;;;;;;;;;;;;;;;;;;;

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-06-20 12:46 UTC] kara at cvs dot php dot net
Check your ODBC/Oracle setup, esp. that the oracle
environment is correct.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Wed Jun 17 16:00:02 2026 UTC