Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDBC driver DatabaseMetadata getting DECIMAL_DIGITS causes java.lang.IndexOutOfBoundsException #8

Open
mainstreet439 opened this issue Jan 6, 2018 · 0 comments

Comments

@mainstreet439
Copy link

Attempting to iterate the Resultset returned by DatabaseMetadata.getColumns for a table with a DECIMAL, NUMERIC column etc. will result in a run time exception for column index 9 (DECIMAL_DIGITS).

ResultSet columns = dbMeta.getColumns( null, null, "TDEC", "%");
printRs("getColumns",  columns, columns.getMetaData().getColumnCount());

private void printRs(String header, ResultSet rs, int cols) throws SQLException{
	System.out.println(header);
	if (rs == null) {
		System.out.println("ResultSet was null");
	}
	long rows = 0;
	while (rs.next()) {
		for (int i = 1; i <= cols; ++i){
			System.out.print( rs.getObject(i));
			if (i < cols) {
				System.out.print(",");
			}
		}
		++rows;
		System.out.println();
	}
	System.out.println("Rows printed " + rows);
}

create table if not exists TDEC ( RNUM integer not null , CDEC decimal(7, 2 ) );

java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
at java.util.ArrayList.rangeCheck(ArrayList.java:653)
at java.util.ArrayList.get(ArrayList.java:429)
at com.mapd.jdbc.MapDResultSet.getObject(MapDResultSet.java:557)
at VendorTest.printRs(VendorTest.java:87)
at VendorTest.dumpColumns2(VendorTest.java:75)
at VendorTest.main(VendorTest.java:132)

https://docs.oracle.com/javase/8/docs/api/java/sql/DatabaseMetaData.html#getColumns-java.lang.String-java.lang.String-java.lang.String-java.lang.String-

cdessanti referenced this issue in cdessanti/mapd-core Feb 25, 2019
Correction of various issues and a little enanchement on getTables method, that, if schemaPattern is specified and there is a match with current connected user, returns only the tables and the views of current user.
cdessanti referenced this issue in cdessanti/mapd-core Feb 25, 2019
cdessanti referenced this issue in cdessanti/mapd-core Feb 25, 2019
cdessanti referenced this issue in cdessanti/mapd-core Feb 25, 2019
Correction of various issues and a little enanchement on getTables method, that, if schemaPattern is specified and there is a match with current connected user, returns only the tables and the views of current user.
cdessanti referenced this issue in cdessanti/mapd-core Feb 25, 2019
Correction of various issues and a little enanchement on getTables method, that, if schemaPattern is specified and there is a match with current connected user, returns only the tables and the views of current user.
cdessanti referenced this issue in cdessanti/mapd-core Feb 25, 2019
Correction of various issues and a little enanchement on getTables method, that, if schemaPattern is specified and there is a match with current connected user, returns only the tables and the views of current user.
cdessanti referenced this issue in cdessanti/mapd-core Feb 25, 2019
Correction of various issues and a little enanchement on getTables method, that, if schemaPattern is specified and there is a match with current connected user, returns only the tables and the views of current user.
cdessanti referenced this issue in cdessanti/mapd-core Feb 25, 2019
Correction of various issues and a little enanchement on getTables method, that, if schemaPattern is specified and there is a match with current connected user, returns only the tables and the views of current user.
cdessanti referenced this issue in cdessanti/mapd-core Feb 25, 2019
This patch correct the issues #163 #164 #310 #311

The new implementation of getPrimaryKey method makes the driver compatible with Tableau 2019.1

Now the GetTables method return a list of table and views of currenct database if the schemaPattern is null or it matches the current database name
cdessanti referenced this issue in cdessanti/mapd-core Feb 25, 2019
This patch correct the issues #163 #164 #310 #311

The new implementation of getPrimaryKey method makes the driver compatible with Tableau 2019.1

Now the GetTables method return a list of table and views of currenct database if the schemaPattern is null or it matches the current database name
cdessanti referenced this issue in cdessanti/mapd-core Feb 28, 2019
the setNull method  now add a value to data's list
dwayneberry referenced this issue in heavyai/heavydb Apr 1, 2019
the setNull method  now add a value to data's list
@randyzwitch randyzwitch transferred this issue from heavyai/heavydb Jun 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant