Solved

Getting Exception while calling a stored procedure from Java

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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 …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

830 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