This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use the new forum.
Home » support » Installation and setup » Instaling and Setup Symfony 1.2 project to work with Oracle database 10g
icon7.gif  Instaling and Setup Symfony 1.2 project to work with Oracle database 10g [message #73748] Sun, 01 March 2009 17:25 Go to next message
dalibor983  is currently offline dalibor983
Messages: 10
Registered: March 2009
Location: Serba
Junior Member
Is anyone know how to setup Symfony 1.2 project to work with Oracle database 10g?

I tryed everything I found on Google bat nothing worked.

Please help.
Re: Instaling and Setup Symfony 1.2 project to work with Oracle database 10g [message #73809 is a reply to message #73748 ] Mon, 02 March 2009 10:46 Go to previous messageGo to next message
halfer  is currently offline halfer
Messages: 9535
Registered: January 2006
Location: West Midlands, UK
Faithful Member
Post what you have already - your databases.yml file - and we'll go from there Very Happy


Remember Palestine
Re: Instaling and Setup Symfony 1.2 project to work with Oracle database 10g [message #73899 is a reply to message #73809 ] Mon, 02 March 2009 23:29 Go to previous messageGo to next message
dalibor983  is currently offline dalibor983
Messages: 10
Registered: March 2009
Location: Serba
Junior Member
Let's start!

This is my databases.yml file:
dev:
  propel:
    param:
      classname: DebugPDO
test:
  propel:
    param:
      classname: DebugPDO
all:
  propel:
    class: sfPropelDatabase
    param:
      classname: PropelPDO
      phptype: oracle
      dsn: 'oci:host=localhost;dbname=xe'
      username: myusername
      password: 'pass'
      encoding: utf8
      persistent: true
      pooling: true


and propel.ini file
propel.targetPackage       = lib.model
propel.packageObjectModel  = true
propel.project             = OraclePHP
propel.database            = oracle
propel.database.driver     = oci
propel.database.url        = oci:host=localhost;dbname=xe
propel.database.creole.url = ${propel.database.url}
propel.database.user       = myusername
propel.database.password   = pass

; mysql options
; propel.mysql.tableType     = InnoDB

propel.addVendorInfo       = true
propel.addGenericAccessors = true
propel.addGenericMutators  = true
propel.addTimeStamp        = true
propel.addValidators       = false

propel.useDateTimeClass       = true
propel.defaultTimeStampFormat = Y-m-d H:i:s
propel.defaultTimeFormat      = H:i:s
propel.defaultDateFormat      = Y-m-d

propel.schema.validate        = false
propel.samePhpName            = false
propel.disableIdentifierQuoting     = false
propel.emulateForeignKeyConstraints = true

; directories
propel.home                    = .
propel.output.dir              = C:\WampPHP\www\dev
propel.schema.dir              = ${propel.output.dir}/config
propel.conf.dir                = ${propel.output.dir}/config
propel.phpconf.dir             = ${propel.output.dir}/config
propel.sql.dir                 = ${propel.output.dir}/data/sql
propel.runtime.conf.file       = runtime-conf.xml
propel.php.dir                 = ${propel.output.dir}
propel.default.schema.basename = schema
propel.datadump.mapper.from    = *schema.xml
propel.datadump.mapper.to      = *data.xml

; builder settings
propel.builder.peer.class              = plugins.sfPropelPlugin.lib.builder.SfPeerBuilder
propel.builder.object.class            = plugins.sfPropelPlugin.lib.builder.SfObjectBuilder
propel.builder.objectstub.class        = plugins.sfPropelPlugin.lib.builder.SfExtensionObjectBuilder
propel.builder.peerstub.class          = plugins.sfPropelPlugin.lib.builder.SfExtensionPeerBuilder
propel.builder.objectmultiextend.class = plugins.sfPropelPlugin.lib.builder.SfMultiExtendObjectBuilder
propel.builder.mapbuilder.class        = plugins.sfPropelPlugin.lib.builder.SfMapBuilderBuilder

propel.builder.addIncludes  = false
propel.builder.addComments  = true
propel.builder.addBehaviors = true


and schema.yml file with simple table description
propel:
  dev:
    id: ~
    data: { type: varchar(255) }


Everything went fine:
propel:build-sql generated sql file with sql script for oracle database with some wrong statements like comments with /* and */ and DROP statements that si not necessary when you first time start this script.
When I corected this sql script file propel:insert-sql did his job and it created table in database.

But when I started this project on my local php server (called project in web browser) I got this error:
1.at ()
in SF_ROOT_DIR\lib\vendor\symfony\lib\plugins\sfPropelPlugin\lib\vendor\propel\util\DebugPDO.php line 166 ...

163.    {
164.        $this->log('exec: ' . $sql);
1.        $this->incrementQueryCount();
1.        return parent::exec($sql);
1.    }
2.
3.    /**1.at PDO->exec('SET NAMES 'utf8'')in SF_ROOT_DIR\lib\vendor\symfony\lib\plugins\sfPropelPlugin\lib\vendor\propel\util\DebugPDO.php line 166 ...    {
        $this->log('exec: ' . $sql);
        $this->incrementQueryCount();        return parent::exec($sql);
    }

    /**1.at DebugPDO->exec('SET NAMES 'utf8'')in SF_ROOT_DIR\lib\vendor\symfony\lib\plugins\sfPropelPlugin\lib\vendor\propel\adapter\DBAdapter.php line 123 ...     */
    public function setCharset(PDO $con, $charset)    {        $con->exec("SET NAMES '" . $charset . "'");    }    
/**1.at DBAdapter->setCharset(object('DebugPDO'), 'utf8')in SF_ROOT_DIR\lib\vendor\symfony\lib\plugins\sfPropelPlugin\lib\vendor\propel\adapter\DBAdapter.php line 100 ...


I also get this error when start propel:data-load to import some data in my table form fixtures.yml file:
General error: 922 OCIStmtExecute: ORA-00922: missing or invalid option
(ext\pdo_oci\oci_driver.c:343)


It is seem that project tries to execute SET NAMES 'utf8' on oracle database what is inpossible because that commands does not present in oracle database.

What can I do?
Re: Instaling and Setup Symfony 1.2 project to work with Oracle database 10g [message #73920 is a reply to message #73748 ] Tue, 03 March 2009 10:31 Go to previous messageGo to next message
halfer  is currently offline halfer
Messages: 9535
Registered: January 2006
Location: West Midlands, UK
Faithful Member
It looks like your propel.ini is fine, as you say it connects to the database through the command line. However try removing the 'dev' and 'test' clauses in the databases.yml file; it seems that it is having difficulty with the DebugPDO driver. Clear your cache, and see if that helps. I would try removing the PropelPDO classname too - I am not sure if that is a child key *and* a grandchild key of all->propel.

For ref, this is what I have on Propel 1.2 for Oracle 10g. Maybe it will help:

all:
  internet_db:
    class:          sfPropelDatabase
    param:
      datasource:   schema
      phptype:      oracle
      hostspec:     oracle.ukl
      username:     myuser
      password:     mypass
      persistent:   true

I dare say you will be using Propel 1.3, so bear in mind it may be different.


Remember Palestine
icon10.gif  Re: Instaling and Setup Symfony 1.2 project to work with Oracle database 10g [message #73935 is a reply to message #73920 ] Tue, 03 March 2009 12:16 Go to previous messageGo to next message
dalibor983  is currently offline dalibor983
Messages: 10
Registered: March 2009
Location: Serba
Junior Member
I found the solution.

The problem was in something that I thought.

Symfony by default execute SET NAMES '<character_set>' on every database when it starts transaction between symfony and database. But some RDBMS do not support this standard like Oracle Database Express Edition 10g (may be other versions do). So if this is a case you must editi this file:

symfony\lib\plugins\sfPropelPlugin\lib\vendor\propel\adapter \DBAdapter.php

Original:
abstract class DBAdapter {
  ...
	/**
	 * Sets the character encoding using SQL standard SET NAMES statement.
	 *
	 * This method is invoked from the default initConnection() method and must
	 * be overridden for an RDMBS which does _not_ support this SQL standard.
	 *
	 * @param      PDO   A PDO connection instance.
	 * @param      string The charset encoding.
	 * @see        initConnection()
	 */
	public function setCharset(PDO $con, $charset)
	{
		$con->exec("SET NAMES '" . $charset . "'");
	}
  ...
}


Modified:
abstract class DBAdapter {
  ...
	/**
	 * Sets the character encoding using SQL standard SET NAMES statement.
	 *
	 * This method is invoked from the default initConnection() method and must
	 * be overridden for an RDMBS which does _not_ support this SQL standard.
	 *
	 * @param      PDO   A PDO connection instance.
	 * @param      string The charset encoding.
	 * @see        initConnection()
	 */
	public function setCharset(PDO $con, $charset)
	{
		//$con->exec("SET NAMES '" . $charset . "'");
	}
  ...
}


And this is how to resolv this problem. This problem is the bug in Propel 1.3.

Another problem is quotes in generated sql script like this:
CREATE TABLE "name_of_TABLE"

In Oracle statements with quotes is key sensitive.
Later when you call your peoject in web browser propel 1.3 (which is part of symfony 1.2 framework) uses sql quaries without quotes, somethings like this:
SELECT name_of_TABLE.id FROM name_of_TABLE

what in oracle is:
SELECT NAME_OF_TABLE.ID FROM NAME_OF_TABLE

what is error because the table with name NAME_OF_TABLE does not exist.
The right quary would be:
SELECT "name_of_TABLE"."id" FROM "name_of_TABLE"

How this is not case in propel 1.3 you must remove quotes in generated sql script or make all words in uppercase.
It is better way to use second option because you do not care that you use some reserve oracle word for names.
It is good princip to use names for tables, columns etc. with "_" like this MY_TABLE. This is a way how to avoid problems with sql reserved words.

This is another bug in propel 1.3.

Also propel 1.3 have not ORacle parser for reverse engineering but you can find file OracleSchemaParser.php on propel 1.3 home page.

[Updated on: Tue, 03 March 2009 12:33]

Re: Instaling and Setup Symfony 1.2 project to work with Oracle database 10g [message #73946 is a reply to message #73748 ] Tue, 03 March 2009 14:40 Go to previous messageGo to next message
halfer  is currently offline halfer
Messages: 9535
Registered: January 2006
Location: West Midlands, UK
Faithful Member
Quote:

Symfony by default execute SET NAMES '<character_set>' on every database when it starts transaction between symfony and database. But some RDBMS do not support this standard like Oracle Database Express Edition 10g (may be other versions do).

Agreed. The comments in this parent class are:

Quote:

This method is invoked from the default initConnection() method and must be overridden for an RDMBS which does _not_ support this SQL standard.

This means that class DBOracle should extend that method - if it does not then it is a 1.3 bug that should be reported to Propel (have a look and let us know?).

Quote:

In Oracle statements with quotes is key sensitive.

Yes, I have discovered this. I solved this by maintaining my tables manually: we add in columns manually, amend the schema and rebuild the model. I would imagine that the Propel team know about this already, but nevertheless it is worth seeing if a ticket has been raised on it.

Incidentally although these items affect symfony, they are not symfony bugs per se. The upshot of this is that they should be reported on the Propel trac, not the symfony trac. Noting them here is fine for discussion, but not sufficient for them to get noticed by the right people Smile


Remember Palestine
Re: Instaling and Setup Symfony 1.2 project to work with Oracle database 10g [message #77643 is a reply to message #73935 ] Fri, 01 May 2009 22:26 Go to previous messageGo to next message
pkwooster  is currently offline pkwooster
Messages: 40
Registered: May 2008
Member
These are still problems with Oracle and Propel 1.3, I'm using the versions bundled with Symfony 1.2.7-DEV.

Driver name: the name required for PDO is oci: but the name required for propel is oracle. Inserted after line 60 in DBAdapter:
'oci' => 'DBOracle', // PKW May 1 2009

setCharSet not overriden in DBOracle, even though Oracle does not support the SET NAMES function. Added null override.

I'm sure there's more, is Propel 1.3 ready for prime time with Oracle?
Re: Instaling and Setup Symfony 1.2 project to work with Oracle database 10g [message #78284 is a reply to message #73748 ] Wed, 13 May 2009 16:49 Go to previous messageGo to next message
pkwooster  is currently offline pkwooster
Messages: 40
Registered: May 2008
Member
An update on Oracle support in Symfony 1.2 can be found in:

http://forum.symfony-project.org/index.php/t/20577/

I have it working, but it requires a number of patches that are described in that topic.
Re: Instaling and Setup Symfony 1.2 project to work with Oracle database 10g [message #102814 is a reply to message #73748 ] Tue, 20 July 2010 17:25 Go to previous message
halfer  is currently offline halfer
Messages: 9535
Registered: January 2006
Location: West Midlands, UK
Faithful Member
The 'SET NAMES' problem in Propel against an Oracle database appears to still be an issue. I am experiencing it in Propel 1.4 but, having looked at the 1.5 codebase, imagine that I would experience it there too (there is another problem that is preventing me from trying this).

I am even more surprised that a ticket has not already been raised on this. I've therefore documented my experience on a ticket here, and hopefully this thread will attract comments from anyone else in the same boat.

[Updated on: Tue, 20 July 2010 17:47]


Remember Palestine
Previous Topic:installation with ubuntu 10.4
Next Topic:Symfony on Shared Hosting
Goto Forum:
  

powered by FUDforum - copyright ©2001-2004 FUD Forum Bulletin Board Software