You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by BeNdErR <be...@hotmail.com> on 2010/12/04 04:12:31 UTC
Derby: SQL ERROR -> Encountered "CASCADE" at line xyz
Hello everyone, while creating a table in my sql db I encountered this error:
SQLState:42X01
Error Code:30000
Syntax error: Encountered "CASCADE" at line 1, column 187.
this is the db structure (3 tables):
CREATE TABLE users(
username VARCHAR(20),
password VARCHAR(20) NOT NULL,
type VARCHAR(5) DEFAULT 'user',
PRIMARY KEY(username)
)
CREATE TABLE post(
id INTEGER,
autore VARCHAR(20),
dataMessaggio DATE,
messaggio VARCHAR(500),
PRIMARY KEY(id, autore, dataMessaggio),
FOREIGN KEY(id) REFERENCES thread(idThread) ON UPDATE CASCADE,
FOREIGN KEY(autore) REFERENCES users(username) ON UPDATE CASCADE
)
CREATE TABLE thread (
idThread INTEGER,
titleThread VARCHAR(30),
autoreThread VARCHAR(20),
dataCreazioneThread DATE,
dataUltimaRisposta DATE,
PRIMARY KEY(idThread, autoreThread),
FOREIGN KEY(autoreThread) REFERENCES users(username) ON UPDATE CASCADE
)
the error is thrown on the POST table, but I can't get rid of it.
Thanks in advance
ps: In another thread I've a pending message. I've done all I could
(followed the instructions) but it is still pending... what can I do? thanks
again
--
View this message in context: http://old.nabble.com/Derby%3A-SQL-ERROR--%3E-Encountered-%22CASCADE%22-at-line-xyz-tp30366617p30366617.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.
Re: Derby: SQL ERROR -> Encountered "CASCADE" at line xyz
Posted by BeNdErR <be...@hotmail.com>.
Bryan Pendleton-3 wrote:
>
>
> Derby hasn't implemented ON UPDATE CASCADE. Here's what Derby provides:
> http://db.apache.org/derby/docs/10.6/ref/rrefsqlj16357.html
>
I had a better look with google on this problem, and I found exactly what
you said.. Any suggestion to "avoid" this problem? I mean, I'd like to use
"update cascade" command, maybe you know a way out. If not, I'll accept that
:D
Bryan Pendleton-3 wrote:
>
> I'm not sure. That problem is really odd. I think that Kristian's theory
> about classloaders is the most likely, as application servers and RMI
> runtimes
> tend to provide really finicky class loading behaviors. Since you've
> demonstrated
> that the simple "java -classpath ..." command can successfully load and
> run
> Derby, you've obviously got a valid copy of the Derby jar files, and
> you've
> obviously set the classpath correctly to point at those jars, which
> normally
> is all you need to do.
>
> So something in your server code must be interfering with the
> Class.forName()
> behavior, which as I noted above is not uncommon with complex server
> runtimes.
>
> For example, some application servers have security constraints in their
> class loading behaviors, and won't allow application code to load
> arbitrary
> libraries without configuring the server's security system to allow the
> library loading.
>
> Class.forName() is a base JDK call, not a Derby call, so I'm afraid
> that you're going to need to seek help from your server provider. Did you
> write this server code yourself, or is it a well-known server of some
> type?
>
> The only other things I can think to try are:
> 1) see if your JDK has any additional diagnostic flags you can run; for
> example I think the Sun JDK provides a "java -verbose:class" flag that
> might give you more clues about the class-loading activity.
> 2) see if you can find a powerful Java debugger, and run your server under
> the Java debugger, and break at the point where you're about to do the
> Class.forName call, and see if your debugger has any tools to diagnose the
> ClassNotFoundException; for example I think you can load the Sun JDK
> source.zip
> for the Sun Java runtime sources, and possibly your debugger will then
> allow
> you to step through the Class.forName call and see if you can spot why
> it's failing.
>
> thanks,
>
> bryan
>
Thanks for your reply here. The message pending seems to be accepted in the
other post. I'm going to reply there, just to avoid confusions about wrong
argument.
Thanks again (the link to the other post is this
http://old.nabble.com/Derby-%3A-No-suitable-driver-found-for-jdbc%3Aderby%3Adb-create%3Dtrue-td30335341.html)
--
View this message in context: http://old.nabble.com/Derby%3A-SQL-ERROR--%3E-Encountered-%22CASCADE%22-at-line-xyz-tp30366617p30398400.html
Sent from the Apache Derby Users mailing list archive at Nabble.com.
Re: Derby: SQL ERROR -> Encountered "CASCADE" at line xyz
Posted by Bryan Pendleton <bp...@gmail.com>.
> FOREIGN KEY(id) REFERENCES thread(idThread) ON UPDATE CASCADE,
Derby hasn't implemented ON UPDATE CASCADE. Here's what Derby provides:
http://db.apache.org/derby/docs/10.6/ref/rrefsqlj16357.html
> ps: In another thread I've a pending message. I've done all I could
> (followed the instructions) but it is still pending... what can I do? thanks
I'm not sure. That problem is really odd. I think that Kristian's theory
about classloaders is the most likely, as application servers and RMI runtimes
tend to provide really finicky class loading behaviors. Since you've demonstrated
that the simple "java -classpath ..." command can successfully load and run
Derby, you've obviously got a valid copy of the Derby jar files, and you've
obviously set the classpath correctly to point at those jars, which normally
is all you need to do.
So something in your server code must be interfering with the Class.forName()
behavior, which as I noted above is not uncommon with complex server runtimes.
For example, some application servers have security constraints in their
class loading behaviors, and won't allow application code to load arbitrary
libraries without configuring the server's security system to allow the library loading.
Class.forName() is a base JDK call, not a Derby call, so I'm afraid
that you're going to need to seek help from your server provider. Did you
write this server code yourself, or is it a well-known server of some type?
The only other things I can think to try are:
1) see if your JDK has any additional diagnostic flags you can run; for
example I think the Sun JDK provides a "java -verbose:class" flag that
might give you more clues about the class-loading activity.
2) see if you can find a powerful Java debugger, and run your server under
the Java debugger, and break at the point where you're about to do the
Class.forName call, and see if your debugger has any tools to diagnose the
ClassNotFoundException; for example I think you can load the Sun JDK source.zip
for the Sun Java runtime sources, and possibly your debugger will then allow
you to step through the Class.forName call and see if you can spot why it's failing.
thanks,
bryan