Page 1 of 1
[SOLVED]Connect with Oracle DB
Posted: Wed Sep 24, 2014 2:09 pm
by gepponline
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?
Re: Connect with Oracle DB
Posted: Wed Sep 24, 2014 2:34 pm
by Klaus
Hi gepponline,
1. welcome to the forum!
2. are you using the Community Edition of Livecode?
I think database connection to ORACLE is only supported in the commercial version.
Best
Klaus
Re: Connect with Oracle DB
Posted: Wed Sep 24, 2014 2:57 pm
by gepponline
Yes...community edition....
Even some other DB connection are available only for commercial version or only the Oracle one?
Re: Connect with Oracle DB
Posted: Wed Sep 24, 2014 2:58 pm
by Klaus
Not sure, but I think only Oracle.
Re: Connect with Oracle DB
Posted: Wed Sep 24, 2014 3:02 pm
by gepponline
So it's an Unlucky start
maybe I should start with something else...
Re: Connect with Oracle DB
Posted: Wed Sep 24, 2014 3:11 pm
by Klaus
Well, Oracle is a highly commercial product compared to MySQL, SQLite and PostGreSQL, so this is not really surprising...
Re: Connect with Oracle DB
Posted: Wed Sep 24, 2014 8:09 pm
by FourthWorld
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.
Re: Connect with Oracle DB
Posted: Thu Sep 25, 2014 8:33 am
by gepponline
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!
Re: Connect with Oracle DB
Posted: Thu Sep 25, 2014 1:27 pm
by MaxV
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...
Re: Connect with Oracle DB
Posted: Thu Sep 25, 2014 1:32 pm
by gepponline
I got it.
How to connect vi ODBC?
Re: Connect with Oracle DB
Posted: Thu Sep 25, 2014 1:50 pm
by dave.kilroy
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...
Re: Connect with Oracle DB
Posted: Thu Sep 25, 2014 1:56 pm
by gepponline
Something wrong woth the connection.. it says me invalid connection ID....but maybe some problem due to 32/64 bit driver...
Re: Connect with Oracle DB
Posted: Thu Sep 25, 2014 2:09 pm
by gepponline
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!
Re: Connect with Oracle DB
Posted: Thu Sep 25, 2014 2:19 pm
by dave.kilroy
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
Re: Connect with Oracle DB
Posted: Thu Sep 25, 2014 3:18 pm
by FourthWorld
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.