Solved

Getting Exception while calling a stored procedure from Java

Posted on 2008-09-29
3
644 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
3 Comments
 
LVL 23

Accepted Solution

by:
cmalakar earned 500 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Printing to a specific printer tray (HP 806dn printer) 3 83
java 8 lambda expresssions exception handling 3 72
maven project error 5 47
rhino JavaScript import, load 25 66
For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

932 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now