[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Getting Exception while calling a stored procedure from Java

Posted on 2008-09-29
3
Medium Priority
?
651 Views
Last Modified: 2012-05-05
Hi

I am calling the stored procedure and executing it from java program as below....
(Please see the attachment of the java code...)
(Also please see the Stored procedure which my DBA written...)

Now When I call the proc from my java, its throwing the exception....
The 'CREATE TABLE' command is not allowed within a multi-statement transaction in the 'tempdb' database..

Please let me know ASAP. This is some what urgent.
Connection conn = null;
CallableStatement stmt = null;
ArrayList<String> resultList =  new ArrayList<String>();
String sql = "{? = call sp_auth_reconciliation_rept ?,?,?,?}";
				
try {
      conn = registry.getPooledConnection();
      stmt = conn.prepareCall(sql);
      stmt.registerOutParameter(1, java.sql.Types.INTEGER);
      stmt.setString(2, sSubSystemId);
      stmt.setString(3, sSunetId);
	stmt.setString(4, sFunction);
	stmt.setString(5, sStatus);
						
	if (_log.isDebugEnabled()) {
	_log.debug("invoking stored procedure");
	}
	ResultSet rs = stmt.executeQuery();
	ResultSetMetaData rsmd = rs.getMetaData();
	int numberOfColumns = rsmd.getColumnCount();
	for (int i = 1; i <= numberOfColumns; i++) {
	     resultList.add(rsmd.getColumnName(i).toString());
        }
	resultList.add("|");
	while (rs.next()) {
	        for (int i = 1; i <= numberOfColumns; i++) {
	          resultList.add(rs.getString(i));
	        }
	        resultList.add("|");  
	    }
}

Open in new window

SP-Report.txt
0
Comment
Question by:cbkvarma
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 23

Accepted Solution

by:
cmalakar earned 2000 total points
ID: 22598550
sybase doesn't allow ddl commands to get executed in transactions.

You can enable that using the following command..

sp_dboption temp_db, "ddl in tran", true
0

Featured Post

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question