I’m getting ARGen working with Oracle (hopefully) and I’m running into issues. The Oracle website is less than useful or perhaps I just don’t know the terminology well enough to do anything (seems like Greek to me).
I’ve had Oracle Express 10 installed in Windows 7 in a VM environment. I can get to it and manipulate the database via the Oracle Application Express (web) application they supply. I can connect to it via NaviCat for Oracle from the Mac side of the same machine and via Windows from another Win7 environment on a different machine.
I believe I have the client libraries installed properly on the Mac and the following set in app.open event:
I’ve tried using the IP Host/Port/DB/Username/PW in the traditional Xojo way and I’ve also tried using the way described in the Xojo documentation in the Host field of “(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.17)(PORT=1521))(CONNECT_DATA=(SID=XE)))”
Each time all I get is an error message like this: Server Response: ORA-12154: TNS could no resolve the connection identifier specified.
Anyone ever get the Mac client to talk to instance of Oracle? Anyone have any hints that I can try?
EDIT: I’ve even tried running the app in Windows and it can’t connect so I must be missing something fairly basic in the Xojo setup.
The environment variable was a problem as it can’t be set in the app right. Also connection string must be right.
For one my tests it looks like
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.244.11)(PORT=1521))(CONNECT_DATA=(SID=XE)))
which looks like yours except the IP.
But did you try just a connections string like [:][/<service_name>] format?
I think that setting the environment here in the app.open it’s too late. I had the same idea on Linux and that didn’t work either.
You can simply try in a bash session to set this environment variable and after that in the same bash session try to start your application.
In Linux it worked that way without a problem.
If this works also for you then the solution would be to set the environment system-wide but i don’t know how to do that in OSX, however i think that in the explanation from Christian is the solution (copy from his link):
On Mac OS X you also need to define DYLD_LIBRARY_PATH to point to the dylib files from oracle.
For that you need to modify /etc/launchd.conf for Mac OS X 10.8 and newer.
In older versions those variables in .MacOSX/environment.plist file in user’s home.
Using this had zero effect on the Mac or Windows debug runs with the Windows version on the same machine Oracle is on. I tried a couple of different variations like using tcp/ip for the host but to no avail.
If the path is wrong, or the library can’t be found at the path it will give a specific error message (at least on Mac OS X) about not being able to find the library so I think that part is working.
I don’t think the path is wrong, as soon as app.open fires the oracle plugin is alraedy initialized and didn’t see it’s environment path set, that’s why i think it’s too late.
I give up. This exercise was to help a user out with ActiveRecord generator. I’ve already spent way more time on it that there are users of Oracle in the Xojo world.
I cannot connect to an Oracle database from a Xojo application. Doesn’t matter if it’s Mac or Windows.
Bottom line is that the documentation for the Oracle Plugin is severely lacking and few people with experience in connecting to Oracle from a Xojo application. Add in the hieroglyphics that called an Oracle website and I’ll move on to things I can actually do.
Merge the content of the three Folder in one Folder !
Name this Folder appropriate (for example: ORACLE).
Move this ORACLE-Folder wherever you want (for example: C:).
Add the Path to this ORACLE-Folder to the PATH Variable.
Move the tnsnames.ora into the ORACLE-Folder
Create a new environment variable TNS_ADMIN with the path to the ORACLE-Folder
ODBC: Download Microsoft Visual C++ 2010 Redistributable Package (x86) (vcredist_x86.exe)
Run installer
Run odbc_install.exe in ORACLE-Folder
To configure ODBC run odbcad32.exe in C:\Windows\SysWOW64
[quote=40286:@Stefan Cyrus]ODBC: Download Microsoft Visual C++ 2010 Redistributable Package (x86) (vcredist_x86.exe)
Run installer
Run odbc_install.exe in ORACLE-Folder
To configure ODBC run odbcad32.exe in C:\Windows\SysWOW64[/quote]
So you’re using ODBC rather than the native Oracle plugin?
Otherwise, awesome tutorial! I will have to give this a try when I get a chance.
I use both (OCI with Oracle plugin and ODBC) but with OCI I cannot retrive the ORACLE “ROWID”, I allways get NULL !!!
I can send you some lines of codes for connecting to an Oracle DB via OCI ?.
Version 10.2.0.3
Instant Client Package - Basic: All files required to run OCI, OCCI, and JDBC-OCI applications
Download instantclient-basic-win32-10.2.0.3-20061115.zip (34,469,920 bytes)
If mDb.Connect Then
mIsConnected = True
ConnectStatusLabel.Text = “Connected to Oracle!”
Else
mIsConnected = False
ConnectStatusLabel.Text = "Error connecting to Oracle: " + mDb.ErrorMessage
End If
It currently does NOT support ODBC. However, I don’t see why it couldn’t do ODBC using the Xojo has a plugin for it.
We have no plans for ODBC but we could do a small consulting project for you to do so. Or, you can take a stab at doing it yourself. Look for where we deal with all the various databases and at that point it’s a matter of duplicating the code. Mostly that will be the database adapter classes but there are a handful of other places in the code too.
ActiveRecord itself is open source and you don’t need ARGen to create the Data classes (it’s just more convenient).