Solved

Getting Exception while calling a stored procedure from Java

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

What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

Question has a verified solution.

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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
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 the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

705 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