Hi!
I am no expert but this works for me.
try
{
Connection
conn=DriverManager.getConnection("jdbc:postgresql://myserver:5432/mydb","userName","password");
Statement stmt = conn.createStatement();
ResultSet rest = stmt.executeQuery("select last_value from cid ");
while (rest.next())
int myint = rest.getInt(1);
}
catch(SQLException sqle)
{
sqle.printStackTrace();
}
bla bla bla again.....
on psql if you go type select * from mysequence;
you will see what variables you can access. I am not sure it is last_value or last
value or current value.
sorry!!!
Hope this helps.
Anil
Felix Morley Finch wrote:
> I am a somewhat newbie with java and sql. I've run into something
> that seems odd, maybe even wrong (!).
>
> Statement seq = db.createStatement ();
> seq.execute ("SELECT nextval ('cdid')");
> ResultSet rs = seq.getResultSet ();
> id = rs.getInt (0 + 1); <=========