Quantcast
Channel: MySQL Forums - Connector/J, JDBC and Java
Viewing all articles
Browse latest Browse all 884

Column Index out of range, 0 < 1 (1 reply)

$
0
0
Alright, so heres a weird one for you, when I try the following:
Statement s = c.createStatement();
ResultSet rs = s.executeQuery("SELECT * FROM usermap");
rs.next();

I get the following exception:
java.sql.SQLException: Column Index out of range, 0 < 1

Now here's where it gets weird, when I try this command:
rs.getMetaData().getColumnCount()

I get 29, and when I try this command
s.execute("SELECT * FROM usermap")

it returns true. Now here is where it gets really, really weird. When I execute the same query in the main method, if works just fine. It's just when I embed the command in the method of an object.

I have the latest versions of both mysql and the connector.

Can anyone help me with this?

Viewing all articles
Browse latest Browse all 884

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>