Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

JDBC:ODBC - Feature not implemented?

0 views
Skip to first unread message

Alexey Kuznetsov

unread,
Jul 18, 2001, 2:09:55 AM7/18/01
to
Hello, All !

Suggest please why the following code throws an exception:
...
Connection con = DriverManager.getConnection("jdbc:odbc:DB;uid=sa;");
PreparedStatement ps = con.prepareStatement("INSERT INTO log VALUES (?,
1)");
ps.setDate(1, new java.sql.Date(System.currentTimeMillis()));
ps.executeUpdate();
....

Exception in thread "main" java.sql.SQLException: [Microsoft][ODBC SQL
Server Dr
iver]Optional feature not implemented
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6031)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:6188)
at sun.jdbc.odbc.JdbcOdbc.SQLBindInParameterDate(JdbcOdbc.java:752)
at
sun.jdbc.odbc.JdbcOdbcPreparedStatement.setDate(JdbcOdbcPreparedState
ment.java:833)

Here is the table definition SQL statement:
create table log (
execdate datetime not null,
toolid int not null
)


Any help is very appreciated!

Thanx!

Alexey

dbia...@square.nl

unread,
Jul 18, 2001, 1:56:07 AM7/18/01
to
In comp.lang.java.databases Alexey Kuznetsov <get...@pochta.org> wrote:
> Exception in thread "main" java.sql.SQLException: [Microsoft][ODBC SQL
> Server Dr
> iver]Optional feature not implemented

Well, looks clear to me, that the Odbc driver you are using does
not implement the ability to bind parameters in a query.
Use a "real" Jdbc driver (type 3 or type 4). There is a list
on www.mindprod.com

Davide

Petr Aubrecht

unread,
Jul 18, 2001, 3:14:17 AM7/18/01
to
> Well, looks clear to me, that the Odbc driver you are using does
> not implement the ability to bind parameters in a query.
> Use a "real" Jdbc driver (type 3 or type 4). There is a list
> on www.mindprod.com
> Davide

You probably ment http://mindprod.com or more specifically
http://mindprod.com/jdbc.html#JDBCLIST.

Petr

dbia...@square.nl

unread,
Jul 18, 2001, 3:47:26 AM7/18/01
to
In comp.lang.java.programmer Petr Aubrecht <aub...@labe.felk.cvut.cz> wrote:
> http://mindprod.com/jdbc.html#JDBCLIST.

that's too easy.... ;p

Davide

Alexey Kuznetsov

unread,
Jul 18, 2001, 10:40:14 PM7/18/01
to

<dbia...@square.nl> wrote in message
news:9j38dn$lceg0$1...@ID-18487.news.dfncis.de...

> Well, looks clear to me, that the Odbc driver you are using does
> not implement the ability to bind parameters in a query.
> Use a "real" Jdbc driver (type 3 or type 4). There is a list
> on www.mindprod.com

I've changed java.sql.Date to java.sql.Timestamp. All became OK. My ODBC
driver has the ability to bind params

Lee Fesperman

unread,
Jul 19, 2001, 2:26:29 AM7/19/01
to
Alexey Kuznetsov wrote:
>
> Hello, All !
>
> Suggest please why the following code throws an exception:
> ...
> Connection con = DriverManager.getConnection("jdbc:odbc:DB;uid=sa;");
> PreparedStatement ps = con.prepareStatement("INSERT INTO log VALUES (?,
> 1)");
> ps.setDate(1, new java.sql.Date(System.currentTimeMillis()));
> ps.executeUpdate();
> ....

Try ps.setTimestamp(1, new java.sql.Timestamp(...

--
Lee Fesperman, FFE Software, Inc. (http://www.firstsql.com)
===================================================================
* Check out Database Debunkings (http://www.firstsql.com/dbdebunk/)
* "The Forum Where Database Matters Are Set Straight"

Alexey Kuznetsov

unread,
Jul 19, 2001, 3:38:56 AM7/19/01
to
Gee, it works. Thanx!

"Lee Fesperman" <firs...@ix.netcom.com> wrote in message
news:3B567D...@ix.netcom.com...

Jeff Robertson

unread,
Jul 19, 2001, 5:10:10 PM7/19/01
to
"Alexey Kuznetsov" <get...@pochta.org> wrote in message news:<9j35gr$8rj$1...@news.sovam.com>...

What happens if you use java.sql.Timestamp instead of java.sql.Date? I
would suspect that Timestamp maps to "datetime" better than Date. Just
a guess... I've never used the JDBC/ODBC bridge.

0 new messages