db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anna Krajewska <am.krajew...@gmail.com>
Subject Re: get SQLState from ij.runScript
Date Thu, 12 Apr 2012 15:30:59 GMT
That is very helpful, thanks!
Anna

2012/4/12 Rick Hillegas <rick.hillegas@oracle.com>:
> On 4/12/12 2:56 AM, Anna Krajewska wrote:
>>
>> Hi
>>
>> Is there an elegant way in which I can get sqlState of the exception
>> occured while running ij.runScript? I get an output which looks like
>> command line history, the sqlState is present there but I can only get
>> it by parsing the string (finding the word "ERROR", then adding 1 for
>> the empty character and taking whatever is next as sqlState). And if
>> there isn't - can I assume that the format of the message will always
>> be like this (line starting with ERROR, whitespace, sqlstate, colon):
>>
>> ij>my derby instruction
>> ERROR<SqlState>:
>>
>> ?
>>
>> I need that because there is no "create or replace view" in derby. I
>> need to ignore X0Y32 error: object already exists,  when I run my
>> scripts from java.
>
> Hi Anna,
>
> Sounds like you're running ij under your application and then parsing the
> output. It might be simpler to just parse the sql script into statements and
> run the statements yourself. To do this, you can use the StatementReader
> class attached to https://issues.apache.org/jira/browse/DERBY-5690.
>
> Hope this helps,
> -Rick
>>
>> Regards,
>> Anna
>>
>

Mime
View raw message