Thread View: comp.lang.java.help
8 messages
8 total messages
Started by Alexey Kuznetsov
Wed, 18 Jul 2001 06:09
JDBC:ODBC - Feature not implemented?
Author: Alexey Kuznetsov
Date: Wed, 18 Jul 2001 06:09
Date: Wed, 18 Jul 2001 06:09
33 lines
2210 bytes
2210 bytes
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
Re: JDBC:ODBC - Feature not implemented?
Author: dbianchi
Date: Wed, 18 Jul 2001 05:56
Date: Wed, 18 Jul 2001 05:56
11 lines
1593 bytes
1593 bytes
In comp.lang.java.databases Alexey Kuznetsov <getweb@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
Re: JDBC:ODBC - Feature not implemented?
Author: Petr Aubrecht
Date: Wed, 18 Jul 2001 07:14
Date: Wed, 18 Jul 2001 07:14
10 lines
1847 bytes
1847 bytes
> 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
Re: JDBC:ODBC - Feature not implemented?
Author: dbianchi
Date: Wed, 18 Jul 2001 07:47
Date: Wed, 18 Jul 2001 07:47
6 lines
1357 bytes
1357 bytes
In comp.lang.java.programmer Petr Aubrecht <aubrech@labe.felk.cvut.cz> wrote: > http://mindprod.com/jdbc.html#JDBCLIST. that's too easy.... ;p Davide
Re: JDBC:ODBC - Feature not implemented?
Author: Alexey Kuznetsov
Date: Thu, 19 Jul 2001 02:40
Date: Thu, 19 Jul 2001 02:40
11 lines
1761 bytes
1761 bytes
<dbianchi@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
Re: JDBC:ODBC - Feature not implemented?
Author: Lee Fesperman
Date: Thu, 19 Jul 2001 06:26
Date: Thu, 19 Jul 2001 06:26
20 lines
1927 bytes
1927 bytes
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"
Re: JDBC:ODBC - Feature not implemented?
Author: Alexey Kuznetsov
Date: Thu, 19 Jul 2001 07:38
Date: Thu, 19 Jul 2001 07:38
25 lines
2211 bytes
2211 bytes
Gee, it works. Thanx!
"Lee Fesperman" <firstsql@ix.netcom.com> wrote in message
news:3B567D95.6F72@ix.netcom.com...
> 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"
Re: JDBC:ODBC - Feature not implemented?
Author: Jeff Robertson
Date: Thu, 19 Jul 2001 21:10
Date: Thu, 19 Jul 2001 21:10
31 lines
2412 bytes
2412 bytes
"Alexey Kuznetsov" <getweb@pochta.org> wrote in message news:<9j35gr$8rj$1@news.sovam.com>...
> 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
> )
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.
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads