fellow RAQer
|
| Posted: 06/17/2002, 12:59 PM |
|
In Codecharge site properties, do i select "ODBC" to connect to Interbase? Anyone using Interbase out there? any other advice?
|
|
|
 |
Barry
|
| Posted: 06/17/2002, 3:23 PM |
|
I got it working using a reliable ODBC driver for IB. EasySoft makes one and they give you a trial
version you can try out. The free IB ODBC drivers have bugs in them (I guess that's why they're free)
My question to you is, why would you want to use IB?
|
|
|
 |
Nicole
|
| Posted: 06/18/2002, 7:48 AM |
|
Hello,
CC allows connection if Interbase provides interface to phplib(db abstraction layer used by CC),
i.e. if there is implementation of db_sql class for Interbase for phplib.
You should search the net for phplib support for interbase.
The server side database connection supported for PHP are listed under the connection settings are:mSQL, MySQL, MSSQL, Oracle, Oracle OCI, PostgreSQL, Sybase and ODBC. In the case of Interbase, you would need to create an ODNC DSN for the database then make the connection using the DSN.
|
|
|
 |
FellowRAQer
|
| Posted: 06/18/2002, 9:36 AM |
|
I have Interbase preinstalled on my Cobalt RAQ and was wondering if it would be easier to use than the mySQL I have installed, but not quite configured as I want. Now I'm thinking I'll invest the time in getting mySQL configured. Thanks for the advice!
|
|
|
 |
Barry
|
| Posted: 06/18/2002, 11:37 AM |
|
>>I have Interbase preinstalled on my Cobalt RAQ and was wondering if it would be easier to use
>>than the mySQL I have installed, but not quite configured as I want. Now I'm thinking I'll invest
>>the time in getting mySQL configured. Thanks for the advice!
The main advantage of MySQL is it is easier to use than IB and there are tons
of books on MySQL with PHP, ASP, and JSP. Take a look at "MySQL" by Paul Dubois
and if you're doing PHP there is "PHP and MySQL Web Development" by Luke Welling
and Lara Thompson.
If you want record locking you will need to use MySQL's Innodb table type.
Unfortunately MySQL does not yet support stored procedures so you will need
to implement that in code. Stored Procedures will be in version 4.1 due out next year.
|
|
|
 |
Dmitry Avedov
|
| Posted: 02/28/2003, 1:41 AM |
|
I have found solve for connect to Interbase from PHP (Blob supported also)
Action:
1. Make New Connection
1.1. database: any (i use informix)
1.2. In [design]->[Using Connection String] for example:
DRIVER=INTERSOLV InterBase ODBC Driver (*.gdb);DB=192.168.238.201:C:\www\databases\NALOG2000.gdb;CharacterSet=WIN1251
You must install [INTERSOLV InterBase ODBC Driver] for design connection. This driver is free and included in Firebird
1.3. Specify username and password
1.4. In [Server]:
a)PHP database Library: ODBC
b)Database: Informix
c)Database or ODBC connection name: any
d)Host: ip_address:/path/to/database.gdb
for example on windows server: 192.168.238.201:C:\www\databases\nalog2000.GDB
on UNIX server: 192.168.238.183:/var/www/databases/sm.gdb
e)Login: interbase login [sysdba]
f)Password: [password]
2. in the [Common Files] select [Common.php] and change class:
for example:
class cls_Any_NAME extends DB_ODBC
to:
class cls_Any_NAME extends DB_ibase
3. in the [Common Files] select [db_odbc.php] make this changes:
a) select all class (without comments) from
class DB_ODBC {
....
...
}
and replase to text below
-----------------------------------
class DB_ibase {
var $Host = "";
var $Database = "";
var $User = "";
var $Password = "";
var $Persistent = false;
var $Link_ID = 0;
var $Query_ID = 0;
var $Record = array();
var $Row = 0;
var $Errno = 0;
var $Error = "";
var $Auto_Free = 0; ## set this to 1 to automatically free results
/* public: constructor */
function DB_Sql($query = "") {
$this->query($query);
}
function try_connect()
{
if($this->Persistent)
$this->Link_ID = @ibase_pconnect($this->Host, $this->User, $this->Password, 'WIN1251');
else
$this->Link_ID = @ibase_connect($this->Host, $this->User, $this->Password, 'WIN1251');
$is_connect = $this->Link_ID ? true : false;
return $is_connect;
}
function connect() {
if ( 0 == $this->Link_ID ) {
if($this->Persistent)
$this->Link_ID=ibase_pconnect($this->Host, $this->User, $this->Password, 'WIN1251');
else
$this->Link_ID=ibase_connect($this->Host, $this->User, $this->Password, 'WIN1251');
if (!$this->Link_ID)
$this->halt("Link-ID == false, ibase_pconnect failed");
## else
## ibase_select_db($this->Database, $this->Link_ID);
}
}
function free_result() {
ibase_free_result($this->Query_ID);
$this->Query_ID = 0;
}
function query($Query_String)
{
/* No empty queries, please, since PHP4 chokes on them. */
if ($Query_String == "")
/* The empty query string is passed on from the constructor,
* when calling the class without a query, e.g. in situations
* like these: '$db = new DB_Sql_Subclass;'
*/
return 0;
if (!$this->Link_ID)
$this->connect();
# printf("<br>Debug: query = %s<br>\n", $Query_String);
$this->Query_ID = ibase_query($this->Link_ID, $Query_String);
$this->Row = 0;
if (!$this->Query_ID) {
$this->Errno = 1;
$this->Error = "General Error (The ibase interface cannot return detailed error messages).";
$this->halt("Invalid SQL: ".$Query_String);
}
return $this->Query_ID;
}
function next_record() {
if ($this->Record = ibase_fetch_row($this->Query_ID)) {
// add to Record[<key>]
$count = ibase_num_fields($this->Query_ID);
for ($i=0; $i<$count; $i++){
$fieldinfo = ibase_field_info($this->Query_ID,$i);
$fieldtype = $fieldinfo['type'];
if ($fieldtype!="BLOB") {
$this->Record[strtolower($fieldinfo['name'])] = $this->Record[$i];
}
else {
$blob_name=$fieldinfo['name'];
## echo $blob_name."<br>";
$blob_id = ibase_blob_open($this->Record[$i]);
$blob_res = "";
while ($piece=ibase_blob_get($blob_id,rand()*1024)) {
$blob_res .= $piece ;
}
$blob_id = ibase_blob_close($blob_id);
$this->Record[strtolower($fieldinfo['name'])] = $blob_res;
};
}
$this->Row += 1;
$stat = 1;
} else {
if ($this->Auto_Free) {
$this->free_result();
}
$stat = 0;
}
return $stat;
}
function seek($pos) {
ibase_data_seek($this->Query_ID,$pos);
$this->Row = $pos;
}
function metadata($table) {
$count = 0;
$id = 0;
$res = array();
$this->connect();
$id = ibase_query("select * from $table", $this->Link_ID);
if (!$id) {
$this->Errno = 1;
$this->Error = "General Error (The ibase interface cannot return detailed error messages).";
$this->halt("Metadata query failed.");
}
$count = ibase_num_fields($id);
for ($i=0; $i<$count; $i++) {
$info = ibase_fetch_field($id, $i);
$res[$i]["table"] = $table;
$res[$i]["name"] = $info["name"];
$res[$i]["len"] = $info["max_length"];
$res[$i]["flags"] = $info["numeric"];
}
$this->free_result();
return $res;
}
function affected_rows() {
return ibase_affected_rows($this->Query_ID);
}
function num_rows() {
return ibase_num_rows($this->Query_ID);
}
function num_fields() {
return ibase_num_fields($this->Query_ID);
}
function nf() {
return $this->num_rows();
}
function np() {
print $this->num_rows();
}
function f($Field_Name) {
return $this->Record[strtolower($Field_Name)];
}
function p($Field_Name) {
print $this->f($Field_Name);
}
function close()
{
if ($this->Link_ID != 0 && !$this->Persistent) {
ibase_close($this->Link_ID);
$this->Link_ID = 0;
}
}
function close_all()
{
if ($this->Link_ID != 0 && !$this->Persistent) {
ibase_close($this->Link_ID);
$this->Link_ID = 0;
}
}
function halt($msg) {
printf("</td></tr></table><b>Database error:</b> %s<br>\n", $msg);
printf("<b>ibase Error</b>: %s (%s)<br>\n",
$this->Errno,
$this->Error);
die("Session halted.");
}
}
-----------------------------------
i tested it on Windows and RedHat platforms - works right.
If have some questions write me:adsoft@mail.ru
P.S. Sorry my bad English 
|
|
|
 |
|