Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Table not found with jdbc sql statement

Re: Table not found with jdbc sql statement

From: Niall Litchfield <n-litchfield_at_audit-commission.gov.uk>
Date: Thu, 30 Oct 2003 14:56:03 -0000
Message-ID: <3fa12685$0$9473$ed9e5944@reading.news.pipex.net>


"Simon Bieri" <Simon.Bieri_at_sisclear.com> wrote in message news:bnr4kp$14k68e$1_at_ID-151365.news.uni-berlin.de...
> Thanks for your answers.
>
> Niall Litchfield schrieb:
>
> <SNIP>
>
> > I don't have a working java ide at the moment to test out what is
happening,
> > and in any case we haven't seen the java code that tries to select from
the
> > table.
>
> ...
>
> >> From my point of view using double quotes for table names is a bad
habit
> >
> > and
> >
> >>should be avoided at all.
> >
> >
> > This I entirely agree with.
>
> I'm not.
>
> To change that "bad habit" is not that easy, because all sql statements
> and connections to the database are in a java package (based on
java.sql.*).
> Anyway, I agree with Thomas Kellerer, that 'the SQL standard says that
> as soon as you put an object in double quotes, the database has to
> handle that case sensitive'. So that means, when I create the tables
> with my sql script, Oracle should be able to find the table names in
> double quotes and mixed case. The question is now, does Oracle fully
> support the SQL standard?

That was really what the sqlplus cut and paste was supposed to demonstrate. It shows that as soon as you put an object in double quotes Oracle handles it as case sensitive. in other words your code really does create a case sensitive tablename that needs case sensitive handling.

I have now installed java sdk 1.4 and the test case behaves as I expected.

the code

import java.io.*;

import java.sql.*;

public class MixedCase

{

private static Connection conn;

private static Statement stmt;

private static ResultSet rset;

public static void main (String[] args) throws SQLException, ClassNotFoundException

{

Class.forName ("oracle.jdbc.driver.OracleDriver");

conn = DriverManager.getConnection

("<connection string");

stmt = conn.createStatement ();

rset = stmt.executeQuery( "SELECT \"DateTime\" FROM \"DbTableOne\"" );

}

}

compiles and works fine against the database that I ran your sql on earlier. - i.e Ora-00942 is not thrown. What does your code look like?

-- 
Niall Litchfield
Oracle DBA
Audit Commission Uk
Received on Thu Oct 30 2003 - 08:56:03 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US