Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Problems inserting rows #34

Closed
adolfoc opened this Issue · 2 comments

2 participants

@adolfoc

Greetings,

I have Oracle Instant Client 11.2.0.3 installed on a MacMini running Mountain Lion (10.8.3). I am able to create, selected and insert into tables from SQLPlus. However, using Ruby 1.9.3p327 and ruby-oci8-2.1.5, I am able to select but not insert. Insert operation returns 1 (I'm assuming that means success), an immediate select returns the row (is it cached on the client?) but the row is not effectively persisted in the database, and a subsequent select from ruby or SQLPlus returns no rows.

I've checked with Wireshark that there is data going to and coming back from the server box (Windows 7 running Oracle Server Personal Edition 11g Release 2).

Any ideas? All help will be greatly appreciated.

Best regards, Adolfo

@kubo
Owner

You need to commit the transaction.

conn = OCI8.new(username, password, database)
conn.exec('insert into table_name values (:1, :2)', 'foo', 'bar')
conn.commit  # The inserted row is invisible from other connections unless the transaction is committed.
@adolfoc

Yup, that did it. I was looking for a commit method on cursor and never found it. Thank you very much.

@adolfoc adolfoc closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.