Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2020451 | 1.2.0 | Deepa Viswanathan | P4 | Resolved | Fixed | 1.2beta4 |
Name: eyC74480 Date: 05/05/98
Retreiving Float/Double data by java.sql.ResuleSetMetaData#getObject()
causes an error with the Windows error dialog.
This does not occur with the -nojit option. While the Float case
always causes an error dialog to be displayed, the Double case
sometimes displays null without the error dialog. Unfortunately,
we haven't found what causes the error dialog and the null message
for the Double case.
Following code demonstrates the problem. In prior to running the
Java program, register a MS-Access MDB file by the name 'access'
with the control panel. Although I do not attach the sample MDB
file with this submission because of the limitation of your Web
page, I can send you the sample MDB file by e-mail if you ask me
to.
import java.lang.*;
import java.sql.*;
public class rs1
{
public static void main(String arg[])
{
try {
/* load JDBCDriverClass */
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
con = DriverManager.getConnection("jdbc:odbc:access", "", "");
stmt = con.createStatement();
// stmt.execute("SELECT c_double FROM test");
stmt.execute("SELECT c_float FROM test");
rs = stmt.getResultSet();
printResult(rs);
con.rollback();
con.close();
} catch (Exception ex) {
ex.printStackTrace();
}
}
static void printResult(ResultSet rs) {
try {
ResultSetMetaData rsmd = null;
Object w_obj = null;
int colNum;
int j = 0;
if (rs == null) {
System.out.println("No ResultSet");
return;
} else {
rsmd = rs.getMetaData();
colNum = rsmd.getColumnCount();
}
System.out.println("** Display data **");
while (true)
{
if (rs.next() == false) {
break;
}
System.out.println("[" + (j+1) + "Step]");
for (int i = 1; i <= colNum; i++) {
System.out.print(" "+rsmd.getColumnName(i)+"=");
w_obj = rs.getObject(i);
System.out.println(w_obj);
}
j++;
}
System.out.println("Total Step:"+j+"!$Column Count:"+colNum);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
(Review ID: 29149)
======================================================================
- backported by
-
JDK-2020451 Retreiving Float/Double data thru JDBC-ODBC bridge causes an error.
-
- Resolved
-
- duplicates
-
JDK-4135345 Retreiving Float/Double data thru JDBC-ODBC bridge causes an error.
-
- Closed
-