hi.
I try to insert a Date type value to a SQL table with JDBC(JdbcOdbcDriver);
the connection and preparestatement are right,then
sql="insert c_table (id,report_date,dep) values(?,?,?)";
PrepareStatement stmt=conn.prepareStatement(sql);
String a=new String("1234567");
Long a1=new Long(a);
long a2=a1.longValue();
java.sql.Date d=new java.sql.Date(a2);
java.sql.Date d2;
d2=d.valueOf("1998-9-16");
stmt.setInt(1,2);
stmt.setDate(2,d2);
stmt.setStrint(3,"developer");
the setInt and setString successful,but there something wrong with stmt.setDate(2,d2),I can't reslove it.if you know,help me please.
java.lang.NullPointerException
at sun.jdbc.odbc.JdbcOdbc.SQLBindInParameterDate(JdbcOdbc.java:306)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.setDate(JdbcOdbcPreparedState
ment.java:605)
Thanks in advance!
Tina
urgent:a question about use JDBC,help me please.
RE: urgent:a question about use JDBC,help me pleas
Tina,
Your question is more likely to get answered if you post it in the JDBC Forum on the Java Developer Connection:
http://forum.java.sun.com/forum.jsp?forum=48
Regards,
DG.
Your question is more likely to get answered if you post it in the JDBC Forum on the Java Developer Connection:
http://forum.java.sun.com/forum.jsp?forum=48
Regards,
DG.
RE: urgent:a question about use JDBC,help me pleas
DG,
Thank you very much,you are so kindly.
Best wish,
Tina.
Thank you very much,you are so kindly.
Best wish,
Tina.