Can't seem to UPDATE dBase table

G

Glenn Robinson

Hello,

I'm using jdbc-odbc bridge to try and update a .dbf table.

My code is as follows:

stmt.executeUpdate(
"INSERT INTO sas.dbf VALUES ('1234', '1234567', '1', '1234',
'12:34:56', '2004-06-18', '1','1234',)");

When I run it I get a syntax error in INSERT INTO statement, the following
in my ODBC trace file:


<snip>
java 45c-538 ENTER SQLSetStmtOption
HSTMT 08E421D8
UWORD 7 <SQL_CONCURRENCY>
SQLPOINTER 0x00000001

java 45c-538 EXIT SQLSetStmtOption with return code 0
(SQL_SUCCESS)
HSTMT 08E421D8
UWORD 7 <SQL_CONCURRENCY>
SQLPOINTER 0x00000001 (BADMEM)

java 45c-538 ENTER SQLFreeStmt
HSTMT 08E421D8
UWORD 0 <SQL_CLOSE>

java 45c-538 EXIT SQLFreeStmt with return code 0 (SQL_SUCCESS)
HSTMT 08E421D8
UWORD 0 <SQL_CLOSE>

java 45c-538 ENTER SQLExecDirect
HSTMT 08E421D8
UCHAR * 0x008EC9C8 [ -3] "INSERT INTO sas.dbf VALUES
('1234', '1234567', '1', '1234', '12:34:56', '2004-06-18', '1','1234',)\ 0"
SDWORD -3

java 45c-538 EXIT SQLExecDirect with return code -1 (SQL_ERROR)
HSTMT 08E421D8
UCHAR * 0x008EC9C8 [ -3] "INSERT INTO sas.dbf VALUES
('1234', '1234567', '1', '1234', '12:34:56', '2004-06-18', '1','1234',)\ 0"
SDWORD -3

DIAG [37000] [Microsoft][ODBC dBase Driver] Syntax error in INSERT INTO
statement. (-3502)

java 45c-538 ENTER SQLErrorW
HENV 00000000
HDBC 00000000
HSTMT 08E421D8
WCHAR * 0x0007F900 (NYI)
SDWORD * 0x0007F944
WCHAR * 0x0007F500
SWORD 300
SWORD * 0x0007F940

java 45c-538 EXIT SQLErrorW with return code 0 (SQL_SUCCESS)
HENV 00000000
HDBC 00000000
HSTMT 08E421D8
WCHAR * 0x0007F900 (NYI)
SDWORD * 0x0007F944 (-3502)
WCHAR * 0x0007F500 [ 69] "[Microsoft][ODBC dBase Driver]
Syn"
SWORD 300
SWORD * 0x0007F940 (69)

java 45c-538 ENTER SQLErrorW
HENV 00000000
HDBC 00000000
HSTMT 08E421D8
WCHAR * 0x0007F900 (NYI)
SDWORD * 0x0007F944
WCHAR * 0x0007F500
SWORD 300
SWORD * 0x0007F940

java 45c-538 EXIT SQLErrorW with return code 100
(SQL_NO_DATA_FOUND)
HENV 00000000
HDBC 00000000
HSTMT 08E421D8
WCHAR * 0x0007F900 (NYI)
SDWORD * 0x0007F944
WCHAR * 0x0007F500
SWORD 300
SWORD * 0x0007F940

<snip>


All columns are character apart from the 6th one which is a date type and I
suspect this is what's causing me a problem.

Can anyone shed any light on this?

Thanks
 
C

Colin 't Hart

I'm using jdbc-odbc bridge to try and update a .dbf table.

My code is as follows:

stmt.executeUpdate(
"INSERT INTO sas.dbf VALUES ('1234', '1234567', '1', '1234',
'12:34:56', '2004-06-18', '1','1234',)");

<snip>

I would always specify the columns that you are inserting into.

It may also give you more clues as to what is going on.

Cheers,

Colin
 
G

Glenn Robinson

Colin 't Hart said:
<snip>

I would always specify the columns that you are inserting into.

It may also give you more clues as to what is going on.

Cheers,

Colin

Tried that already, didn't make any difference.
 
M

mromarkhan

Glenn said:
Hello,
stmt.executeUpdate(
"INSERT INTO sas.dbf VALUES ('1234', '1234567', '1', '1234',
'12:34:56', '2004-06-18', '1','1234',)");

Peace be unto you.

Somebody might already have posted the
correct solution.
However, I noticed the dangling comma at the end
of your statement.

Just a guess. It may be that you are right.

Have a good day.
 
L

Liz

Peace be unto you.

Somebody might already have posted the
correct solution.
However, I noticed the dangling comma at the end
of your statement.

Just a guess. It may be that you are right.

Have a good day.

Is sas.dbf a String that contains the table name?
 
G

Glenn Robinson

Peace be unto you.

Somebody might already have posted the
correct solution.
However, I noticed the dangling comma at the end
of your statement.

Just a guess. It may be that you are right.

Have a good day.


Oh, how foolish do I feel. It was the dangling comma a the end

Thanks from a very embarrassed person
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top