DB with odbc under windows using Access 2000
| From: | Terence | Date: | Thu, 06 Feb 2003 02:52:46 +0000 |
| Subject: | DB with odbc under windows using Access 2000 | ||
| Groups: | php.pear.general | ||
| Request: | Send a blank email to pear-general+get-3617@lists.php.net to get a copy of this message | ||
I have the following code which works fine
$foo = odbc_connect("sops","","");
$res = odbc_exec($foo,"select * from tasks");
$arr = odbc_result_all($res);
So it's safe to say that I have no problem connecting to my database.
Of course, I'd prefer to use DB instead, but the following code does not work.
class sopsDb {
var $strUser ="";
var $strPass ="";
var $strDBname = "sops";
var $strHost = "localhost";
var $strDbType = "odbc";
var $dsn;
var $db;
function sopsDb() {
$this->dsn =
$this->strDbType."://"
// .$this->strUser.":"
// .$this->strPass."@"
.$this->strHost."/"
.$this->strDBname
;
if (DB::isError($this->db = DB::connect($this->dsn)))
die($this->db->getMessage().":<br>".$this->db->getUserinfo());
}
}
$objDB = new sopsDb;
I get a connection error that says
[nativecode=IM002 [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified] ** odbc://localhost/sops
does anyone know what the problem may be?