This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Opti onal fature not implem

 
susanth puthanveedu
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in my project i wanted insert a date object to the database for that i am using PreparedStatement.setDate(fieldNum,dateObject), i tried out the code segmets and used the java.sql.date onject only but i am gettig the exception"java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Optional feature not implemented".see the code below which i used
String sql = "insert into debug (filing_date) values (?)";

PreparedStatement insertPS = dbConn.prepareStatement(sql);

String dateS = "2001-00-01"; //That's jan 1, 2001

java.sql.Date date = java.sql.Date.valueOf(dateS);

insertPS.setDate(1,date);



insertPS.executeUpdate();
@@@@@@@@@@@@ i tried using this way also to get into the real format "MMM d, yyy"but got the exceptoin this time also, the code is

MMM d, yyy format, which java.sql.Date doesn't accept: String dateIn = "January 1, 2001"; String formatIn = "MMM d, yyyy"; // format of incoming string

//parse the date using java.util.Date classes

ParsePosition pp = new ParsePosition(0);

SimpleDateFormat sdfi = new SimpleDateFormat(formatIn);

java.util.Date date = sdfi.parse(dateIn,pp);

if( date == null ) (throw new RuntimeException"Unparsable date: "+dateIn);

//convert a java.util.Date to a java.sql.Date

java.sql.Date sqlFromLong = new java.sql.Date(date.getTime());

//output is: 2001-01-01 System.out.println("sqlFromLong (java.sql.Date): "+sqlFromLong);

pls help me regardig this thanks in advance susanth
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't use the JDBC-ODBC bridge. Use a proper type 4 driver like jTDS or the one you can download from microsoft.
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what database are you using?
 
susanth puthanveedu
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tank you Mr. C Lamont Gilbert for respondig to my query.here i am using the SQL database.
regards
susanth
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
susanth,

You have ignored Paul's response, It might be problem with ODBC driver as it states some features are not implemeneted.

Shailesh
 
susanth puthanveedu
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No shailesh i respect those who listen to my problems.for Mr. C Lamont Gilbert i can give a one word answer and for Pauls response i need to work on it.

Thank you Mr.Paul Sturrock your advice really helped me in my project. i tried using jTDS and it is working properly without giving any execptions.
Thanks a lot
regards
susanth
 
Shailesh Chandra
Ranch Hand
Posts: 1082
Java Oracle Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by susanth puthanveedu:
No shailesh i respect those who listen to my problems.


I also didn't mean that !!

I just wanted you to consider that option too, if you din't notice that post.


Shailesh
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by susanth puthanveedu:
Tank you Mr. C Lamont Gilbert for respondig to my query.here i am using the SQL database.
regards
susanth


Heh, they are all "SQL" databases. Wondering if you are using "Jet" or MS "SQL Server" or whatever its called.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic