?
Solved

Getting Exception while calling a stored procedure from Java

Posted on 2008-09-29
3
Medium Priority
?
649 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

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

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

Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
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 learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
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…
Suggested Courses
Course of the Month11 days, 23 hours left to enroll

752 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