Re: MFC Application Using ODBC Driver Problem

From: Jim Kennedy <kennedy-family_at_attbi.com>
Date: Fri, 14 Dec 2001 02:03:24 GMT
Message-ID: <M5dS7.21293$7y.239616_at_rwcrnsc54>


There is a difference in sql server and Oracle in what a database is. In Oracle you connect to an instance which is one database. In Oracle you have schemas (e.g. sys,system, scott, etc.) and if you logon as the owner of the schema (e.g. scott) then if you say select * from emp it is assumed that you are doing select * from scott.emp (assuming emp is not a public synonym). If you are logging in as john and john has rights to the scott schema john has to do select * from scott.emp or (assuming there is no john.emp) the table won't be found. Also if you created the table like:

create table emp ( emp_id number, first_name varchar2(30),...) then the following will work:
select emp_id, First_name from EmP;

If you create the table like this:
create table "emp" ( "emp_id" number, "first_name" varchar2(30),...) then the above query won't work or even find the emp table. Why? Because putting the table and/or column names in "'s means you want to make them case sensitive.

So I know nothing about the MFC ODBC classes, but I suspect that something like this is probably your problem.

Jim

"Chris Adamson" <cadamson_at_identec.com> wrote in message news:HfcS7.231$Lx1.1667_at_shaw-ty1...
> Hi,
>
> I'm using MFC ODBC classes to develop a program that accesses and updates
 an
> Oracle database. The program has worked great with SQL Server over the
 last
> few months.
>
> The CDatabase derived object connects to the Oracle Database without any
> problems.
> However when I call CDatabase::GetDatabaseName() the CString returns ""
> (which usually indicates an error).
>
> I skip this code and try to open a table via a CRecordset derived class.
> However, it fails and the exception says that the table or field does not
> exist. The table *does* exist, and has all the proper fields.
>
> Here's my default CRecordset override for GetDefaultSQL:
>
> CString CrsTableCommands::GetDefaultSQL()
> {
> return _T("[tblCommand]");
> }
>
> Do you have any hints, suggestions, ideas? Please let me know.
>
> Thanks.
> -Chris
>
>
Received on Fri Dec 14 2001 - 03:03:24 CET

Original text of this message