I have an old app that I need to get functioning. Right now it uses some invalid SQL. It connects to the db using ODBC. I would just like to shim the ODBC so I could watch for the invalid SQL and replace it with some valid commands.
Any ideas?
MySQL proxy would fit the bill if it would fly over ODBC.
http://dev.mysql.com/downloads/mysql-proxy/
Easiest way is to write a shim yourself, and have the legacy app load your shim which then proxies all ODBC function calls except SQLPrepare and SQLExecDirect to the original ODBC driver. You can then alter any relevant SQL queries passed in through these two functions. All other functions pass arguments through unchanged.
You'll need to "install" your shim as an ODBC driver in the registry (if on Windows) under HKLM\SOFTWARE\ODBC\ODBCINST.INI (for the driver) and ODBC.INI (for the DSN). You can then point your old app to your shim, which will load the original driver dynamically.
Related
Can an application developed with oracle queries in DB layer
Be run on an SQLServer Database with the help of an ODBC driver
Maybe, if you used only ANSI SQL statements. ODBC will happily send the text of the query to the query parser on the server and as long as the server can parse it, it will run.
If, however, you have used anything that's specific to Oracle (and that's a long, long list), then it won't work so well.
All that ODBC provides you is abstraction from the connection details -- the driver, the server name, the port numbers etc.
So, how do you get true independence? Generally, you'll use a query generation library like Hibernate which knows how to translate a query language of some kind (HQL) to the specifics for that particular database (PL/SQL or Transact/SQL).
Short answer: Not reliably.
Longer answer: Not through ODBC, but using a JDBC driver for Microsoft SQL Server then perhaps if the application was developed only with ANSI standard SQL. Usually, that is not the case and some PL/SQL code will have been used. If an equivalent piece of T-SQL can be written then it is possible to port the application. But, to your question, this is largely immaterial to the database connection mechanism.
Addendum: Object Relational Mapping tools usually use dialects to generate database independent queries. Other options include using configuration to select the correct queries at run-time (if you need to support both database types).
Sorry for being the question very naive but the same is true for my experience with the subject.
From the googling what i understood i just want to confirm that the understanding is correct. Everyone is welcome to pin point where i am wrong.
OCI is basically a set of APIs which the C/C++ programmers can use to write C/C++
applications to access Oracle Database.
a) Oracle instant client SDK is a (DLL/Shared library) which USES OCI (???). The C/C++
code written by C/C++ programmers links to the Oracle instant client libraries &
hence uses OCI as well.
b) The benefit of instant client is that it eases the programmers pain to write some
complex code(??).
c) Even if C/C++ programmer doesn't use Instant Client libraries, they can still use OCI
& get the work done (Is this correct??)
d) Is this true? C/C++ programmers just need OCI library to write an application which
connects to Remote Oracle database & does table operations? Do we need any ODBC
drivers also? If yes, why? Won't oci.lib be enough?
What is the difference between FULL Oracle Client & Instant Oracle Client? Is it true
that Instant Oracle client is just a subset of FULL Oracle client?
I am not able to obtain the interoperatibility matrix of Instant Client will various
Oracle databases. Searched alot on Oracle website. The only thing i could find is link
to Oracle support site which i can't access.
Please clarify my doubts. Many thanks in advance.
Briefly:
OCI is C API libary. There is also C++ library called OCCI, but I do not recommend it(you can have problems with C++ ABI changes/dialects on various compilers)
Both Instant and "thick" Oracle client contain OCI library (OCI.DLL or linclntsh.so). The one provided by Instant client is more-or-less self-contained. e.i. it does not depend on other libs provided with Oracle client (compare output from ldd on Linux or depwalk on Windows).
Both also contain necessary headers
The C API in both clients is practically identical. The only exception I recall is a set of supported database native characters sets. InstantClient supports only UTF8, ISO Latin1 and ASCII.
"thick" client also contains a library named "libxml.a" which is needed when you want to use datatype SYS.XMLTYPE. This library is not (for some unknown reason) bundled with InstantClient
"thick" client also contains some handy diagnostic tools like tnsping
InstantClient is very easy to "setup". Users simply unpack a single .zip file. Do not have to set ORACLE_HOME PATH LD_LIBRARY_PATH env. variables. You simply dlopen() one library file and that's all.
InstanctClient can work without tnsnames.ora (although it supports it) instead of that you can use jdbc-like EZCONNECT
Both types of clients may not be re-distributed, unless you're Oracle businesses partner. So you must not embed these driver's lib in your application. Each user must download then separately.
So far I have not found a C API way how to distinguish InstantClient OCI.DLL libary.
There is InstantClient specific section in Oracle Call Interface Programmer's Guide
I recall there might be some problems with InstantClient when you set ORACLE_HOME env. variable and it's values ends (?or does not end?) with slash '/'
Oracle instant client is a small subset of the full/"thick" client. It includes the OCI C-libraries, JDBC and ODBC which makes is possible for programs written in C, Perl, Python, Java, Scala and so on to connect to an Oracle database server. Instant client dont include familiar Oracle tools like sqlplus, sqlldr, exp, imp and more. However, sqlplus can be installed separately to work with instant client without needing a full client.
I want to know if is there a way of change the driver used by Microsoft Access to extract data (only use select like querys) from Oracle 9i data base.
The Access to Oracle connection is made using an external data source (linked table) and usually the default Access driver is ODBC for ORACLE, but I want to change that and use a JDBC driver for ORACLE instead.
Thanks in advance.
The Access to Oracle connection is made using an external data source (linked table) and usually the default Access driver is ODBC for ORACLE, but I want to change that and use a JDBC driver for ORACLE instead.
I'm fairly certain that this is impossible. Access linked tables connect via Jet/ACE (for links to another Access database), or ODBC (for all other data sources). JDBC is not an option.
I'd like to change the application information that is shown when inspecting
Oracle 10g sessions using the Oracle Enterprise Manager application:
Application Information
Program 'my program'
Module 'something'
Command UNKNOWN
I'm using the JDBC thin driver to connect, and I have to admit I'd rather not
use the OCI driver if at all possible. Can I do this with the thin driver, and
if so, how?
DBMS_APPLICATION_INFO should take care of that:
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_appinf.htm
use the appropriate method within the DBMS_APPLICATION_INFO package (.SET_ACTION, .SET_CLIENT_INFO, .SET_MODULE
What are the steps to connect to Oracle 9i with VB6? How can I use modules and stored procedures in VB6 and how can I call an SP?
What is the method to use ADO which is helpful to insert, update, search and delete the items from the front end?
You will need ADO to connect to Oracle (add reference to microsoft activex data objects library).
You need to know where is the Oracle Instance hosted alongwith username and password?
The connection string for Oracle can be found from www.connectionstrings.com
ADODB.Connection is the one that you will need to establish the connection.
Connection has Execute method - which you can use for any insert/update/delete statements.
Now, read some documentation on ADO object library from MSDN.
And, write the code by yourself.
You can choose between the Oracle OLEDB driver (which I think comes with the Oracle client install mentioned by YogoZuno) or one from Microsoft (can't remember if it was just a standard microsoft oledb driver or one released with a nod towards oracle): in any case, the Oracle OLEDB driver is far better.
You will also need to have the Oracle client installed on your PC, along with an appropriate TNS Names file. Also, be aware that there are some minor functional differences between various versions of the Oracle 9 client - I had some issues under v9.2.0.1, that did not occur under v9.2.0.7.