Re: http://marc.theaimsgroup.com/?l=castor-dev&m=105119164811483&w=2 http://marc.theaimsgroup.com/?l=castor-dev&m=105125781517570&w=2
I'd love to use castor in a new project, but I need it to work with:
oracle, ms sql server, sybase ASA (anywhere) and sybase ASE (enterprise)
(and I'm willing to do some work to achieve this).
I'm also hoping to use an existing (big and complex) database schema
(I can add stuff, but not change what's there)
to maintain compatibility with a legacy application.
It seems most people start with a fresh schema.
Do I have much chance of succeeding?
My initial test with oracle went fine, but I've hit this
java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC]ResultSet can not
re-read row data for column 1.
with SQLServer when attempting to update a text (longvarchar) column.
(The oracle database just has a varchar column where the SQLServer one has a
text/longvarchar
so its not a fair comparison).
It seems from the above posts that the ms driver does not permit reading columns out
of order
or re-reading columns (at least when the table contains a text/longvarchar column)
and although this is unusual it is still within the jdbc spec.
So its a castor bug not a ms jdbc bug. However other bugs in bugzilla that arise when
using this driver
have been closed with WONTFIX and a recommendation to use the jtds driver.
(Although most on this list disparage the ms driver, I've used it in stress tests with
apache cocoon for the
last 2 years without a problem.)
With jtds-0.5.1.jar I got:
PersistenceException: org.exolab.castor.jdo.PersistenceException: The result set type
is TYPE_FORWARD_ONLY
Despite the "setLogWriter" (in the test programme below) I'm not getting anything
logged to the console.
What more is needed to see debug logging?
Any pointers about what I should try before using a debugger?
I'm using castor-0.9.5.2, jdk-1.4.2, win2k.
Here's my database.xml:
<database name="pinnacle" engine="sql-server">
<driver class-name="net.sourceforge.jtds.jdbc.Driver"
url="jdbc:jtds:sqlserver://AGGEDOR:1053/webtest_mss">
<param name="user" value="mss_test1"/>
<param name="password" value="pinnacle"/>
<param name="SelectMethod" value="Cursor"/>
</driver>
<mapping href="mapping.xml"/>
</database>
I won't include the mapping.xml unless asked because its rather big.
Here's my test programme:
It prints "Found 1 asset(s)." before the error with the ms jdbc driver, but not before
the error with the jtds driver.
"comments" is the name of the text/longvarchar column.
package au.com.pinnaclesoftware.test;
import au.com.pinnaclesoftware.castor.*;
import org.exolab.castor.jdo.*;
import org.exolab.castor.mapping.MappingException;
public class Test {
public static void main(String[] args) {
try {
JDO.loadConfiguration( "database.xml" );
} catch (MappingException e) {
System.out.println("MappingException: " + e);
}
JDO jdo;
Database db;
jdo = new JDO( "pinnacle" );
jdo.setLogWriter(org.exolab.castor.util.Logger.getSystemLogger());
try {
db = jdo.getDatabase();
db.begin();
OQLQuery query = db.getOQLQuery("SELECT a FROM
au.com.pinnaclesoftware.castor.Assets a WHERE asset_no = $1");
query.bind(1);
final boolean SCROLLABLE = true;
QueryResults results = query.execute(SCROLLABLE);
System.out.println("Found " + results.size() + " asset(s).");
Assets asset = (Assets) results.next();
System.out.println("Asset 1: Atype_no = " + asset.getAtype_no() + ",
Adesc_no = " + asset.getAdesc_no() + ", Comments =
" + asset.getComments());
asset.setComments(asset.getComments() + " - Appended by castor.");
System.out.println("Asset 1: Atype_no = " + asset.getAtype_no() + ",
Adesc_no = " + asset.getAdesc_no() + ", Comments =
" + asset.getComments());
db.commit();
db.close();
} catch (PersistenceException e) {
System.out.println("PersistenceException: " + e);
}
}
}
<<attachment: winmail.dat>>
