Solved

Getting Exception while calling a stored procedure from Java

Posted on 2008-09-29
3
645 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
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…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

803 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