there are some things we need to prepare
- make sure our web server already supports connections to Oracle databases by checking through browser.with create a some *.php file with the contents
<?;and you will see a description like in the picture below
phpinfo();
?>
if the information is there then there is ready to work with Oracle database.or if not then you need to set up your web server settings .. see how web servers work with the Oracle database this link
Connection Parameters
Not all of the parameters in application/config/database.php are used as one might expect. Namely, $db[‘default’][‘database’] isn’t used at all. The value used for $db[‘default’][‘hostname’] depends on whether the Oracle client’s tnsnames.ora file exists and contains information about the database to be used. If the file exists and is configured for the intended database, this parameter should be set to the symbolic name. Otherwise, it should be set to a single string of the connection parameters that tnsmames.ora would normally contain.An example of connection parameters for the latter case:
$db[
'default'
][
'hostname'
]
=
'(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbhost.example.com)(PORT=1521))(CONNECT_DATA=(SID=dbsid)))'
;
$db[
'default'
][
'username'
]
=
'dbuser'
;
$db[
'default'
][
'password'
]
=
'dbpassword'
;
$db[
'default'
][
'database'
]
=
''
;
// not used by this Oracle driver
$db[
'default'
][
'dbdriver'
]
=
'oci8'
;
Different queries return the same results
If you run two different queries in the same script you can run into the problem, that both queries return the same result.Example
$this
->
load
->
database
();
$query1
=
$this
->
db
->
query
(
"SELECT * FROM table1"
);
$result1
=
$query1
->
result
();
// Returns Value of table 1
$query1
->
free_result
();
$query2
=
$this
->
db
->
query
(
"SELECT * FROM table2"
);
$result2
=
$query2
->
result
();
// Also returns Value of table 1
Solution
In file codeigniter/database/driver/oci8/oci8_driver.php you should change the linesfunction
_set_stmt_id
(
$sql
)
{
if ( !
is_resource
(
$this
->
stmt_id
))
{
$this
->
stmt_id
=
ociparse
(
$this
->
conn_id
,
$this
->
_prep_query
(
$sql
));
}
}
function
_set_stmt_id
(
$sql
)
{
$this
->
stmt_id
=
ociparse
(
$this
->
conn_id
,
$this
->
_prep_query
(
$sql
));
}
happy CI..^_^
No comments:
Post a Comment