Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / May 2006

Tip: Looking for answers? Try searching our database.

PrepareStatement-Date field

Thread view: 
Manoj Jain - 29 Apr 2006 06:49 GMT
hi
I've prepared a query with custom date fields. I used prepared
statement and giving data from user.

//in query there is table1.[Date]>=? and table1.[Date]<=? in where
clause.
//database is SQL Server 2000

PreparedStatement pstmt=conn.prepareStatement(query);
pstmt.setDate(1,Date.valueOf("2005-01-01"));
pstmt.setDate(2,Date.valueOf("2005-12-31"));

but it shows following error
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
       at
sun.jdbc.odbc.JdbcOdbcPreparedStatement.clearParameter(JdbcOdbcPreparedStatement.java:1021)
       at
sun.jdbc.odbc.JdbcOdbcPreparedStatement.setDate(JdbcOdbcPreparedStatement.java:809)
       at com.database.Database.executeTable(Database.java:85)
       at
com.gui.MainWindow.btnPrepareActionPerformed(MainWindow.java:213)
       at com.gui.MainWindow.access$000(MainWindow.java:15)
       at com.gui.MainWindow$1.actionPerformed(MainWindow.java:110)
       at
javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
       at
javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
       at
javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
       at
javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
       at
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:234)
       at java.awt.Component.processMouseEvent(Component.java:5488)
       at
javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
       at java.awt.Component.processEvent(Component.java:5253)
       at java.awt.Container.processEvent(Container.java:1966)
       at java.awt.Component.dispatchEventImpl(Component.java:3955)
       at java.awt.Container.dispatchEventImpl(Container.java:2024)
       at java.awt.Component.dispatchEvent(Component.java:3803)
       at
java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
       at
java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
       at
java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
       at java.awt.Container.dispatchEventImpl(Container.java:2010)
       at java.awt.Window.dispatchEventImpl(Window.java:1774)
       at java.awt.Component.dispatchEvent(Component.java:3803)
       at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
       at
java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
       at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
       at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
       at
java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
       at
java.awt.EventDispatchThread.run(EventDispatchThread.java:110)

So please help me to solve it?
If you tell me how to find the exact error and or tracing the error
then it would be helpful for me.

Manoj
joeNOSPAM@BEA.com - 17 May 2006 14:58 GMT
Hi Manoj. If you're on SQL2000, you will have many fewer headaches
if you switch to the free real type-4 JDBC driver from MS. The
jdbc-odbc
bridge is old, very unreliable, and unsupported.
Joe Weinstein at BEA Systems


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.