participate


Java Database Connectivity (JDBC) - setLong () Error in MS Access
<<   Back to Forum  |   Give us Feedback
This topic has 3 replies on 1 page.
Rajeev.Asthana
Posts:135
Registered: 9/18/03
setLong () Error in MS Access   
Dec 14, 2004 2:01 AM

 
Hi,

I'm using JDBC-ODBC driver to access MS Access tables.

(Earlier when it was based on MySQL, it was running fine).

While running the program, I get error:

getEmployeeName: Prepare Statement Error ...
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Optional feature
not implemented
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLBindInParameterBigint(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setLong(Unknown Source)

...

I think the problem lies with setLong().

My code has following:

try {
pstmt.setLong (1, empno);
}

catch (NumberFormatException nex) {
System.out.println("getEmployeeName: Invalid number" + empno);
nex.printStackTrace();
}
catch (SQLException ex1) {
System.out.println("getEmployeeName: Prepare Statement Error ...");
ex1.printStackTrace();
}

......

How to resolve it? Why this code is running fine on MySQL and not in MS Access?

Any help is appreciated.

Thanks in advance.

Rajeev.
 
duffymo
Posts:27,863
Registered: 20/02/98
Re: setLong () Error in MS Access   
Dec 14, 2004 5:04 AM (reply 1 of 3)  (In reply to original post )

 
The stack trace suggests that it's because that feature is implemented in your MySQL driver but not in the JDBC-ODBC bridge.

%
 
Saish
Posts:7,249
Registered: 23/02/00
Re: setLong () Error in MS Access   
Dec 14, 2004 1:44 PM (reply 2 of 3)  (In reply to #1 )

 
There are also commercial versions of a real JDBC Access driver (rather than the JDBC-ODBC bridge) that might more fully implement the JDBC specification for Access.

- Saish
 
computercrazy
Posts:2
Registered: 7/13/04
Re: setLong () Error in MS Access   
Oct 28, 2005 9:02 AM (reply 3 of 3)  (In reply to original post )

 
I ran into this problem recently, and solved it with setBigDecimal() which does seem to be supported by the JDBC-ODBC bridge.

So my code went from something like this:
pst.setLong( 1, doc.id );

To something like this:
pst.setBigDecimal( 1, BigDecimal.valueOf(doc.id) );

Hope this works for you as well... I know it caused me pain for a while!
 
This topic has 3 replies on 1 page.
Back to Forum
 
Read the Developer Forums Code of Conduct

Click to email this message Email this Topic

Edit this Topic
  
 
 
Forums Statistics
    Users Online : 25
  • Guests : 132

About Sun forums
  • Oracle Forums is a large collection of user generated discussions. It is here to help you ask questions, find answers, and participate in discussions.

    Check out our guide on Getting started with Oracle Forums for a full walkthrough of how to best leverage the benefits of this community.

Powered by Jive Forums