tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Fowler" <afow...@cc.edu>
Subject RE: database access problem
Date Sun, 08 Apr 2001 21:34:40 GMT
MS SQL Server 7.0 and above definitely do support the AS keyword, not sure
about oracle.
E.g.:-

SELECT MAX(cutomerID) AS MaxID FROM tblCustomer

Regards,
Adam.

Colorado here I come...

----
Adam Fowler
Second year Computer Science undergraduate
University of Wales, Aberystwyth
Carroll College, WI, USA(2000-2001)
web: http://gucciboy.dyndns.org/aff9
e-mail: adamfowler@chillin.co.uk
"Every new beginning comes from some other beginning's end"
----


-----Original Message-----
From: Marc Battistello [mailto:mbattistello@home.com]
Sent: Sunday, April 08, 2001 7:22 PM
To: tomcat-user@jakarta.apache.org
Subject: Re: database access problem


Asim, I dont think Oracle or SQL Server support the "AS" keyword for
renaming column names. I think its specific to MS Access. I did a quick
search and found the below link but Im no expert on sql syntax. That would
be the first place Id look to check sql syntax. You can also try running the
insert statement outside your application to make sure that its not causing
the problem.

http://w3.one.net/~jhoffman/sqltut.htm#Adding_Data


----- Original Message -----
From: "Asim Ghaffar" <u970016@giki.edu.pk>
To: <tomcat-user@jakarta.apache.org>
Sent: Sunday, April 08, 2001 10:49 AM
Subject: database access problem


> Hello Friends!
> I am in real difficult situation so i need some quick advice. I am making
a
> search engine. I did all my testing on MS Acess. So far so good. But now
> when i switched to Oracle and SQL Server i am getting a very odd problem
> (same in oravle and SQL).
> here is my code.
>
> 1 try    {
> 2     ResultSet results = g.executeQuery(); //
> 3     while (results.next()) {
> 4         String u = results.getString("u");
> 5         String t = results.getString("T");
> 6         String s = (new Integer(results.getInt("S"))).toString();
> 7         String k = results.getString("K");            // Exception is
> thrown here at this line
> 8         String a = results.getString("P");
> 9         String d = results.getString("D");
> 10       String m = (new Integer(results.getInt("I"))).toString();
> 11       String l = results.getString("L");
> 12       String o = (new Integer(results.getInt("O"))).toString();
> 13       String st = results.getTimestamp("St").toString();
> 14    }
> 15 }catch (SQLException sqle){
>     sqle.printStackTrace();
>  }
>
> where g = connection.prepareStatement("INSERT INTO HITLIST SELECT
SITES.*,1
> AS SCORE FROM SITES WHERE SITES.PAGETEXT LIKE '%pakistan%'");
>
>
> Now on line # 7 i am getting the exception
> in SQL Server it is  [Microsoft][ODBC SQL Server Driver]Invalid Descriptor
> Index
> in Oracle it is some jdbc exeption about invalid column number
>
> Now if i switch the wors with each other error again come on same line
> number not statement.
> I debugged using jbuilder and in the middle of execution all
> resultset.getDataType("columnName") become inavlid even those which are on
> lines above. So badically whole result set gets corrupted.
> Same code is running fine in MS Access. Any clue what can be the reason
for
> this. Where else i can get help from.
> thanking you in advance. I u have any clue do email me.
> bye
>
>



Mime
View raw message