Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to insert a null value into an Access db using JDBC

Status
Not open for further replies.

dwilliams

Programmer
Jan 15, 2001
10
US
Hello all,

I'm trying to update an Access db with a null value. The db updates fine with non-null data.

The way I understand it you have code something like this.
try
{
String update_str = &quot;UPDATE <table> SET <field>= ?&quot;;
PreparedStatement pstmt = conn.prepareStatement(update_str);
pstmt.setNull(1,Types.NULL);
}
catch(SQLException e)
{
pritn e.getMessage();
print e.getErroCode();
print e.getSQLState();
}

which returns date like
Message -> SQLException: [Microsoft][ODBC Microsoft Access Driver]Invalid SQL data type
//possibly because Type.NULL is the proper perameter
ErrorCode -> Error Code: 67
//is this an Access error code or a JDBC and what is it?
SQLState -> SQL State: S1004
//No clue what this is

If anyone has anyclue whatsoever please let me know...thanks ahead of time.

Dan

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top