[SOLVED]Connect with Oracle DB

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
gepponline
Posts: 91
Joined: Tue Sep 03, 2013 1:53 pm

[SOLVED]Connect with Oracle DB

Post by gepponline » Wed Sep 24, 2014 2:09 pm

Hi!
I'm new with LiveCode and I'm developing my first app that should read a table from an oracle DB an place the result on a table field or a data grid.
So first of all I have a problem with connection.

Thi is the code of my first card:

Code: Select all

/*this is the connection string I use in another software
 Provider=OraOLEDB.Oracle;Data Source=ORA10G_UX;User ID=myusername;Password=mypassword; */
global tSQL
on Opencard   
   put revOpenDatabase("oracle",OraOLEDB.Oracle, ORA10G_UX, myusername,mypassword) into connID
   put "SELECT * from PROG_MAN " into tSQL
   put revDataFromQuery(tab,return,connID,tSQL) into tRecords
end Opencard
Unfortunatelly it return to me an error:
card "card id 1002": execution error at line n/a (External handler: exception) near "revdberr,invalid connection id"

What's wrong in my code?

Then I place this code in my table script but obviously nothing appear due to connection error.

Code: Select all

on mouseup
   global tRecords
  put tRecords into test
      put test into field "Table field"
end mouseup
Can anyone help me?
Last edited by gepponline on Thu Sep 25, 2014 2:10 pm, edited 1 time in total.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Connect with Oracle DB

Post by Klaus » Wed Sep 24, 2014 2:34 pm

Hi gepponline,

1. welcome to the forum! :D

2. are you using the Community Edition of Livecode?
I think database connection to ORACLE is only supported in the commercial version.


Best

Klaus

gepponline
Posts: 91
Joined: Tue Sep 03, 2013 1:53 pm

Re: Connect with Oracle DB

Post by gepponline » Wed Sep 24, 2014 2:57 pm

Yes...community edition....
Even some other DB connection are available only for commercial version or only the Oracle one?

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Connect with Oracle DB

Post by Klaus » Wed Sep 24, 2014 2:58 pm

Not sure, but I think only Oracle.

gepponline
Posts: 91
Joined: Tue Sep 03, 2013 1:53 pm

Re: Connect with Oracle DB

Post by gepponline » Wed Sep 24, 2014 3:02 pm

So it's an Unlucky start :(

maybe I should start with something else...

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Connect with Oracle DB

Post by Klaus » Wed Sep 24, 2014 3:11 pm

Well, Oracle is a highly commercial product compared to MySQL, SQLite and PostGreSQL, so this is not really surprising...

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Connect with Oracle DB

Post by FourthWorld » Wed Sep 24, 2014 8:09 pm

Klaus nailed it. Oracle has not licensed the interface for their DBs in a way that's compatible with the GPL, which governs LiveCode Community Edition. But pretty much all others LiveCode supports are fully compatible, including SQLite, MySQL, and postgreSQL.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

gepponline
Posts: 91
Joined: Tue Sep 03, 2013 1:53 pm

Re: Connect with Oracle DB

Post by gepponline » Thu Sep 25, 2014 8:33 am

Ok that make sense, but If i want to evaluate a product (in this case with community version) It should not care how and if i have a license for OTHER software. Or not?
Maybe it could be better if it allow me to use it but don't allow me to create executable...or something similar...
However..I'll convert my oracle table in an excel file to make my tests :)
thank you so much!

Geppo!

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: Connect with Oracle DB

Post by MaxV » Thu Sep 25, 2014 1:27 pm

Is ODBC driver from Oracle not good? http://www.oracle.com/technetwork/datab ... 98976.html
If you download and use it, you should resolve all your problems...
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

gepponline
Posts: 91
Joined: Tue Sep 03, 2013 1:53 pm

Re: Connect with Oracle DB

Post by gepponline » Thu Sep 25, 2014 1:32 pm

I got it.
How to connect vi ODBC?

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: Connect with Oracle DB

Post by dave.kilroy » Thu Sep 25, 2014 1:50 pm

Hi Geppo

Here is a lesson on using ODBC http://lessons.runrev.com/m/4071/l/4965 ... using-odbc

Don't be put off the fact that in the lesson they connect to a MS Access database, LiveCode can use ODBC to connect to other types of database...
"...this is not the code you are looking for..."

gepponline
Posts: 91
Joined: Tue Sep 03, 2013 1:53 pm

Re: Connect with Oracle DB

Post by gepponline » Thu Sep 25, 2014 1:56 pm

Something wrong woth the connection.. it says me invalid connection ID....but maybe some problem due to 32/64 bit driver...

gepponline
Posts: 91
Joined: Tue Sep 03, 2013 1:53 pm

Re: Connect with Oracle DB

Post by gepponline » Thu Sep 25, 2014 2:09 pm

SOLVED!
I'm using a 32bit software on a 64bit pc, so I had to configure the ODBC connection via 32bit ODBC manager application.
Now all seems to work and I can go on with my test :)
Thank you so much!

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Contact:

Re: Connect with Oracle DB

Post by dave.kilroy » Thu Sep 25, 2014 2:19 pm

Well done for sorting that out - thinking about it, a some time ago I had to connect to Firebird (using ODBC) and may well have had to connect to their 32bit version...

For the future, assuming you do something like the following:

Code: Select all

get revOpenDatabase("odbc",host[:port], databaseName, [userName],[password],[cursorType])
put it into tConnID
The tConnID value should hold the error message which may give you more of a hint as to what the problem is...

Code: Select all

if tConnID is a number then
   --carry out a query or other database operation
else
   answer error tConnID
end if
"...this is not the code you are looking for..."

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10052
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: Connect with Oracle DB

Post by FourthWorld » Thu Sep 25, 2014 3:18 pm

gepponline wrote:Ok that make sense, but If i want to evaluate a product (in this case with community version) It should not care how and if i have a license for OTHER software. Or not?
Maybe it could be better if it allow me to use it but don't allow me to create executable...or something similar...!
It would be nice if Oracle's licensing allowed that, but my understanding is that at the moment the license for the code needed to access their database is incompatible with the GPL, and as such none of that code can be included in any GPL-governed package.

This would be an issue to raise with Oracle; RunRev does not determine the licensing for Oracle's drivers.

If Oracle changes their mind and re-licenses their code under a compatible license I'm sure RunRev would be happy to consider your suggestion, but in the meantime you'll have to use another driver with a GPL-governed package like LiveCode Community Edition, such as you've done with ODBC.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply