Welcome Guest, Not a member yet? Register   Sign In
How do I connect CodeIgniter in oracle using XAMPP?

So I have a school project in database. We need to create a database for a company my project was connected to MySQL but then my teacher says we need to use Oracle. So I tried to look for an answer but I fail. I tried to find old topics here but it doesn't work. First I tried to connect xampp in oracle by removing the semicolon (Wink into php.ini extension=php_oci8_11g.dll but I've got an error.

"PHP Startup: Unable to load dynamic library 'C:\xampp\php\ext\php_oci8.dll' - %1 is not a valid Win32 application" I'm running it in windows 8.1 64bit

I still haven't tried adding the environmental path since I don't know where.

Here's my database.php

<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    | -------------------------------------------------------------------
    | -------------------------------------------------------------------
    | This file will contain the settings needed to access your database.
    | For complete instructions please consult the 'Database Connection'
    | page of the User Guide.
    | -------------------------------------------------------------------
    | -------------------------------------------------------------------
    |   ['hostname'] The hostname of your database server.
    |   ['username'] The username used to connect to the database
    |   ['password'] The password used to connect to the database
    |   ['database'] The name of the database you want to connect to
    |   ['dbdriver'] The database type. ie: mysql.  Currently supported:
                 mysql, mysqli, postgre, odbc, mssql, sqlite, oci8
    |   ['dbprefix'] You can add an optional prefix, which will be added
    |                to the table name when using the  Active Record class
    |   ['pconnect'] TRUE/FALSE - Whether to use a persistent connection    
    |   ['db_debug'] TRUE/FALSE - Whether database errors should be displayed.
    |   ['cache_on'] TRUE/FALSE - Enables/disables query caching
    |   ['cachedir'] The path to the folder where cache files should be stored
    |   ['char_set'] The character set used in communicating with the database
    |   ['dbcollat'] The character collation used in communicating with the database
    |                NOTE: For MySQL and MySQLi databases, this setting is only used
    |                as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7
    |                (and in table creation queries made with DB Forge).
    |                There is an incompatibility in PHP with mysql_real_escape_string() which
    |                can make your site vulnerable to SQL injection if you are using a
    |                multi-byte character set and are running versions lower than these.
    |                Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
    |   ['swap_pre'] A default table prefix that should be swapped with the dbprefix
    |   ['autoinit'] Whether or not to automatically initialize the database.
    |   ['stricton'] TRUE/FALSE - forces 'Strict Mode' connections
    |                           - good for ensuring strict SQL while developing
    | The $active_group variable lets you choose which connection group to
    | make active.  By default there is only one group (the 'default' group).
    | The $active_record variables lets you determine whether or not to load
    | the active record class

    $active_group = 'default';
    $active_record = TRUE;

    $tnsname = '(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

    $db['default']['hostname'] = '$tnsname';
    $db['default']['username'] = 'xxxxxxx'; //what's this? the username of what?
    $db['default']['password'] = 'xxxxxxx'; // this the password for oracle?
    $db['default']['database'] = 'hr';
    $db['default']['dbdriver'] = 'oci8';
    $db['default']['dbprefix'] = '';
    $db['default']['pconnect'] = TRUE;
    $db['default']['db_debug'] = TRUE;
    $db['default']['cache_on'] = FALSE;
    $db['default']['cachedir'] = '';
    $db['default']['char_set'] = 'utf8';
    $db['default']['dbcollat'] = 'utf8_general_ci';
    $db['default']['swap_pre'] = '';
    $db['default']['autoinit'] = TRUE;
    $db['default']['stricton'] = FALSE;

    /* End of file database.php */
    /* Location: ./application/config/database.php */

Hope fully you guys will help me. Thanks!

Try alternative php_ocix.dll, I had impression that you have installed incorrect version of the Oracle driver. These DLLs are built with
VC dependencies.

It's been a while since I've connected PHP to Oracle (or had Windows as my dev environment) but try installing oci8 via PECL and uncomment the oci8 extension in php.ini corresponding to your version of Oracle as detailed in http://php.net/manual/en/oci8.installation.php.

To answer your question within your database.php file, fill in the username and password that you use to connect to your Oracle instance. If your school provided you with a remote Oracle database to connect to, you should use the credentials they gave you. If you installed Oracle yourself, it should have asked you to set up a username and password during installation. You should also remove the single quotes around $tnsname in this line since PHP would treat that as a string: $db['default']['hostname'] = '$tnsname';

I already solved the problem. I downloaded the install client for the oracle 11g, and add some new environment paths and removed the ; and it works! Thanks!

Theme © iAndrew 2016 - Forum software by © MyBB