Yes, you can use that property when you get a connection. Use a URL like: 'jdbc:derby:net://localhost:1527/tdb:retrieveMessagesFromServerOnGetMessage=true;user=junk;password=junk;';
Any SQLExceptions on that connection should show the message. You don't have to do anything else extra. Satheesh Jonathan Eric Miller wrote: > That looks like a much better error message. Thanks! > > What I'm wondering now though, is, is there an equivalent property to > the JDBC driver itself? Normally, with the other JDBC drivers that > I've been using (MySQL, MSSQL, Sybase, PostgreSQL, Oracle), it was > sufficient to just do an Exception.printStackTrace() to get a > meaningful text message of what went wrong for a SQLException. I'm > wondering if I'm still going to have to do more than that when using > the Derby driver? Personally, I think it should print out descriptive > text by default. > > Jon > > ----- Original Message ----- From: "Satheesh Bandaram" > <[EMAIL PROTECTED]> > To: "Derby Discussion" <[email protected]> > Sent: Wednesday, February 09, 2005 4:23 PM > Subject: Re: JDBC driver error codes documentation, where? > > >> You can get the error messages using property >> retrieveMessagesFromServerOnGetMessage, which defaults to FALSE. >> >> <satheesh> java -Dij.retrieveMessagesFromServerOnGetMessage=true >> org..apache.derby.tools.ij >> ij> connect 'jdbc:derby://localhost:1527/tdb' user 'junk' password >> 'junk'; >> ij> INSERT INTO Item (name) VALUES ("Panasonic DVD Player"); >> ERROR 42X04: Column 'Panasonic DVD Player' is not in any table in the >> FROM list or it appears within a join specification and is outside >> the scope of the join specification or it appears in a HAVING clause >> and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE >> statement then 'Panasonic DVD Player' is not a column in the target >> table. >> ij> >> >> IBM actually announced contributing source code for JDBC driver by >> around March 2005. I think we should make this property default to >> TRUE in Apache driver, if and when it is accepted by the community. >> >> Satheesh >> >> Jonathan Eric Miller wrote: >> >> Does anyone know where the error codes are listed for the JDBC driver? >> >> The following is the error I get in ij if I accidentally use double >> quotes instead of single quotes. Why oh why doesn't IBM's JDBC driver >> print intelligible error messages? I can live with it as long as >> there is documentation somewhere that maps the error codes into >> descriptive text, but, where is it? >> >> Any news on IBM turning over the source code for the JDBC driver? >> >> ij> INSERT INTO Item (name) VALUES ("Panasonic DVD Player"); >> ERROR 42X04: DB2 SQL error: SQLCODE: -1, SQLSTATE: 42X04, SQLERRMC: >> Panasonic DV >> D Player�42X04 >> >> ij> INSERT INTO Item (name) VALUES ('Panasonic DVD Player'); >> 1 row inserted/updated/deleted >> >> Jon >> >> >> > >
