Precision and scale set incorrectly |
Kevin |
2006-05-23 13:13:01 |
We have a set of fields in a view in DB2 that I am using to create a table in access for a data export the fields in the view are all Decimal(31,3) in access the fields are being created as number field size of decimal percison = 0 and scale = 0 because of these percision and scale values all of the mnumbers are truncated to integer types. I am using the following routine to create the table:
conn = global connection object to DB2 database;
accessConn = global connection object to Access database;
protected int createTable( String SQL, String tableName )
throws SQLException
{
int result = 0;
Statement statement = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
statement = conn.createStatement();
//statement.setFetchSize(1000);
rs = statement.executeQuery(SQL);
String createTableSQL ="create table if not exists " + tableName + " ?;";
pstmt = accessConn.prepareStatement(createTableSQL);
pstmt.setObject(1,rs); //insert a resultSet into a new table <>
pstmt.executeUpdate();
}
catch( OutOfMemoryError e )
{
e.printStackTrace();
}
finally
{
statement.close();
if( rs != null )
{
rs.close();
}
if( pstmt != null )
{
pstmt.close();
}
}
return result;
}
|
Re:Precision and scale set incorrectly |
HXTT Support |
2006-05-23 21:42:48 |
Supported. Please download the latest package.
|
Re:Re:Precision and scale set incorrectly |
Kevin |
2006-05-24 08:06:41 |
This fixed work for most fields except the fields over 28 digits. Access' maxium precision length is 28 so any field that the HXTT library set over that does not display properly. The precision needs to be capped to 28.
|
Re:Re:Re:Precision and scale set incorrectly |
HXTT Support |
2006-05-24 08:26:30 |
Supported.
|
Re:Re:Re:Re:Precision and scale set incorrectly |
Kevin |
2006-06-12 12:25:54 |
I just updated to the newest version of the access library off the website and the capping of perction at 28 digits is no longer working it creates the number fields with a percision of 31 again.
|
Re:Re:Re:Re:Re:Precision and scale set incorrectly |
HXTT Support |
2006-06-12 19:38:28 |
Sorry. Fixed again. Please download the latest package.
|
Re:Re:Re:Re:Re:Re:Precision and scale set incorrectly |
Kevin |
2006-06-22 09:44:57 |
This fix seems to work fine on a windows box when I test it but when I deploy this to our production system on linux it does not seem to work it still creates the fields with a percision of 31 instead of 28.
|
Re:Re:Re:Re:Re:Re:Re:Precision and scale set incorrectly |
HXTT Support |
2006-06-22 17:21:33 |
Check whether your classpath in Linux contains an old package
|
Re:Re:Re:Re:Re:Re:Re:Re:Precision and scale set incorrectly |
Kevin |
2006-06-23 06:38:18 |
We did check that. There isn't anthor a package on the machine and we tested it on aonther linux machine and the same thing happend.
|
Re:Re:Re:Re:Re:Re:Re:Re:Precision and scale set incorrectly |
HXTT Support |
2006-06-23 07:02:06 |
I checked too. Please download the v1.2.023 package and try it again. Thanks for your patience.
|
Re:Re:Re:Re:Re:Re:Re:Re:Precision and scale set incorrectly |
HXTT Support |
2006-06-23 07:11:22 |
BTW, if you wish to execute your same code, you should run "drop table if exists tableName"since "create table if not exists " + tableName + " ?;" won't create a table if the old table exists.
|