Results 1 to 4 of 4
- 09-30-2009, 11:20 PM #1
Member
- Join Date
- Sep 2009
- Posts
- 2
- Rep Power
- 0
Problem with ResultSetMetaData getPrecision and getScale on .DBF files.
Its just like the topic name says. Being more specific:
Im using the following methods to test:
First i connect on the .dbf file which i would like to obtain the meta data and then i effective make the tests on the "for".Java Code:public static void main(String[] args) { try { ConexaoDBASE conexaoDBASE = new ConexaoDBASE(); conexaoDBASE.conectar(DBases.AIH); Connection conexao = conexaoDBASE.getConexao(); ResultSet resultado = BancoDAO.lerBancoCompleto(conexao, "Morb"); ResultSetMetaData metaData = resultado.getMetaData(); for (int i = 1; i <= metaData.getColumnCount(); i++) { System.out.println(metaData.getColumnName(i)); System.out.println(metaData.getPrecision(i)); System.out.println(metaData.getScale(i)); System.out.println(metaData.getColumnDisplaySize(i)); System.out.println(); } } catch (Exception e) { e.printStackTrace(); } } // main
The problem happens when the column type is Numeric. The getPrecision method aways returns 15 and the getScale aways return 0.
Here some test results, three of the .DBF columns are those:
UTI_INT_TO N 2 0
PROC_REA C 8 0
VAL_SH N 13 2
"Column Name, Type (N = Numeric, C = Char), Number of values before the comma, Number of values after the comma".
That data was extracted from the .DBF itself, and when the method i posted execute, it write:
UTI_INT_TO
15
0
22
PROC_REA
8
0
8
VAL_SH
15
0
22
For Char columns, the method correctly return me the capacity of characters which this time was 8. But for Numeric type, the metho getPrecision AWAYS return 15 and the Scale AWAYS return 0, no matter what the real values are.
Anyone got any idea about this problem or other solution to obtain the meta data that i want ?
- 10-01-2009, 09:19 AM #2
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Please read the API specs for ResultSetMetaData to find out what those methods return.
- 10-03-2009, 10:10 PM #3
Member
- Join Date
- Sep 2009
- Posts
- 2
- Rep Power
- 0
i read before but yet just read again. So, what is the point ? Maybe im missing something but i dont think so since these methods work the way i want when i test on the postgreSQL :/
- 10-05-2009, 10:10 AM #4
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Similar Threads
-
Problem Jar executable files
By Manfizy in forum New To JavaReplies: 6Last Post: 08-13-2009, 01:15 PM -
problem communication between 2 files
By Questionmark in forum AWT / SwingReplies: 6Last Post: 07-30-2009, 11:23 AM -
Data Files - A problem that I dont understand :D
By Exhonour in forum New To JavaReplies: 7Last Post: 01-20-2009, 05:13 AM -
resultsetmetadata
By thamizhisai in forum Advanced JavaReplies: 1Last Post: 05-27-2008, 07:41 AM -
Problem with executing .jar files
By hiranya in forum NetBeansReplies: 2Last Post: 10-02-2007, 07:24 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks