Problem in using createStatement with parameters

Hi,

I have a peculiar problem using JDBC-ODBC bridge driver. With this driver I am able to make a connection to the database (Oracle/SQL Server/MS-Access). But when I try to create a statement using the connection, I get an error. The code written by me is below :-

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

Connection conn = DriverManager.getConnection("jdbc:odbc:tsvt","sa","");

Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);

If I use this constructor fo createStament, I get the following Runtime Exception

java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Optional feature not implemented

java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]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.SQLExecDirect(JdbcOdbc.java:2494)

at sun.jdbc.odbc.JdbcOdbcStatement.execute(JdbcOdbcStatement.java:314)

at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:229)

at accs2oracl.<init>(accs2oracl.java:39)

at accs2oracl.main(accs2oracl.java:166)

If I use just conn.createStatement(), I dont get any error.

Some one help me out where I am going wrong

[1392 byte] By [chandan_p11] at [2007-9-26 2:28:18]
# 1

Some - or most? - ODBC driver, especially MS for SQLServer and Access, don't support these advanced JDBC features.

Like the messages says: they are optional features, and the driver doesn't implement them.

A good news:

you don't need them.

Just go through your ResultSets only forward by next(), and do all inserts, updates and deletes with executeUpdate() and SQL commands.

Hartmut at 2007-6-29 9:43:46 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 2

thanks for the suggestion.

But my problem is bit different. I want to move the resultset in the backward direction also using previous() method of the resultset, which is not possible with only con.createStatement(), because default resultset type is FORWARD_ONLY.

can you help me with that.

chandan_p11 at 2007-6-29 9:43:46 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 3
You may have to use the ORDER BY clause to retrieve them in a way that you can read them in a forward direction.Jamie
jlrober at 2007-6-29 9:43:46 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 4

Yes, exactly!

Why do all the people always want to do everything with JDBC on the client, though it's all possible in SQL on the server, and often in a much more performant and simple way?

Your programs should have enough work to do a good logic and GUI processing. Just let this entire DB stuff be done by the DBMS. That is what they were invented for!

Hartmut at 2007-6-29 9:43:46 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...
# 5

Hi,

Even using with simple ResultSets only forward by next() method and simple statement,i am getting the same problem "java.sql.SQLException: [M

icrosoft][ODBC SQL Server Driver]Optional feature not implemented".

Here i am using MS SQLServer 2000.

Thanks

Ganesh

chiluveru at 2007-6-29 9:43:46 > top of Java-index,Database Connectivity,Java Database Connectivity (JDBC)...