-
1. Re: Oracle JDBC table names
adrian.brock Sep 20, 2003 12:01 PM (in response to davidsills)Wrong forum.
<alias-max-length>
in conf/standardjbosscmp-jdbc.xml
Regards,
Adrian -
2. Re: Oracle JDBC table names
ottomix Oct 20, 2003 9:29 AM (in response to davidsills)This is because the fixTableName method of the org.jboss.ejb.plugins.cmp.jdbc.SQLUtil class uses the DatabaseMetaData class to establish the max table name length.
Here is an excerpt from the code:
public static String fixTableName(String tableName, DataSource dataSource) throws DeploymentException {
Connection con = null;
try {
con = dataSource.getConnection();
DatabaseMetaData dmd = con.getMetaData();
// fix length
int maxLength = dmd.getMaxTableNameLength();
if(maxLength > 0 && tableName.length() > maxLength) {
CRC32 crc = new CRC32();
crc.update(tableName.getBytes());
String nameCRC = Long.toString(crc.getValue(), 36);
tableName = tableName.substring(
0,
maxLength - nameCRC.length() - 2);
tableName += "_" + nameCRC;
}
}
The oracle.jdbc.OracleDatabaseMetaData implements getMaxTableNameLength as follows:
public int getMaxTableNameLength()
throws SQLException
{
connection.trace("getMaxTableNameLength");
return 30;
}
So the absolute limit is 30 as you suspected.
I am encountering the same problem when connecting to the Oracle database with a user that has to view tables in another schema.
I would like to know how to tell JBoss the schema name to qualify table names with, but have yet to figure out how to do this.