You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by JKramer <ja...@ascenditsolutions.com> on 2005/05/04 15:49:11 UTC
column names with spaces, etc.
Revered Luminaries of the OJB Community:
First off, let me say that I'm FORCED to access data from a table
provided by a client that utilizes column names with spaces, dashes, and
forward slashes. Again NOT my choice or design - just wanted to get that
out of the way! 8^) These guys are M$ zombies, what can I say!?
I'm using db-ojb-1.0.3 with jtds-1.0.3 connecting to MS Sql Server 2000.
(BTW... the application is also connecting to databases on PostgreSQL on
a Linux server (my choices) which works great!)
The "closest" I can get to a successful query is to enclose the column
names in square brackets within the repository file. Note that the table
name also contains a space and enclosing it in square brackets seems to
work fine.
The exceptions I'm seeing are:
org.apache.ojb.broker.PersistenceBrokerSQLException: SQLException during
the execution of the query (for
com.ascenditsolutions.lca.model.vo.rio.Lerg7VO): Invalid column name 'eff'
The related repository definition:
<field-descriptor
id="4"
name="effDate"
column="eff date"
jdbc-type="TIMESTAMP"
/>
OK, I'm not using "eff date" at this point in time, let's skip it for
now and see how far we get... not far enough:
org.apache.ojb.broker.PersistenceBrokerException: Error reading class
type: com.ascenditsolutions.lca.model.vo.rio.Lerg7VO from result set,
current read field was vCoord
With repository definition:
<field-descriptor
id="10"
name="vCoord"
column="v-coord"
jdbc-type="VARCHAR"
length="5"
/>
Getting "v-coord" is essential.
Now what?
I'm stuck. If someone has a suggestion on what I need to do, I'd really
appreciate it. Otherwise, I'm considering utilizing a view with aliases
for the malignant columns - will this work?
Thanks!
John
A simple and humble OJB User.
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: column names with spaces, etc.
Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi john,
with ojb 1.1 you can use ojb's quoting character that will be replaced
by the dbms-specific character when generating the sql.
column names containing spaces may also be a problem with ojb 1.0.x
because of the rather primitive parsing.
afaik ojb will use the index rather than the name of the column to
retrieve data from resultset.
satisfied customers are always welcome ;)
jakob
JKramer schrieb:
> Hi Jakob,
>
> I just read your post after doing the following JDBC level testing and
> writing it up. It "appears" to me that OJB 1.0.3 is handling the
> quoted column and table names OK. Is there something more sublte going
> on that i'm missing?
>
> .......................................................................
>
> I've written some POJDBC to test the JTDS driver. Here's the main part
> of my query string using the square brackets to enclose the "unusual"
> field names.
>
>
> This query executes just fine. And if I used the ResultSet.getString()
> as shown next, I get the data I'm looking for:
>
> String effDate = rs.getString("eff date");
>
> Note the absence of the square brackets above. So with JDBC, if I use
> square brackets in the SELECT and omit them in the getting the results
> then everybody is happy!
>
> Adding the square brackets to the getString as they are used in the
> SELECT throws.
>
> String effDate = rs.getString("[eff date]");
>
> java.sql.SQLException: Invalid column name [eff date].
> at
> net.sourceforge.jtds.jdbc.JtdsResultSet.findColumn(JtdsResultSet.java:938)
>
> at
> net.sourceforge.jtds.jdbc.JtdsResultSet.getString(JtdsResultSet.java:1173)
>
> at
> com.ascenditsolutions.dbtesting.ColumnNameTest.readLergRecords(ColumnNameTest.java:161)
>
> at
> com.ascenditsolutions.dbtesting.ColumnNameTest.main(ColumnNameTest.java:118)
>
> Exception in thread "main"
>
>
> The actual SQLException above showing the brackets in the column name
> is what I was seening with the OJB as well, leading me to believe that
> OJB is properly utilizing the square brackets in both the query and
> the getString. Maybe perpared statment behaviour would be different?
>
>
> I't seems that OJB is doing what it should be and JTDS is the problem.
>
> Thanks for walking through this with me!
>
> Another satisfied OJB Customer,
> John
>
>
> PS: One last question. The ResultSet.getString(int pos) calls work in
> the JDBC test. Is there some way to force OJB to utilize the column
> IDs instead of the column name in reading the result sets?
>
> ===============================================================================================
>
>
>
> Tried a few other things to walk around the problem a bit...
>
> String baseQuery = "SELECT switch, 'eff date', [v-coord], [h-coord]
> FROM [Lerg 7] " +
> "WHERE switch like '";
>
> String effDate = rs.getString("'eff date'");
>
> java.sql.SQLException: Invalid column name 'eff date'.
> at
> net.sourceforge.jtds.jdbc.JtdsResultSet.findColumn(JtdsResultSet.java:938)
>
> at
> net.sourceforge.jtds.jdbc.JtdsResultSet.getString(JtdsResultSet.java:1173)
>
> at
> com.ascenditsolutions.dbtesting.ColumnNameTest.readLergRecords(ColumnNameTest.java:161)
>
> at
> com.ascenditsolutions.dbtesting.ColumnNameTest.main(ColumnNameTest.java:118)
>
> Exception in thread "main"
>
>
> The following blows up when the query is executed:
>
> String baseQuery = "SELECT switch, [eff date], v-coord, h-coord FROM
> [Lerg 7] " +
> "WHERE switch like '";
>
>
> java.sql.SQLException: Invalid column name 'v'.
> at
> net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:364)
>
> at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2778)
> at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2214)
> at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:597)
> at
> net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:343)
>
> at
> net.sourceforge.jtds.jdbc.JtdsStatement.executeQuery(JtdsStatement.java:1184)
>
> at
> com.ascenditsolutions.dbtesting.ColumnNameTest.readLergRecords(ColumnNameTest.java:156)
>
> at
> com.ascenditsolutions.dbtesting.ColumnNameTest.main(ColumnNameTest.java:118)
>
> Exception in thread "main"
>
>
>
>
> Jakob Braeuchi wrote:
>
>> hi john,
>>
>> quoting table- and column-names is supported in OJB 1.1 .
>>
>> jakob
>>
>> JKramer schrieb:
>>
>>> Revered Luminaries of the OJB Community:
>>>
>>> First off, let me say that I'm FORCED to access data from a table
>>> provided by a client that utilizes column names with spaces, dashes,
>>> and forward slashes. Again NOT my choice or design - just wanted to
>>> get that out of the way! 8^) These guys are M$ zombies, what can I
>>> say!?
>>>
>>> I'm using db-ojb-1.0.3 with jtds-1.0.3 connecting to MS Sql Server
>>> 2000.
>>> (BTW... the application is also connecting to databases on
>>> PostgreSQL on a Linux server (my choices) which works great!)
>>>
>>> The "closest" I can get to a successful query is to enclose the
>>> column names in square brackets within the repository file. Note
>>> that the table name also contains a space and enclosing it in square
>>> brackets seems to work fine.
>>>
>>> The exceptions I'm seeing are:
>>>
>>> org.apache.ojb.broker.PersistenceBrokerSQLException: SQLException
>>> during the execution of the query (for
>>> com.ascenditsolutions.lca.model.vo.rio.Lerg7VO): Invalid column name
>>> 'eff'
>>>
>>> The related repository definition:
>>>
>>> <field-descriptor
>>> id="4"
>>> name="effDate"
>>> column="eff date"
>>> jdbc-type="TIMESTAMP"
>>> />
>>>
>>> OK, I'm not using "eff date" at this point in time, let's skip it
>>> for now and see how far we get... not far enough:
>>>
>>> org.apache.ojb.broker.PersistenceBrokerException: Error reading
>>> class type: com.ascenditsolutions.lca.model.vo.rio.Lerg7VO from
>>> result set, current read field was vCoord
>>>
>>> With repository definition:
>>>
>>> <field-descriptor
>>> id="10"
>>> name="vCoord"
>>> column="v-coord"
>>> jdbc-type="VARCHAR"
>>> length="5"
>>> />
>>>
>>> Getting "v-coord" is essential.
>>>
>>> Now what?
>>>
>>> I'm stuck. If someone has a suggestion on what I need to do, I'd
>>> really appreciate it. Otherwise, I'm considering utilizing a view
>>> with aliases for the malignant columns - will this work?
>>>
>>>
>>> Thanks!
>>> John
>>> A simple and humble OJB User.
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>
>>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: column names with spaces, etc.
Posted by JKramer <ja...@ascenditsolutions.com>.
Hi Jakob,
I just read your post after doing the following JDBC level testing and
writing it up. It "appears" to me that OJB 1.0.3 is handling the quoted
column and table names OK. Is there something more sublte going on that
i'm missing?
.......................................................................
I've written some POJDBC to test the JTDS driver. Here's the main part
of my query string using the square brackets to enclose the "unusual"
field names.
This query executes just fine. And if I used the ResultSet.getString()
as shown next, I get the data I'm looking for:
String effDate = rs.getString("eff date");
Note the absence of the square brackets above. So with JDBC, if I use
square brackets in the SELECT and omit them in the getting the results
then everybody is happy!
Adding the square brackets to the getString as they are used in the
SELECT throws.
String effDate = rs.getString("[eff date]");
java.sql.SQLException: Invalid column name [eff date].
at
net.sourceforge.jtds.jdbc.JtdsResultSet.findColumn(JtdsResultSet.java:938)
at
net.sourceforge.jtds.jdbc.JtdsResultSet.getString(JtdsResultSet.java:1173)
at
com.ascenditsolutions.dbtesting.ColumnNameTest.readLergRecords(ColumnNameTest.java:161)
at
com.ascenditsolutions.dbtesting.ColumnNameTest.main(ColumnNameTest.java:118)
Exception in thread "main"
The actual SQLException above showing the brackets in the column name is
what I was seening with the OJB as well, leading me to believe that OJB
is properly utilizing the square brackets in both the query and the
getString. Maybe perpared statment behaviour would be different?
I't seems that OJB is doing what it should be and JTDS is the problem.
Thanks for walking through this with me!
Another satisfied OJB Customer,
John
PS: One last question. The ResultSet.getString(int pos) calls work in
the JDBC test. Is there some way to force OJB to utilize the column IDs
instead of the column name in reading the result sets?
===============================================================================================
Tried a few other things to walk around the problem a bit...
String baseQuery = "SELECT switch, 'eff date', [v-coord], [h-coord] FROM
[Lerg 7] " +
"WHERE switch like '";
String effDate = rs.getString("'eff date'");
java.sql.SQLException: Invalid column name 'eff date'.
at
net.sourceforge.jtds.jdbc.JtdsResultSet.findColumn(JtdsResultSet.java:938)
at
net.sourceforge.jtds.jdbc.JtdsResultSet.getString(JtdsResultSet.java:1173)
at
com.ascenditsolutions.dbtesting.ColumnNameTest.readLergRecords(ColumnNameTest.java:161)
at
com.ascenditsolutions.dbtesting.ColumnNameTest.main(ColumnNameTest.java:118)
Exception in thread "main"
The following blows up when the query is executed:
String baseQuery = "SELECT switch, [eff date], v-coord, h-coord FROM
[Lerg 7] " +
"WHERE switch like '";
java.sql.SQLException: Invalid column name 'v'.
at
net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:364)
at net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2778)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2214)
at net.sourceforge.jtds.jdbc.TdsCore.getMoreResults(TdsCore.java:597)
at
net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:343)
at
net.sourceforge.jtds.jdbc.JtdsStatement.executeQuery(JtdsStatement.java:1184)
at
com.ascenditsolutions.dbtesting.ColumnNameTest.readLergRecords(ColumnNameTest.java:156)
at
com.ascenditsolutions.dbtesting.ColumnNameTest.main(ColumnNameTest.java:118)
Exception in thread "main"
Jakob Braeuchi wrote:
> hi john,
>
> quoting table- and column-names is supported in OJB 1.1 .
>
> jakob
>
> JKramer schrieb:
>
>> Revered Luminaries of the OJB Community:
>>
>> First off, let me say that I'm FORCED to access data from a table
>> provided by a client that utilizes column names with spaces, dashes,
>> and forward slashes. Again NOT my choice or design - just wanted to
>> get that out of the way! 8^) These guys are M$ zombies, what can I
>> say!?
>>
>> I'm using db-ojb-1.0.3 with jtds-1.0.3 connecting to MS Sql Server 2000.
>> (BTW... the application is also connecting to databases on PostgreSQL
>> on a Linux server (my choices) which works great!)
>>
>> The "closest" I can get to a successful query is to enclose the column
>> names in square brackets within the repository file. Note that the
>> table name also contains a space and enclosing it in square brackets
>> seems to work fine.
>>
>> The exceptions I'm seeing are:
>>
>> org.apache.ojb.broker.PersistenceBrokerSQLException: SQLException
>> during the execution of the query (for
>> com.ascenditsolutions.lca.model.vo.rio.Lerg7VO): Invalid column name
>> 'eff'
>>
>> The related repository definition:
>>
>> <field-descriptor
>> id="4"
>> name="effDate"
>> column="eff date"
>> jdbc-type="TIMESTAMP"
>> />
>>
>> OK, I'm not using "eff date" at this point in time, let's skip it for
>> now and see how far we get... not far enough:
>>
>> org.apache.ojb.broker.PersistenceBrokerException: Error reading class
>> type: com.ascenditsolutions.lca.model.vo.rio.Lerg7VO from result set,
>> current read field was vCoord
>>
>> With repository definition:
>>
>> <field-descriptor
>> id="10"
>> name="vCoord"
>> column="v-coord"
>> jdbc-type="VARCHAR"
>> length="5"
>> />
>>
>> Getting "v-coord" is essential.
>>
>> Now what?
>>
>> I'm stuck. If someone has a suggestion on what I need to do, I'd
>> really appreciate it. Otherwise, I'm considering utilizing a view with
>> aliases for the malignant columns - will this work?
>>
>>
>> Thanks!
>> John
>> A simple and humble OJB User.
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: column names with spaces, etc.
Posted by Jakob Braeuchi <jb...@gmx.ch>.
hi john,
quoting table- and column-names is supported in OJB 1.1 .
jakob
JKramer schrieb:
> Revered Luminaries of the OJB Community:
>
> First off, let me say that I'm FORCED to access data from a table
> provided by a client that utilizes column names with spaces, dashes, and
> forward slashes. Again NOT my choice or design - just wanted to get that
> out of the way! 8^) These guys are M$ zombies, what can I say!?
>
> I'm using db-ojb-1.0.3 with jtds-1.0.3 connecting to MS Sql Server 2000.
> (BTW... the application is also connecting to databases on PostgreSQL on
> a Linux server (my choices) which works great!)
>
> The "closest" I can get to a successful query is to enclose the column
> names in square brackets within the repository file. Note that the table
> name also contains a space and enclosing it in square brackets seems to
> work fine.
>
> The exceptions I'm seeing are:
>
> org.apache.ojb.broker.PersistenceBrokerSQLException: SQLException during
> the execution of the query (for
> com.ascenditsolutions.lca.model.vo.rio.Lerg7VO): Invalid column name 'eff'
>
> The related repository definition:
>
> <field-descriptor
> id="4"
> name="effDate"
> column="eff date"
> jdbc-type="TIMESTAMP"
> />
>
> OK, I'm not using "eff date" at this point in time, let's skip it for
> now and see how far we get... not far enough:
>
> org.apache.ojb.broker.PersistenceBrokerException: Error reading class
> type: com.ascenditsolutions.lca.model.vo.rio.Lerg7VO from result set,
> current read field was vCoord
>
> With repository definition:
>
> <field-descriptor
> id="10"
> name="vCoord"
> column="v-coord"
> jdbc-type="VARCHAR"
> length="5"
> />
>
> Getting "v-coord" is essential.
>
> Now what?
>
> I'm stuck. If someone has a suggestion on what I need to do, I'd really
> appreciate it. Otherwise, I'm considering utilizing a view with aliases
> for the malignant columns - will this work?
>
>
> Thanks!
> John
> A simple and humble OJB User.
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: column names with spaces, etc.
Posted by Thomas Dudziak <to...@gmail.com>.
> Logging at DEBUG level printed the following line:
>
> sql.SqlGeneratorDefaultImpl - SQL:SELECT A0.[eqp type],A0.[lata
> name],A0.[h-coord],A0.[eff
> date],A0.lata,A0.[v-coord],A0.filler1,A0.ocn,A0.status,A0.switch,A0.aocn
> FROM [Lerg 7] A0 WHERE A0.switch LIKE ?
>
> Is this the query that is generated by OJB and passed to JTDS? If so,
> then does this mean that the problem lies within JTDS?
Yup, that's the SQL (you could also use P6Spy to see exactly what goes
to the JDBC driver, see here:
http://db.apache.org/ojb/docu/faq.html#traceProfileSQL).
The second exception that you posted is definitly a problem with JDTS
or - more likely - with the database itself. Check the doc on which
characters are allowed for column names; they are typically very
limited like alphanumerical + '_'. The same could be true for the
first exception (with the space).
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: column names with spaces, etc.
Posted by JKramer <ja...@ascenditsolutions.com>.
Logging at DEBUG level printed the following line:
sql.SqlGeneratorDefaultImpl - SQL:SELECT A0.[eqp type],A0.[lata
name],A0.[h-coord],A0.[eff
date],A0.lata,A0.[v-coord],A0.filler1,A0.ocn,A0.status,A0.switch,A0.aocn
FROM [Lerg 7] A0 WHERE A0.switch LIKE ?
Is this the query that is generated by OJB and passed to JTDS? If so,
then does this mean that the problem lies within JTDS?
JKramer wrote:
>
>
> Thomas Dudziak wrote:
>
>> Could you post the complete stack trace, as it might be an error from
>> the JDBC driver or even the database.
>>
>> Tom
>
>
> Tom,
>
> Right!
>
> OK. I've appended two different stack traces below: one for a column
> name with a space and one with a "-" in that order.
>
> In both cases the exception cuase is the same:
>
> Caused by: java.sql.SQLException: Invalid column name
>
> However, they begin at two different places within JTDS.
>
> Is it possible that OJB is stripping the square brackets off of the
> column name? I suppose that I could try writing some JDBC code and going
> directly to the JTDS driver to better isolate the problem. Any other
> suggestions?
>
> Final note, the repository segment provided in my original post was from
> an earlier version of the file. The column names ARE enclosed in []s in
> the actual file being used.
>
> thanks!
> John
>
>
> ==========================================================================================
>
> Column Name with space stack trace
> ==========================================================================================
>
>
> 99389 ERROR [main] rio.Lerg7DAO - PersistenceBrokerException thrown in
> Lerg7DAO.findByClli8().
> org.apache.ojb.broker.PersistenceBrokerSQLException: SQLException during
> the execution of the query (for
> com.ascenditsolutions.lca.model.vo.rio.Lerg7VO): Invalid column name 'eff'.
> at
> org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(JdbcAccessImpl.java:349)
>
> at
> org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(RsQueryObject.java:74)
>
> at
> org.apache.ojb.broker.accesslayer.RsIterator.<init>(RsIterator.java:185)
> at
> org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(RsIteratorFactoryImpl.java:58)
>
> at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(PersistenceBrokerImpl.java:1918)
>
> at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(PersistenceBrokerImpl.java:1493)
>
> at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(PersistenceBrokerImpl.java:1620)
>
> at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:307)
>
> at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:307)
>
> at
> com.ascenditsolutions.lca.model.dao.rio.Lerg7DAO.findByClli8(Lerg7DAO.java:263)
>
> at
> com.ascenditsolutions.lca.invoice.csr.CktCklNode.loadHVCoords(CktCklNode.java:283)
>
> at
> com.ascenditsolutions.lca.invoice.csr.CktCklNode.<init>(CktCklNode.java:114)
>
> at
> com.ascenditsolutions.lca.invoice.csr.CsrCircuit.addCklNode(CsrCircuit.java:460)
>
> at
> com.ascenditsolutions.lca.invoice.csr.CsrCircuit.addNode(CsrCircuit.java:441)
>
> at
> com.ascenditsolutions.lca.invoice.csr.CsrCircuit.extractCsrAccountRecordData(CsrCircuit.java:324)
>
> at
> com.ascenditsolutions.lca.invoice.csr.CsrCircuit.initialize(CsrCircuit.java:236)
>
> at
> com.ascenditsolutions.lca.invoice.csr.CsrClsCircuit.<init>(CsrClsCircuit.java:31)
>
> at
> com.ascenditsolutions.lca.invoice.csr.CsrCircuitFactory.getCsrCircuit(CsrCircuitFactory.java:64)
>
> at
> com.ascenditsolutions.lca.invoice.csr.CsrCircuitFactory.getCsrCircuit(CsrCircuitFactory.java:127)
>
> at
> com.ascenditsolutions.lca.invoice.circuit.InvoiceCircuit.getCsrCircuit(InvoiceCircuit.java:149)
>
> at
> com.ascenditsolutions.lca.invoice.circuit.InvoiceCircuit.getUsocs(InvoiceCircuit.java:192)
>
> at
> com.ascenditsolutions.lca.invoice.validation.CircuitValidator.validate(CircuitValidator.java:88)
>
> at
> com.ascenditsolutions.lca.invoice.validation.InvoiceValidation.validate(InvoiceValidation.java:104)
>
> at
> com.ascenditsolutions.lca.invoicevalidator.InvoiceValidator.validateInvoice(InvoiceValidator.java:172)
>
> at
> com.ascenditsolutions.lca.invoicevalidator.LcaQueuedInvoiceValidator.run(LcaQueuedInvoiceValidator.java:98)
>
> at
> com.ascenditsolutions.lca.invoicevalidator.LcaQueuedInvoiceValidator.main(LcaQueuedInvoiceValidator.java:44)
>
> Caused by: java.sql.SQLException: Invalid column name 'eff'.
> at
> net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:364)
>
> at
> net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2778)
> at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2214)
> at
> net.sourceforge.jtds.jdbc.TdsCore.clearResponseQueue(TdsCore.java:697)
> at net.sourceforge.jtds.jdbc.TdsCore.submitSQL(TdsCore.java:864)
> at
> net.sourceforge.jtds.jdbc.TdsCore.microsoftPrepare(TdsCore.java:1093)
> at
> net.sourceforge.jtds.jdbc.ConnectionJDBC2.prepareSQL(ConnectionJDBC2.java:537)
>
> at
> net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:664)
>
> at
> org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:205)
>
> at
> org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:205)
>
> at
> org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(JdbcAccessImpl.java:312)
>
> ... 25 more
>
>
> ==========================================================================================
>
> Column Name with "-" stack trace
> ==========================================================================================
>
>
>
> 235300 ERROR [main] rio.Lerg7DAO - PersistenceBrokerException thrown in
> Lerg7DAO.findByClli8().
> org.apache.ojb.broker.PersistenceBrokerException: Error reading class
> type: com.ascenditsolutions.lca.model.vo.rio.Lerg7VO from result set,
> current read field was vCoord
> at
> org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.readValuesFrom(RowReaderDefaultImpl.java:231)
>
> at
> org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.readObjectArrayFrom(RowReaderDefaultImpl.java:199)
>
> at
> org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(RsIterator.java:450)
>
> at
> org.apache.ojb.broker.accesslayer.RsIterator.next(RsIterator.java:275)
> at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(PersistenceBrokerImpl.java:1636)
>
> at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:307)
>
> at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:307)
>
> at
> com.ascenditsolutions.lca.model.dao.rio.Lerg7DAO.findByClli8(Lerg7DAO.java:263)
>
> at
> com.ascenditsolutions.lca.invoice.csr.CktCklNode.loadHVCoords(CktCklNode.java:283)
>
> at
> com.ascenditsolutions.lca.invoice.csr.CktCklNode.<init>(CktCklNode.java:114)
>
> at
> com.ascenditsolutions.lca.invoice.csr.CsrCircuit.addCklNode(CsrCircuit.java:460)
>
> at
> com.ascenditsolutions.lca.invoice.csr.CsrCircuit.addNode(CsrCircuit.java:441)
>
> at
> com.ascenditsolutions.lca.invoice.csr.CsrCircuit.extractCsrAccountRecordData(CsrCircuit.java:324)
>
> at
> com.ascenditsolutions.lca.invoice.csr.CsrCircuit.initialize(CsrCircuit.java:236)
>
> at
> com.ascenditsolutions.lca.invoice.csr.CsrRidingHighCapClsCircuit.<init>(CsrRidingHighCapClsCircuit.java:30)
>
> at
> com.ascenditsolutions.lca.invoice.csr.CsrCircuitFactory.getCsrCircuit(CsrCircuitFactory.java:73)
>
> at
> com.ascenditsolutions.lca.invoice.csr.CsrCircuitFactory.getCsrCircuit(CsrCircuitFactory.java:127)
>
> at
> com.ascenditsolutions.lca.invoice.circuit.InvoiceCircuit.getCsrCircuit(InvoiceCircuit.java:149)
>
> at
> com.ascenditsolutions.lca.invoice.circuit.InvoiceCircuit.getUsocs(InvoiceCircuit.java:192)
>
> at
> com.ascenditsolutions.lca.invoice.validation.CircuitValidator.validate(CircuitValidator.java:88)
>
> at
> com.ascenditsolutions.lca.invoice.validation.InvoiceValidation.validate(InvoiceValidation.java:104)
>
> at
> com.ascenditsolutions.lca.invoicevalidator.InvoiceValidator.validateInvoice(InvoiceValidator.java:172)
>
> at
> com.ascenditsolutions.lca.invoicevalidator.LcaQueuedInvoiceValidator.run(LcaQueuedInvoiceValidator.java:98)
>
> at
> com.ascenditsolutions.lca.invoicevalidator.LcaQueuedInvoiceValidator.main(LcaQueuedInvoiceValidator.java:44)
>
> Caused by: java.sql.SQLException: Invalid column name [v-coord].
> at
> net.sourceforge.jtds.jdbc.JtdsResultSet.findColumn(JtdsResultSet.java:938)
> at
> net.sourceforge.jtds.jdbc.JtdsResultSet.getString(JtdsResultSet.java:1173)
> at
> org.apache.commons.dbcp.DelegatingResultSet.getString(DelegatingResultSet.java:216)
>
> at
> org.apache.commons.dbcp.DelegatingResultSet.getString(DelegatingResultSet.java:216)
>
> at
> org.apache.ojb.broker.metadata.JdbcTypesHelper$T_Varchar.readValueFromResultSet(JdbcTypesHelper.java:404)
>
> at
> org.apache.ojb.broker.metadata.JdbcTypesHelper$BaseType.getObjectFromColumn(JdbcTypesHelper.java:324)
>
> at
> org.apache.ojb.broker.metadata.JdbcTypesHelper$BaseType.getObjectFromColumn(JdbcTypesHelper.java:303)
>
> at
> org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.readValuesFrom(RowReaderDefaultImpl.java:224)
>
> ... 23 more
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: column names with spaces, etc.
Posted by JKramer <ja...@ascenditsolutions.com>.
Thomas Dudziak wrote:
> Could you post the complete stack trace, as it might be an error from
> the JDBC driver or even the database.
>
> Tom
Tom,
Right!
OK. I've appended two different stack traces below: one for a column
name with a space and one with a "-" in that order.
In both cases the exception cuase is the same:
Caused by: java.sql.SQLException: Invalid column name
However, they begin at two different places within JTDS.
Is it possible that OJB is stripping the square brackets off of the
column name? I suppose that I could try writing some JDBC code and going
directly to the JTDS driver to better isolate the problem. Any other
suggestions?
Final note, the repository segment provided in my original post was from
an earlier version of the file. The column names ARE enclosed in []s in
the actual file being used.
thanks!
John
==========================================================================================
Column Name with space stack trace
==========================================================================================
99389 ERROR [main] rio.Lerg7DAO - PersistenceBrokerException thrown in
Lerg7DAO.findByClli8().
org.apache.ojb.broker.PersistenceBrokerSQLException: SQLException during
the execution of the query (for
com.ascenditsolutions.lca.model.vo.rio.Lerg7VO): Invalid column name 'eff'.
at
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(JdbcAccessImpl.java:349)
at
org.apache.ojb.broker.accesslayer.RsQueryObject.performQuery(RsQueryObject.java:74)
at
org.apache.ojb.broker.accesslayer.RsIterator.<init>(RsIterator.java:185)
at
org.apache.ojb.broker.core.RsIteratorFactoryImpl.createRsIterator(RsIteratorFactoryImpl.java:58)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getRsIteratorFromQuery(PersistenceBrokerImpl.java:1918)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getIteratorFromQuery(PersistenceBrokerImpl.java:1493)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(PersistenceBrokerImpl.java:1620)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:307)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:307)
at
com.ascenditsolutions.lca.model.dao.rio.Lerg7DAO.findByClli8(Lerg7DAO.java:263)
at
com.ascenditsolutions.lca.invoice.csr.CktCklNode.loadHVCoords(CktCklNode.java:283)
at
com.ascenditsolutions.lca.invoice.csr.CktCklNode.<init>(CktCklNode.java:114)
at
com.ascenditsolutions.lca.invoice.csr.CsrCircuit.addCklNode(CsrCircuit.java:460)
at
com.ascenditsolutions.lca.invoice.csr.CsrCircuit.addNode(CsrCircuit.java:441)
at
com.ascenditsolutions.lca.invoice.csr.CsrCircuit.extractCsrAccountRecordData(CsrCircuit.java:324)
at
com.ascenditsolutions.lca.invoice.csr.CsrCircuit.initialize(CsrCircuit.java:236)
at
com.ascenditsolutions.lca.invoice.csr.CsrClsCircuit.<init>(CsrClsCircuit.java:31)
at
com.ascenditsolutions.lca.invoice.csr.CsrCircuitFactory.getCsrCircuit(CsrCircuitFactory.java:64)
at
com.ascenditsolutions.lca.invoice.csr.CsrCircuitFactory.getCsrCircuit(CsrCircuitFactory.java:127)
at
com.ascenditsolutions.lca.invoice.circuit.InvoiceCircuit.getCsrCircuit(InvoiceCircuit.java:149)
at
com.ascenditsolutions.lca.invoice.circuit.InvoiceCircuit.getUsocs(InvoiceCircuit.java:192)
at
com.ascenditsolutions.lca.invoice.validation.CircuitValidator.validate(CircuitValidator.java:88)
at
com.ascenditsolutions.lca.invoice.validation.InvoiceValidation.validate(InvoiceValidation.java:104)
at
com.ascenditsolutions.lca.invoicevalidator.InvoiceValidator.validateInvoice(InvoiceValidator.java:172)
at
com.ascenditsolutions.lca.invoicevalidator.LcaQueuedInvoiceValidator.run(LcaQueuedInvoiceValidator.java:98)
at
com.ascenditsolutions.lca.invoicevalidator.LcaQueuedInvoiceValidator.main(LcaQueuedInvoiceValidator.java:44)
Caused by: java.sql.SQLException: Invalid column name 'eff'.
at
net.sourceforge.jtds.jdbc.SQLDiagnostic.addDiagnostic(SQLDiagnostic.java:364)
at
net.sourceforge.jtds.jdbc.TdsCore.tdsErrorToken(TdsCore.java:2778)
at net.sourceforge.jtds.jdbc.TdsCore.nextToken(TdsCore.java:2214)
at
net.sourceforge.jtds.jdbc.TdsCore.clearResponseQueue(TdsCore.java:697)
at net.sourceforge.jtds.jdbc.TdsCore.submitSQL(TdsCore.java:864)
at
net.sourceforge.jtds.jdbc.TdsCore.microsoftPrepare(TdsCore.java:1093)
at
net.sourceforge.jtds.jdbc.ConnectionJDBC2.prepareSQL(ConnectionJDBC2.java:537)
at
net.sourceforge.jtds.jdbc.JtdsPreparedStatement.executeQuery(JtdsPreparedStatement.java:664)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:205)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:205)
at
org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeQuery(JdbcAccessImpl.java:312)
... 25 more
==========================================================================================
Column Name with "-" stack trace
==========================================================================================
235300 ERROR [main] rio.Lerg7DAO - PersistenceBrokerException thrown in
Lerg7DAO.findByClli8().
org.apache.ojb.broker.PersistenceBrokerException: Error reading class
type: com.ascenditsolutions.lca.model.vo.rio.Lerg7VO from result set,
current read field was vCoord
at
org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.readValuesFrom(RowReaderDefaultImpl.java:231)
at
org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.readObjectArrayFrom(RowReaderDefaultImpl.java:199)
at
org.apache.ojb.broker.accesslayer.RsIterator.getObjectFromResultSet(RsIterator.java:450)
at
org.apache.ojb.broker.accesslayer.RsIterator.next(RsIterator.java:275)
at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(PersistenceBrokerImpl.java:1636)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:307)
at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(DelegatingPersistenceBroker.java:307)
at
com.ascenditsolutions.lca.model.dao.rio.Lerg7DAO.findByClli8(Lerg7DAO.java:263)
at
com.ascenditsolutions.lca.invoice.csr.CktCklNode.loadHVCoords(CktCklNode.java:283)
at
com.ascenditsolutions.lca.invoice.csr.CktCklNode.<init>(CktCklNode.java:114)
at
com.ascenditsolutions.lca.invoice.csr.CsrCircuit.addCklNode(CsrCircuit.java:460)
at
com.ascenditsolutions.lca.invoice.csr.CsrCircuit.addNode(CsrCircuit.java:441)
at
com.ascenditsolutions.lca.invoice.csr.CsrCircuit.extractCsrAccountRecordData(CsrCircuit.java:324)
at
com.ascenditsolutions.lca.invoice.csr.CsrCircuit.initialize(CsrCircuit.java:236)
at
com.ascenditsolutions.lca.invoice.csr.CsrRidingHighCapClsCircuit.<init>(CsrRidingHighCapClsCircuit.java:30)
at
com.ascenditsolutions.lca.invoice.csr.CsrCircuitFactory.getCsrCircuit(CsrCircuitFactory.java:73)
at
com.ascenditsolutions.lca.invoice.csr.CsrCircuitFactory.getCsrCircuit(CsrCircuitFactory.java:127)
at
com.ascenditsolutions.lca.invoice.circuit.InvoiceCircuit.getCsrCircuit(InvoiceCircuit.java:149)
at
com.ascenditsolutions.lca.invoice.circuit.InvoiceCircuit.getUsocs(InvoiceCircuit.java:192)
at
com.ascenditsolutions.lca.invoice.validation.CircuitValidator.validate(CircuitValidator.java:88)
at
com.ascenditsolutions.lca.invoice.validation.InvoiceValidation.validate(InvoiceValidation.java:104)
at
com.ascenditsolutions.lca.invoicevalidator.InvoiceValidator.validateInvoice(InvoiceValidator.java:172)
at
com.ascenditsolutions.lca.invoicevalidator.LcaQueuedInvoiceValidator.run(LcaQueuedInvoiceValidator.java:98)
at
com.ascenditsolutions.lca.invoicevalidator.LcaQueuedInvoiceValidator.main(LcaQueuedInvoiceValidator.java:44)
Caused by: java.sql.SQLException: Invalid column name [v-coord].
at
net.sourceforge.jtds.jdbc.JtdsResultSet.findColumn(JtdsResultSet.java:938)
at
net.sourceforge.jtds.jdbc.JtdsResultSet.getString(JtdsResultSet.java:1173)
at
org.apache.commons.dbcp.DelegatingResultSet.getString(DelegatingResultSet.java:216)
at
org.apache.commons.dbcp.DelegatingResultSet.getString(DelegatingResultSet.java:216)
at
org.apache.ojb.broker.metadata.JdbcTypesHelper$T_Varchar.readValueFromResultSet(JdbcTypesHelper.java:404)
at
org.apache.ojb.broker.metadata.JdbcTypesHelper$BaseType.getObjectFromColumn(JdbcTypesHelper.java:324)
at
org.apache.ojb.broker.metadata.JdbcTypesHelper$BaseType.getObjectFromColumn(JdbcTypesHelper.java:303)
at
org.apache.ojb.broker.accesslayer.RowReaderDefaultImpl.readValuesFrom(RowReaderDefaultImpl.java:224)
... 23 more
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: column names with spaces, etc.
Posted by Thomas Dudziak <to...@gmail.com>.
Could you post the complete stack trace, as it might be an error from
the JDBC driver or even the database.
Tom
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org