Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JDBC Related Question

 
Krishna Gokidi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to call Stored Procedure without using collable statement.
I means by using some prepare stmt or some thing else ?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34423
347
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Krishna,
Welcome to JavaRanch!

A CallableStatement extends PreparedStatement so in some sense it is one. Why don't you want to use a CallableStatement? This is they way to use stored procedures using JDBC. The answer to the limitation you are trying to avoid will help suggest a solution or alternative.
 
Krishna Gokidi
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for giving quick response.

I am just looking for some alternatives its not needed just for the shake of knowledge and practise.

no problem I will try from my side, and if stuck some where again come back to you.

once again thanks
 
Brian Hart II
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Spring framework has a great wrapper for stored Procedures:

public class TitlesAndGenresStoredProcedure extends StoredProcedure {

private static final String SPROC_NAME = "AllTitlesAndGenres";

public TitlesAndGenresStoredProcedure(DataSource dataSource) {
super(dataSource, SPROC_NAME);
declareParameter(new SqlOutParameter("titles", OracleTypes.CURSOR, new TitleMapper()));
declareParameter(new SqlOutParameter("genres", OracleTypes.CURSOR, new GenreMapper()));
compile();
}

public Map execute() {
// again, this sproc has no input parameters, so an empty Map is supplied...
return super.execute(new HashMap());
}
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic