Hi,
I'm trying to use your jdbc driver to access old cobol archives.
For every entity I have two files: ANACOIN (without extension) and ANACOIN.vix.
Here my code:
Class.forName("com.hxtt.sql.cobol.CobolDriver").newInstance();
String url = "jdbc:cobol:/X:/conta";
String sql = "select * from ANACOIN";
Connection con = DriverManager.getConnection(url, "admin", "");
Statement stmt = con.createStatement();
stmt.setFetchSize(10);
ResultSet rs = stmt.executeQuery(sql);
On the last row I obtain an exception:
Table X:\CONTA\ANACOIN.dat doesn't exist.
Where am I wrong?
Regards,
Cler
|
> String url = "jdbc:cobol:/X:/conta";
String url = "jdbc:cobol:/X:/conta?fileExtension=;";
|
Ok, now get the following exception:
"Need Cobol source code file, Copybook file, FD file, XFD file, SEL file, or CREATE TABLE sql to define the table structure of X:\CONTA\ANACOIN"
|
Where's your data structrue description? ANACOIN.CBL, ANACOIN.CPY, ANACOIN.SEL, ANACOIN.FD, ANACOIN.XFD, and so on.
|
Thank you, I set the url with fddir parameter and now I can't get the structure of the archive.
When I loop the result set to get field value I obtain strange chars:
4 CONTO-ACQUISTI INTEGER => null
15 ALIQUOTA-IVA-NOLEGGI INTEGER =>
16 CODICE-ABC VARCHAR => null
17 PREZZO-VENDITA JAVA_OBJECT =>
18 SCONTO2-VEND-PERC JAVA_OBJECT => [[Ljava.lang.Object;@745f0d2e
19 SCONTO-VEND-IMPORTO JAVA_OBJECT => null
20 PROVVIGIONE-PER-LISTINO JAVA_OBJECT => [[Ljava.lang.Object;@c5a82b2
21 COSTO-ULTIMO-ACQUISTO DECIMAL => [[Ljava.lang.Object;@a3a7a74
22 SCONTO-ACQ-PERC JAVA_OBJECT =>
23 MAGGIOR-ACQ-PERC DECIMAL =>
24 MAGGIOR-ACQ-IMP DECIMAL => null
How can I solve?
|
>20 PROVVIGIONE-PER-LISTINO JAVA_OBJECT => [[Ljava.lang.Object;@c5a82b2
>21 COSTO-ULTIMO-ACQUISTO DECIMAL => [[Ljava.lang.Object;@a3a7a74
According to that infromation, you should use resultSet.getObject(i-1), since maybe 21 value should be 20 value.
Because your value is JAVA_OBJECT, then your column should be array column or repeat column. You can use the following function:
colval = rs.getObject(j);
printValue(colval);
private static final void printValue(Object value){
if(value instanceof Object[]){
Object[] values=(Object[])value;
System.out.print("(");
for(int kk=0;kk if(kk>0)
System.out.print(",");
printValue(values[kk]);
}
System.out.print(")");
}else{
System.out.print(value);
}
}
|
BTW, there's no fddir parameter, you can use dir4fileDescription connection property.
|