• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

using setNull correctly

Ranch Hand
Posts: 114
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to figure out the correct way to use setNull in a prepared statement.

ps.setNull(1, Types.INTEGER); // Set my first column to null, it is an int

I currently do not have access to the type so i would like to know if this is ok:
ps.setNull(1, Types.NULL); // Sorry don't know column 1's type

I have read a few places that Types.NULL is ok in all situations but I don't believe it.

Any experts in the area.

This relates to a post I also just put up in trying to figure out what the type is from the column name. I.E. since I don't know the type is there an easy way to get it from the column name?

It's hard to fight evil. The little things, like a nice sandwich, really helps. Right tiny ad?
how do I do my own kindle-like thing - without amazon
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!