This is what my code looks like:
public void userAdd()
{
try
{
stmt = con.createStatement(rs.TYPE_SCROLL_SENSITIVE,
rs.CONCUR_UPDATABLE);
rs = stmt.executeQuery("SELECT * FROM TIMELOGGER");
stmt.executeUpdate("INSERT INTO TIMELOG" +
"VALUES 'test','test',#10/0/2002#,#7:00#,#7:00#,#7:00#,#7:00#,#7:00#,'x',20");
}
catch(Exception e){}
}
Right now im using temp data, somereason this will not work. Are
there anyways that a insert can be made simpler?
Halve
> stmt.executeUpdate("INSERT INTO TIMELOG" +
> "VALUES 'test','test',#10/0/2002#,#7:00#,#7:00#,#7:00#,#7:00#,#7:00#,'x',20");
10/0/2002 ?
use a preparedStatement and setTime() setDate() to fill in all the
required parameters.
Davide
First, as Davide pointed out, use a PreparedStatement. Second, in the
situation you have here, one common mistake is to forget the space
between the TIMELOG and the VALUES. Remember that the string in the
first line and the string in the second line are concatenated, so
where you meant to write "INSERT INTO TIMELOG VALUES ..." you actually
may have "INSERT INTO TIMELOGVALUES ..."
which of course is not quite the same thing!
Ingo
And you have a driver that supports JDBC2? Such beasts are available, but not
easily.
Steve
CONCUR_UPDATABLE option is not support for access database.
Cheers,
Kel
"halve" <hal...@hotmail.com> wrote in message
news:5beb0f9e.02040...@posting.google.com...
How can one verify this since:
dbmd.supportsResultSetConcurrency(1008) returns True for MS Access db driver
version 2.0001 (04.00.4403)
I'm trying someting different with Access but having problems as well...
Thanks,
Pete
"kelzam" <kel...@pacific.net.sg> wrote in message
news:a8lh5p$45d$1...@newton.pacific.net.sg...
but, nonetheless, I tried that with my Access ODBC driver and the Sun JDBC
bridge driver and got "true," even though I know that driver combination
doesn't support the operation.
I access Access using the IDS Server with it's drivers and everything works
jsut fine.
Steve
"PimentoTR6" <pimen...@cs.compost> wrote in message
news:20020409103621...@mb-mo.news.cs.com...
If you mean from
dbmd.supportsResultSetConcurrency(1008)
to
dbmd.supportsResultSetConcurrency(ResultSet.TYPE_SCROLL_SENSITIVE,
ResultSet.CONCUR_UPDATABLE);
Well, the second will compile, the first won't, all other issues about using
named constants vs their actual values aside.
>How do you know that particular
>operations aren't supported by the driver?
The first clue I had was when it threw an exception:
java.lang.NullPointerException
at
sun.jdbc.odbc.JdbcOdbcBoundCol.setRowValues(JdbcOdbcBoundCol.java:240
)
at
sun.jdbc.odbc.JdbcOdbcResultSet.updateChar(JdbcOdbcResultSet.java:376
7)
at
sun.jdbc.odbc.JdbcOdbcResultSet.updateString(JdbcOdbcResultSet.java:3
257)
at JDBCConstants.main(JDBCConstants.java:22)
When I tried to call updateString.
I got a different exception when I tried absolute(int):
java.sql.SQLException: Result set type is TYPE_FORWARD_ONLY
at
sun.jdbc.odbc.JdbcOdbcResultSet.absolute(JdbcOdbcResultSet.java:2358)
at JDBCConstants.main(JDBCConstants.java:18)
When I specifically asked for TYPE_SCROLL_SENSITIVE
All that aside, rereading the original post, it isn't a concurrency issue at
all, since the OP isn't using moveToInsertRow and insertRow to add the
data--but the somewhat typo-laden:
rs = stmt.executeQuery("SELECT * FROM TIMELOGGER");
stmt.executeUpdate("INSERT INTO TIMELOG" +
"VALUES
'test','test',#10/0/2002#,#7:00#,#7:00#,#7:00#,#7:00#,#7:00#,'x',20");
Assuming the typos were in transcription and not in the true code, and that all
the fields are where and what they are supposed to be, the only other thing I
can think of is to do rs.close() first (or for that matter, don't even run the
select query if the data isn't going to be used).
Steve
I use JBuilder. The debugger reflect that java.sql.SQLException:
[Microsoft][ODBC Microsoft Access Driver]Optional feature not implemented.
I discover the moment CONCUR_UPDATABLE is set, my code will not work.
Cheers,
Kel
"1" <1@1> wrote in message news:a8umav$ao...@shark.pwgsc.gc.ca...
"kelzam" <kel...@pacific.net.sg> wrote in message
news:a90ub7$lp9$1...@newton.pacific.net.sg...