Oracle insert

42 views
Skip to first unread message

Antonio Diaz

unread,
May 1, 2019, 10:32:42 PM5/1/19
to Fat-Free Framework
Hi,

I'm having issues inserting data into Oracle, does anybody know the trick to make this happen?

I covered the basics.

My username has the privileges to insert data into the database
I can search and read from the same instance
I created a table with the sequence and the constrain
I'm able to insert data using SQLdeveloper
I'm able to insert data using the "insert into <table> [fields] values (); command from F3

what I would like to do, is to insert data using copyFrom('POST') and save() commands built into the F3 SQL library; just like in MySQL and MS SQL

Thank you

Antonio


ikkez

unread,
May 2, 2019, 3:45:06 AM5/2/19
to Fat-Free Framework
have you tried to use the sql mapper in f3? if so but fails, whats the issue / error?

Antonio Diaz

unread,
May 5, 2019, 8:52:19 AM5/5/19
to Fat-Free Framework
ikkez:

Thank you for your reply, yes I'm using the mapper, i have no error and the debug parameter is on 3, I created a few errors on purpose because it doesn't throw an error on you, for example I change the table name and it threw "table does not exist". I believe is doing the insert but without the commit; so no error but it doesn't write to the table. On SQLdeveloper if you insert, you can't see the data if you don't commit.

All speculation on my part, thank you for your help.

Antonio

ikkez

unread,
May 5, 2019, 12:05:02 PM5/5/19
to Fat-Free Framework
which driver are you using in your DSN connection string for the database. ODBC?

@eazuka

unread,
May 15, 2019, 12:44:09 PM5/15/19
to Fat-Free Framework
I was about asking Oracle related question when i saw this, hence my i'm posting here instead of opening a new post.

My question is more inline of does F3 support Oracle out of the box or i need an external library to use Oracle DB?

ikkez

unread,
May 16, 2019, 9:21:25 AM5/16/19
to Fat-Free Framework
it should support it out of the box with odbc pdo driver

Antonio Diaz

unread,
May 19, 2019, 6:01:05 PM5/19/19
to Fat-Free Framework
ikkez:

Sorry for the delay, the app is running, but the old fashion way. here is the connection string

$dc=new DB\SQL('oci:dbname=//10.229.xxx.xx:1521/uniorcl','user','pass');

the insert command is...

public function add($su,$see,$say,$fn,$ln,$s1,$s2,$s3,$s4,$s5,$s6,$s7,$s8) {
        $query  = "INSERT INTO subo (field1,field2,,field3,field4,field5,field6,field7,field8,field9,field10,field11,field12,field13) ";
        $query .= "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)";
        $result = $this->db->exec($query,array($su,$see,$say,$fn,$ln,$s1,$s2,$s3,$s4,$s5,$s6,$s7,$s8));
        // $this->copyFrom('POST');
        // $this->save();
    }

As you can see the copyFrom and save() is disable, but the exec() does the job! 

Instant client is 12.1
PHP is 7.0.33

DB modules available in PHP
mysqli
mysqlnd
oci8
openssl
pcntl
pcre
PDO
pdo_mysql
PDO_OCI
pdo_sqlite
pdo_sqlsrv


Thank you

ikkez

unread,
May 20, 2019, 5:21:44 AM5/20/19
to Fat-Free Framework
If you have trouble with the oci driver, try the pdo_odbc driver with oracle.
Reply all
Reply to author
Forward
0 new messages