Invalid trancastion state exception
heloo
while i was running the code
try{
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
Class.forName("COM.ibm.db2.jdbc.net.DB2Driver");
catch(ClassNotFoundException cnfe){
System.out.println("Error here");
cnfe.printStackTrace();
Connection conn=null;
try{
conn =DriverManager.getConnection("jdbc:db2:spintra");
String name="mithun";
String pssw="1234";
conn.setAutoCommit(false);
Statement stmt = conn.createStatement ();
stmt.executeQuery("set current schema spschema");
stmt.executeUpdate("insert into adminlogin values('"+name+"','"+pssw+"')");
catch (SQLException e) {System.out.println(e);}
finally {
try{ if (conn!= null){
conn.close();
catch (SQLException e) {System.out.println(e);}
it gives the following exception
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver] CLI0116E Invalid transaction s
tate. SQLSTATE=25000
can anyone help me
Resource for DB2 SQLState Messages:
https://aurora.vcu.edu/db2help/db2m0/frame3.htm#db2stt25
From other related resources, it is my understanding that one possible cause for this error is a readonly environment. I see that no user / password is being supplied when getting the connection. Do you know what account is being used to login? If so, has it been granted UPDATE privileges on the adminlogin table?
Just some thoughts.
Similar Messages
-
Invalid Cursor state Exception - Help required
Hi,
I'm having a web page(JSP), which is making use of 3 ResultSet objects. Using the first two, i'll populate two different Drop down list, with values from database(Access) while loading the page for first time.
Now if the user select any value from any (or both) of drop down list and clicks submit, i need to display all values in database, meeting the criteria from first & second drop down list. For this selection, i'm using the third ResultSet variable. While executing the query, i'm sure that 3rd ResultSet is returning some value. But when i try to retrieve the value to a string variable, i'm getting the Invalid cursor state exception.
Throughout the page, i haven't closed any of the ResultSet. When i closed the first and second ResultSets in the third function(where 3rd ResultSet is used), i'm not getting any value. Its returning like ResultSet closed.
Please help me to get this solved. It's very urgent because without this, i cannot proceed further. Please share your ideas.
Thanks in advace for your valuable helpIf you open a new resultset within the same statement, all previously opened will be closed.
Read the API docs, luke. -
What is an invalid cursor state exception?
exception caught in webmaster servlet java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state
any ideas? this is the first time i've seen this one.For example you tried to read the next record from a result set when you had already read the last record. But you might get better results from a specific question.
-
Hello everyone i am building a database/web page application using Dreamweaver 8 that allows sudents to report computer issues. The submitting works fine it stores all information to the databse my problem now is updating the database to show a problem has been fixed. I can get the website to pull up current records using but when i click on the lik that should redirect the user to the update form which pulls up the record that the user clicked on i get this error:
exception
org.apache.jasper.JasperException: Exception in JSP: /updateIssue.jsp:151
148: <table align="center">
149: <tr valign="baseline">
150: <td nowrap align="right">Cpu:</td>
151: <td><input type="text" name="cpu" value="<%=(((IssueUpdate_data = IssueUpdate.getObject("cpu"))==null || IssueUpdate.wasNull())?"":IssueUpdate_data)%>" size="32">
152: </td>
153: </tr>
154: <tr valign="baseline">
Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:504)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
javax.servlet.ServletException: [Microsoft][ODBC Driver Manager] Invalid cursor state
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
org.apache.jsp.updateIssue_jsp._jspService(updateIssue_jsp.java:284)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
root cause
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state
sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
sun.jdbc.odbc.JdbcOdbc.SQLGetDataString(Unknown Source)
sun.jdbc.odbc.JdbcOdbcResultSet.getDataString(Unknown Source)
sun.jdbc.odbc.JdbcOdbcResultSet.getString(Unknown Source)
sun.jdbc.odbc.JdbcOdbcResultSet.getObject(Unknown Source)
sun.jdbc.odbc.JdbcOdbcResultSet.getObject(Unknown Source)
org.apache.jsp.updateIssue_jsp._jspService(updateIssue_jsp.java:226)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
My code for the page is:
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" %>
<%@ include file="Connections/db.jsp" %>
<%
// *** Edit Operations: declare variables
// set the form action variable
String MM_editAction = request.getRequestURI();
if (request.getQueryString() != null && request.getQueryString().length() > 0) {
String queryString = request.getQueryString();
String tempStr = "";
for (int i=0; i < queryString.length(); i++) {
if (queryString.charAt(i) == '<') tempStr = tempStr + "<";
else if (queryString.charAt(i) == '>') tempStr = tempStr + ">";
else if (queryString.charAt(i) == '"') tempStr = tempStr + """;
else tempStr = tempStr + queryString.charAt(i);
MM_editAction += "?" + tempStr;
// connection information
String MM_editDriver = null, MM_editConnection = null, MM_editUserName = null, MM_editPassword = null;
// redirect information
String MM_editRedirectUrl = null;
// query string to execute
StringBuffer MM_editQuery = null;
// boolean to abort record edit
boolean MM_abortEdit = false;
// table information
String MM_editTable = null, MM_editColumn = null, MM_recordId = null;
// form field information
String[] MM_fields = null, MM_columns = null;
%>
<%
// *** Update Record: set variables
if (request.getParameter("MM_update") != null &&
request.getParameter("MM_update").toString().equals("form1") &&
request.getParameter("MM_recordId") != null) {
MM_editDriver = MM_db_DRIVER;
MM_editConnection = MM_db_STRING;
MM_editUserName = MM_db_USERNAME;
MM_editPassword = MM_db_PASSWORD;
MM_editTable = "issue";
MM_editColumn = "cpu";
MM_recordId = "'" + request.getParameter("MM_recordId") + "'";
MM_editRedirectUrl = "COBA_home.html";
String MM_fieldsStr = "cpu|value|issue|value|comment|value|issue_Date|value|Fixed|value";
String MM_columnsStr = "cpu|',none,''|issue|',none,''|comment|',none,''|issue_Date|',none,''|Fixed|',none,''";
// create the MM_fields and MM_columns arrays
java.util.StringTokenizer tokens = new java.util.StringTokenizer(MM_fieldsStr,"|");
MM_fields = new String[tokens.countTokens()];
for (int i=0; tokens.hasMoreTokens(); i++) MM_fields[i] = tokens.nextToken();
tokens = new java.util.StringTokenizer(MM_columnsStr,"|");
MM_columns = new String[tokens.countTokens()];
for (int i=0; tokens.hasMoreTokens(); i++) MM_columns[i] = tokens.nextToken();
// set the form values
for (int i=0; i+1 < MM_fields.length; i+=2) {
MM_fields[i+1] = ((request.getParameter(MM_fields)!=null)?(String)request.getParameter(MM_fields[i]):"");
// append the query string to the redirect URL
if (MM_editRedirectUrl.length() != 0 && request.getQueryString() != null) {
MM_editRedirectUrl += ((MM_editRedirectUrl.indexOf('?') == -1)?"?":"&") + request.getQueryString();
%>
<%
// *** Update Record: construct a sql update statement and execute it
if (request.getParameter("MM_update") != null &&
request.getParameter("MM_recordId") != null) {
// create the update sql statement
MM_editQuery = new StringBuffer("update ").append(MM_editTable).append(" set ");
for (int i=0; i+1 < MM_fields.length; i+=2) {
String formVal = MM_fields[i+1];
String elem;
java.util.StringTokenizer tokens = new java.util.StringTokenizer(MM_columns[i+1],",");
String delim = ((elem = (String)tokens.nextToken()) != null && elem.compareTo("none")!=0)?elem:"";
String altVal = ((elem = (String)tokens.nextToken()) != null && elem.compareTo("none")!=0)?elem:"";
String emptyVal = ((elem = (String)tokens.nextToken()) != null && elem.compareTo("none")!=0)?elem:"";
if (formVal.length() == 0) {
formVal = emptyVal;
} else {
if (altVal.length() != 0) {
formVal = altVal;
} else if (delim.compareTo("'") == 0) { // escape quotes
StringBuffer escQuotes = new StringBuffer(formVal);
for (int j=0; j < escQuotes.length(); j++)
if (escQuotes.charAt(j) == '\'') escQuotes.insert(j++,'\'');
formVal = "'" + escQuotes + "'";
} else {
formVal = delim + formVal + delim;
MM_editQuery.append((i!=0)?",":"").append(MM_columns[i]).append(" = ").append(formVal);
MM_editQuery.append(" where ").append(MM_editColumn).append(" = ").append(MM_recordId);
if (!MM_abortEdit) {
// finish the sql and execute it
Driver MM_driver = (Driver)Class.forName(MM_editDriver).newInstance();
Connection MM_connection = DriverManager.getConnection(MM_editConnection,MM_editUserName,MM_editPassword);
PreparedStatement MM_editStatement = MM_connection.prepareStatement(MM_editQuery.toString());
MM_editStatement.executeUpdate();
MM_connection.close();
// redirect with URL parameters
if (MM_editRedirectUrl.length() != 0) {
response.sendRedirect(response.encodeRedirectURL(MM_editRedirectUrl));
return;
%>
<%
String IssueUpdate__MMColParam = "1";
if (request.getParameter("cpu") !=null) {IssueUpdate__MMColParam = (String)request.getParameter("cpu");}
%>
<%
Driver DriverIssueUpdate = (Driver)Class.forName(MM_db_DRIVER).newInstance();
Connection ConnIssueUpdate = DriverManager.getConnection(MM_db_STRING,MM_db_USERNAME,MM_db_PASSWORD);
PreparedStatement StatementIssueUpdate = ConnIssueUpdate.prepareStatement("SELECT * FROM issue WHERE cpu = '" + IssueUpdate__MMColParam + "' ORDER BY Fixed ASC");
ResultSet IssueUpdate = StatementIssueUpdate.executeQuery();
boolean IssueUpdate_isEmpty = !IssueUpdate.next();
boolean IssueUpdate_hasData = !IssueUpdate_isEmpty;
Object IssueUpdate_data;
int IssueUpdate_numRows = 0;
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<form method="post" action="<%=MM_editAction%>" name="form1">
<table align="center">
<tr valign="baseline">
<td nowrap align="right">Cpu:</td>
<td><input type="text" name="cpu" value="<%=(((IssueUpdate_data = IssueUpdate.getObject("cpu"))==null || IssueUpdate.wasNull())?"":IssueUpdate_data)%>" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Issue:</td>
<td><input type="text" name="issue" value="<%=(((IssueUpdate_data = IssueUpdate.getObject("issue"))==null || IssueUpdate.wasNull())?"":IssueUpdate_data)%>" size="32">
</td>
</tr>
<tr>
<td nowrap align="right" valign="top">Comment:</td>
<td valign="baseline"><textarea name="comment" cols="50" rows="5"><%=(((IssueUpdate_data = IssueUpdate.getObject("comment"))==null || IssueUpdate.wasNull())?"":IssueUpdate_data)%></textarea>
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Issue_Date:</td>
<td><input type="text" name="issue_Date" value="<%=(((IssueUpdate_data = IssueUpdate.getObject("issue_Date"))==null || IssueUpdate.wasNull())?"":IssueUpdate_data)%>" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right">Fixed:</td>
<td><input type="text" name="Fixed" value="<%=(((IssueUpdate_data = IssueUpdate.getObject("Fixed"))==null || IssueUpdate.wasNull())?"":IssueUpdate_data)%>" size="32">
</td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><input type="submit" value="Update record">
</td>
</tr>
</table>
<input type="hidden" name="MM_update" value="form1">
<input type="hidden" name="MM_recordId" value="<%=(((IssueUpdate_data = IssueUpdate.getObject("cpu"))==null || IssueUpdate.wasNull())?"":IssueUpdate_data)%>">
</form>
<p> </p>
</body>
</html>
<%
IssueUpdate.close();
StatementIssueUpdate.close();
ConnIssueUpdate.close();
%>
Any idea as to what I have done wrong because I am very confused right now. Thank you so much in advance for any help or adviceI am confused as well.
It would help if your data layer was separate from your display layer.
The error suggests that you are attempting to extract a result from a update. And that won't work with a standard update.
Where that is happening I have no idea. -
While reading from the pl/sql cursor i got "Invalid column index" exception
Hi,
I got the "Invalid column index" exception while reading from the cursor.
Please advice.
Thanks in advance
sivaI suppose one (or more) index in your query is in a bad state.
Possible solutions: rebuild (with 'ALTER INDEX <index> REBUILD ...')
drop and recreate (it's the same as above, but a little more long) -
I am receiving an Invalid column name SQLException. I initially
thought it was a problem with the computed fields, but was after
making the usual changes to the model implementation the exception is
still occurring. I can run the SQL statement in SQLplus and get no
errors and the three results I'm expecting (grabbing the SQL statement
from the model's beforeExecute event). The mystifying part is that it
returns one of the three rows that I'm expecting. That is, the model
executes and the result set is partially filled. The model is Select
only. The computed fields are concatenated strings. After logging the
exception I call getNumRows() on the model and receive a 1 back. The
computed fields are returned in that one record. Any ideas about what
to try or where to look next?
Thanks,
paulKostas,
Thanks for your help. During migration a QueryFieldDescriptor was
created for a field that is only used in the where clause. I'm
assuming it then couldn't be mapped back to the ResultSet, and this
caused the Invalid Column Name exception. That is, I am selecting 5
fields, but had 6 QueryFieldDescriptors.
paul
--- In SunONE-JATO@y..., Kostas Morfis <kmorfis@i...> wrote:
Hi Paul,
It would appear you have a column name mismatch between what isdefines in
your modelImpl
and what is being returned by the JDBC driver.
From the SQL you sent, the Column Names would be something like:
'SURVEYGROUP_XREF',SURVEY_ID', CF_SURVEYANDGROUP', 'CF_SURVEYGROUP',
'RESULTS_VIEWER_ID'
Do all your column names definitions in your modelImpl match up tothese ?
>
eg public static final StringCOLUMN_WIS_SURVEYANDGROUP="CF_SURVEYANDGROUP";
>
Note: the qualified column vairables (QUALIFIED_COLUMN_XXXXXX) doNOT get
used for Select queries.
If it still unclear where the mismatch is occurring, you can addsome simple
debugging :
To tell you what you are trying to access add the the following in
ResultSetModelBase just before the
exception occurred:
System.out.println("UPDATE_MODEL: Attempting to Access Column Name:
"+fd.getColumnName());
Object value=resultSet.getObject(fd.getColumnName());
If still need more information,you can look at the column namesreturned by
the JDBC calls by doing something like:
ResultSetMetaData metaData = resultSet.getMetaData();
int columnCount = metaData.getColumnCount();
for(int i = 0; i < columnCount ; i++)
System.out.println("Colummn["+i+"]"+
metaData.getColumnName(i+1));
Hope that helps.
Kostas -
hi!
again got struck with small thing.i am inserting record in a table using prepare statement.
exception it shows is:
exceptionjava.sql.SQLException: [Microsoft][ODBC driver for Oracle][Oracle]ORA-00904: invalid column name
have look at the following piece of code and table structure.
code ::
PreparedStatement s=conn.prepareStatement("insert into Account_holder_transaction_r values(?,getDate(),?,?,?)");
s.setString(1,accountno);
s.setString(2,vparticulars);
s.setString(3,chequeno);
s.setDouble(4,mdeposit);
rows=s.executeUpdate();
SQL> desc account_holder_transaction_r;
Name Null? Type
CACCOUNT_ID VARCHAR2(20)
CDATE DATE
CPARTICULARS VARCHAR2(40)
CCHECKNUM VARCHAR2(40)
CAMOUNT NUMBER(12,3)Actually, the lack of column names isn't the problem, (although it's horrible design). Thats valid syntax for Oracle, for inserting a value for all columns in the table in the order the DB happens to have them in.
Syntax:
http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9014.htm
Examples:
http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_9014.htm#sthref7305
It's horrible design because:
a) if you add a new column to the table, it breaks the Java code
b) if you do table maintenance that reorders the columns, it breaks the Java code
c) having the columns in the Java code self-documents the relationship between the Java variables and the database columns
The actual problem is the SQL itself. getDate() is not a native Oracle function, the analogous Oracle thing to do if you want the current time on the databse server is to use the SYSDATE pseudo-value, e.g.:
PreparedStatement s=conn.prepareStatement("insert into Account_holder_transaction_r (CACCOUNT_ID, CDATE, CPARTICULARS, CCHECKNUM, CAMOUNT) values(?,SYSDATE,?,?,?)");This will insert the current time on the dababasse server as of the moment the executeUpdate is performed on the database. (If the times of the database server and the Java application server are not synchronized, this can be confusing).
Besides that, the stack trace tells us that you're using an MS ODBC driver; you probably ought to look very very seriously at using the Oracle JDBC driver. -
Invalid call Statement method: {0} In sql server,please help me!
Connect to a sql server 2000 DB,and the table has a identity column.
Run the code below:
String strSql = "insert into attachments([FileName],FileLength,FileContent) values(?,?,?)";
PreparedStatement pstmt = connection.prepareStatement(strSql);
pstmt.setString(1,fileName);
pstmt.setInt(2,iFileLength);
pstmt.setString(3,'aaaa');
if(pstmt.executeUpdate()==1) {//succeed;
strSql = "select @@identity";//this code run good in the Query Analyzer.
ResultSet rs = pstmt.executeQuery(strSql);//exception thrown!!!!!!!!!!!!
if(rs.next()) {//succeed;
int i = rs.getInt(1);
throw a exception:Invalid call Statement method: {0}
thanks a lot!If you really must re-use your prepared statement, then you'll have to clear the parameters associated with it.
pstmt.clearParameters();What's happening is that the statement is trying to re-apply the previously assigned parameters to a query with no placeholders.
I'd rather use an ordinary Statement in this case.
Dave -
HELP! INVALID CURSOR STATE
i have this simple jsp page that will display a few data from an SQL Database... im just trying to check my connectivity. but everytime i view the page it says "[Microsoft][ODBC SQL Server Driver]Invalid
cursor state'"my JSP environment is
J2EE 1.2.1
JDK 1.3.0_02
BDK 1.1
TOMCAT 3.2.1
SQL Server 2000 Enterprise Edition
Running on Windows 2000 server
Heres my simple code:
<%@ page language = "java" import = "java.sql.*" %>
<html>
<body>
<%
Connection con = null;
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:testdsn:, "sa", "");
Statement stmt = con.createStatement();
Resultset rs = stmt.executeQuery("select * from testtable");
while(rs.next());
out.println(rs.getString(1));
out.println(rs.getString(2));
catch(Exception e)
out.println(e.toString());
%>
</body>
</html>
my testtable have 2 columns and 6 rows all in varchar datatype with values:
test 1 | a
test 2 | b
test 3 | c
test 4 | d
test 5 | e
test 6 | f
is there something wrong with the code? with my environment? please help im finishing a site for a school project but i cant seem to make jsp and sql workSee if using PreparedStatement works better for you than Statement. Sometimes it has better manners.
- Saish
"My karma ran over your dogma." - Anon -
Sorry to ask about Invalid Cursor State again...
I am getting this error which is really frustrating because I can't figure out why it is happening.
I am connecting to a csv file using jdbc:odbc Microsoft Text Driver.
I instantiate the ReadFortySite class in the GUI class.I then click on a jList in my main GUI and this passes the selected object to the code below. It works fine the first time but if I try to select another jList element, it throws the Invalid Cursor State error..Any Ideas??
public class ReadFortySite {
private String file;
private String path = null;
private Connection conn = null;
private Statement stmt;
private ResultSet results, col_results;
private ResultSetMetaData rsmd;
private ArrayList test_names,columnHeads;
private Object List_Selection;
/** Creates a new instance of ReadFortySite */
public ReadFortySite(String file) {
this.file = file;
ReadFile();
public void ReadFile()
try{
//path = file.getPath();
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
// create a connection.
/* NEED 2 TAKE HARD CODED VALUE OF E: OUT!!!! */
conn = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=E:/;Extensions=csv");
// create a Statement object to execute the query with
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
// Select everything from the specified csv file
results = stmt.executeQuery("SELECT * from ("+file+")");
//ArrayLists used to manipulate and hold test name values
columnHeads = new ArrayList();
// get column heads
rsmd = results.getMetaData();
for ( int i = 4; i <= rsmd.getColumnCount(); i++ ) {
columnHeads.add( rsmd.getColumnName( i ) );
}//end try
catch(Exception e)
System.out.println("Error " + e);
}//end method
public ArrayList getArrayList()
return columnHeads;
public ArrayList getTestValues(Object obj){
ArrayList TestValues = new ArrayList();
try{
List_Selection = obj;
//have an object representing the value selected
//need to get test results associated with that value
for(int i=1;i<rsmd.getColumnCount()+1;i++)
if(obj.equals((Object)rsmd.getColumnName(i)))
while(results.next()){
String vals = results.getString((String)obj);
TestValues.add(vals);
//System.out.println(TestValues.toString());
}//end while
}//end for
}//end try
catch (SQLException sqle)
System.out.println("Error " + sqle);
return TestValues;
}You should use code formatting when you post code, and you should also post the stack trace that you get when you run the code.
/Kaj -
ORA-00900: invalid SQL statement error in procedure
In procedure we referring only 2 tables
Tables:
1) Edw_orders_ref
2) Change_pl
Condisition:
1) whenever edw_orders_ref.product=change_pl.product and edw_orders_ref.opt=change_pl.opt condisition satisfied then update edw_orders_ref.pl with change_pl.pl column.
2) we pass table name and day values as arguments to the procedure.
3) Based on day column data only we update.
4) Heir day column means partisition values of the table
Procedure is:
create or replace procedure Proc_update_target(P_Day varchar2,p_tablename nvarchar2)
as
TYPE PlCurTyp IS REF CURSOR;
Pl_cv PlCurTyp;
--emp_rec edw_orders_ref%ROWTYPE;
pl_rec Edw_orders_ref.pl%type;
product_rec Edw_orders_ref.product%type;
opt_rec Edw_orders_ref.opt%type;
sql_stmt varchar(3200);
n number:=0;
BEGIN
sql_stmt := 'select lpl.opt,lpl.product,lpl.pl from minddba.change_pl lpl
where exists ( select 1 from '|| p_tablename ||' where '||p_tablename||'.product=lpl.product and '||p_tablename||'.opt=lpl.opt
and '||p_tablename||'.day='||P_Day||' )';
dbms_output.put_line('hi');
OPEN pl_cv FOR sql_stmt ;
LOOP
dbms_output.put_line('hello1');
FETCH Pl_cv INTO pl_rec,product_rec,opt_rec;
EXIT WHEN Pl_cv%NOTFOUND;
dbms_output.put_line('hello');
execute immediate
'update '||p_tablename||' set pl=:rpl
where product=:rproduct
and opt=:ropt
AND day=:day' using pl_rec, product_rec,opt_rec,P_Day;
if Pl_cv%rowcount=10000 then
commit;
end if;
END LOOP;
CLOSE pl_cv;
commit;
exception
when others then
dbms_output.put_line('Error while updating target pl:'||SQLERRM);
end;
it is compile nad debug.
but execution time this error was coming
exec Proc_update_target('20110226','edw_orders_ref')
hi
hello1
hello
Error while updating target pl:ORA-00900: invalid SQL statement
i think in that procedure updata statement is wrong,if any one corect them.Hi,
This are details of table structure and my requirement for that procedure
CREATE TABLE EDW_ORDERS_REF
SO_ID VARCHAR2(20 BYTE) NOT NULL,
SRC_SYS_KY NUMBER(19) NOT NULL,
DAY VARCHAR2(8 BYTE) NOT NULL,
FIN_CLOSE_DT VARCHAR2(8 BYTE) NOT NULL,
SO_LN_ITM_ID VARCHAR2(12 BYTE) NOT NULL,
EXT_EFF_TS VARCHAR2(26 BYTE) NOT NULL,
EFF_FRM_GMT_TS VARCHAR2(26 BYTE) NOT NULL,
CONTRA_FG VARCHAR2(1 BYTE) NOT NULL,
FDW_TRAN_TYPE_CD VARCHAR2(1 BYTE) NOT NULL,
SO4 VARCHAR2(4 BYTE),
SO2 VARCHAR2(2 BYTE),
PUR_AGMT VARCHAR2(20 BYTE),
SF VARCHAR2(6 BYTE),
V_BOX VARCHAR2(18 BYTE),
PL VARCHAR2(30 BYTE),
MCC_CD VARCHAR2(20 BYTE),
OPT VARCHAR2(18 BYTE),
ORDER_UNITS NUMBER(15,3),
SO_OPT_QTY NUMBER(10,3),
SO_DTL_EXT_QT NUMBER(15,3),
ORDER_LIST_LCY NUMBER(18,4),
ORDER_NET_LCY NUMBER(18,4),
ORDER_NET_CLC NUMBER(18,4),
ORDER_LIST_CLC NUMBER(18,4),
CURRENCY_CD VARCHAR2(2 BYTE),
SLS_CHNL_CD VARCHAR2(1 BYTE),
CBN VARCHAR2(20 BYTE),
GEOG_UNIT VARCHAR2(30 BYTE),
PRODUCT VARCHAR2(18 BYTE),
ORDER_NR VARCHAR2(20 BYTE),
ORDER_LINE_NR VARCHAR2(12 BYTE),
LOAD_DT DATE DEFAULT SYSDATE
CREATE TABLE MINDDBA.CHANGE_PL
PRODUCT VARCHAR2(18 BYTE) NOT NULL,
OPT VARCHAR2(3 BYTE) NOT NULL,
PL VARCHAR2(2 BYTE) NOT NULL
1) whenever edw_orders_ref.product=change_pl.product and edw_orders_ref.opt=change_pl.opt condisition satisfied then update edw_orders_ref.pl with change_pl.pl column.
2) we pass table name and day values as arguments to the procedure.
3) Based on day column data only we update.
4) Heir day column means partisition values of the table
When executing this one I got one error like
exec Proc_update_target('20110226','edw_orders_ref');
hi
hello1
hello
ORA-00900: invalid SQL statement -
ODBC data source error, invalid cursor state??
I'm using Photoshop Album Starter Edition 3.0, on Windows XP, and I was having some trouble organizing so I deleted all the photos in the catalogue, but now I can't add any new images. After opening the program and trying to add new pictures, I get the error that the files can't be found. After that one time, every time I try to add any photos at all, it gives me this error:
The ODBC data source returned the following error:
"[Microsoft][ODBC Microsoft Access Driver]Invalid cursor state"
I've tried restarting the program, the computer... I don't know what the error even means or how to solve this problem. So if anyone has any ideas, please let me know. Oh, and I would reinstall the program, except I think it just came with the computer, I don't have a cd with it or anything. Is there somewhere else or another way to reinstall? Anyhow I'm done now, please help if you can. Thanks. :)Since this is a free software, you can download this from Adobe.com. Try reinstalling Photoshop Album Starter Edition 3.0. If Reinstall does not work, try repairing the Windows ODBC drivers.
The reason for the error may be the Windows ODBC Drivers.To repair the ODBC drivers, follow these steps:
1) Go to Start>Settings>Control Panel. Select Add/Remove Programs and select SP2 and uninstall.
2) Insert your original Win XP CD and choose the Upgrade option.
3) When completed, reinstall SP2. Go to Start>Windows Updates and select SP2.
You can also try this:
Install Windows XP Service Pack 2 _or_ install the "Microsoft Data Access Components (MDAC) 2.8" from http://www.microsoft.com/downloads/details.aspx?FamilyID=6c050fe3-c795-4b7d-b037-185d0506 396c&DisplayLang=en
Please let us know if that worked.
-Smriti -
CLI0116E Invalid transaction state
Using IBM DB2 7.2 Type 4 driver with kodo 2.5.3
( same source code, same configuration, if swich to type 3 driver, no
exception but performance drops )
<config-property>
<config-property-name>ConnectionDriverName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>COM.ibm.db2.jdbc.app.DB2Driver</config-property-value>
</config-property>
<config-property>
<config-property-name>ConnectionRetainMode</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>transaction</config-property-value>
</config-property>
Receiving exception every time closing PM
08:47:32,777 WARN [JDBC] [ C:null; T:20911989; D:32017535 ] exception
when closing connection
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver] CLI0116E Invalid
transaction state. SQLSTATE=25000
at
COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java:183)
at
COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(SQLExceptionGenerator.java:428)
at
COM.ibm.db2.jdbc.app.DB2Connection.close2(DB2Connection.java:846)
at COM.ibm.db2.jdbc.app.DB2Connection.close(DB2Connection.java:812)
at
com.solarmetric.datasource.ConnectionWrapper.close(ConnectionWrapper.java:288)
at
com.solarmetric.datasource.DataSourceImpl$AbstractPool.close(DataSourceImpl.java:769)
at
com.solarmetric.datasource.DataSourceImpl.close(DataSourceImpl.java:398)
at
com.solarmetric.datasource.DataSourceImpl.close(DataSourceImpl.java:372)
at
com.solarmetric.datasource.PoolConnection.close(PoolConnection.java:70)
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.close(SQLExecutionManagerImpl.java:832)
at
com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.release(JDBCStoreManager.java:877)
at
com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.release(JDBCStoreManager.java:842)
at
com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.releaseDatastoreConnection(JDBCStoreManager.java:298)
at
com.solarmetric.kodo.runtime.datacache.DataCacheStoreManager.releaseDatastoreConnection(DataCacheStoreManager.java:471)
at
com.solarmetric.kodo.runtime.datacache.DataCacheStoreManager.load(DataCacheStoreManager.java:656)
at
com.solarmetric.kodo.runtime.StateManagerImpl.loadField(StateManagerImpl.java:2248)
at
com.solarmetric.kodo.runtime.StateManagerImpl.isLoaded(StateManagerImpl.java:899)
at
com.stercomm.UPCAP.biztier.persistence.ProposalPriceObjectDAO.jdoGetsalesManager(ProposalPriceObjectDAO.java)
at
com.stercomm.UPCAP.biztier.persistence.ProposalPriceObjectDAO.getSalesManager(ProposalPriceObjectDAO.java:400)
at
com.stercomm.UPCAP.biztier.ejb.impl.ProposalBean.getProposalDetails(ProposalBean.java:3186)
at sun.reflect.GeneratedMethodAccessor297.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:660)
at
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
at
org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
at
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:107)
at
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:210)
at
org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:98)
at
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:130)
at
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:208)
at
org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:313)
at org.jboss.ejb.Container.invoke(Container.java:738)
at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
at
org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:383)
at sun.reflect.GeneratedMethodAccessor42.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:536)Zhiqiang-
If you increase your MaxPool size to something high, does this still
happen? If you use JBoss' own DataSource, does it happen?
In article <[email protected]>, Zhiqiang wrote:
The system locks on some tables after a while. -- can not search/update
The App server is JBOSS 3.0.7
Marc Prud'hommeaux wrote:
Zhiqiang-
Odd, I haven't seen that one before. However, since this is just a
warning message, you should be able to ignore it (you can decrease the
logging verbosity of the JDBC channel if you don't want to see it). The
error shouldn't cause any serious problems; if you are seeing bad
behavior because of it, please let us know.
Also, I bet that increasing your MaxSize for the connection pool will
help reduce the frequency in which this occurs (since it only looks like
it is happening when the connection is getting booted out of the pool).
In article <[email protected]>, Zhiqiang wrote:
Using IBM DB2 7.2 Type 4 driver with kodo 2.5.3
( same source code, same configuration, if swich to type 3 driver, no
exception but performance drops )
<config-property>
<config-property-name>ConnectionDriverName</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>COM.ibm.db2.jdbc.app.DB2Driver</config-property-value>
</config-property>
<config-property>
<config-property-name>ConnectionRetainMode</config-property-name>
<config-property-type>java.lang.String</config-property-type>
<config-property-value>transaction</config-property-value>
</config-property>
Receiving exception every time closing PM
08:47:32,777 WARN [JDBC] [ C:null; T:20911989; D:32017535 ] exception
when closing connection
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver] CLI0116E Invalid
transaction state. SQLSTATE=25000
at
COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(SQLExceptionGenerator.java:183)
at
COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(SQLExceptionGenerator.java:428)
at
COM.ibm.db2.jdbc.app.DB2Connection.close2(DB2Connection.java:846)
at COM.ibm.db2.jdbc.app.DB2Connection.close(DB2Connection.java:812)
at
com.solarmetric.datasource.ConnectionWrapper.close(ConnectionWrapper.java:288)
at
com.solarmetric.datasource.DataSourceImpl$AbstractPool.close(DataSourceImpl.java:769)
at
com.solarmetric.datasource.DataSourceImpl.close(DataSourceImpl.java:398)
at
com.solarmetric.datasource.DataSourceImpl.close(DataSourceImpl.java:372)
at
com.solarmetric.datasource.PoolConnection.close(PoolConnection.java:70)
at
com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.close(SQLExecutionManagerImpl.java:832)
at
com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.release(JDBCStoreManager.java:877)
at
com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.release(JDBCStoreManager.java:842)
at
com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.releaseDatastoreConnection(JDBCStoreManager.java:298)
at
com.solarmetric.kodo.runtime.datacache.DataCacheStoreManager.releaseDatastoreConnection(DataCacheStoreManager.java:471)
at
com.solarmetric.kodo.runtime.datacache.DataCacheStoreManager.load(DataCacheStoreManager.java:656)
at
com.solarmetric.kodo.runtime.StateManagerImpl.loadField(StateManagerImpl.java:2248)
at
com.solarmetric.kodo.runtime.StateManagerImpl.isLoaded(StateManagerImpl.java:899)
at
com.stercomm.UPCAP.biztier.persistence.ProposalPriceObjectDAO.jdoGetsalesManager(ProposalPriceObjectDAO.java)
at
com.stercomm.UPCAP.biztier.persistence.ProposalPriceObjectDAO.getSalesManager(ProposalPriceObjectDAO.java:400)
at
com.stercomm.UPCAP.biztier.ejb.impl.ProposalBean.getProposalDetails(ProposalBean.java:3186)
at sun.reflect.GeneratedMethodAccessor297.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(StatelessSessionContainer.java:660)
at
org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:186)
at
org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(StatelessSessionInstanceInterceptor.java:77)
at
org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:107)
at
org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:210)
at
org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:98)
at
org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:130)
at
org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:208)
at
org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContainer.java:313)
at org.jboss.ejb.Container.invoke(Container.java:738)
at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
at
org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:383)
at sun.reflect.GeneratedMethodAccessor42.invoke(Unknown Source)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at
sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at
sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at
sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:536)
Marc Prud'hommeaux [email protected]
SolarMetric Inc. http://www.solarmetric.com
Marc Prud'hommeaux [email protected]
SolarMetric Inc. http://www.solarmetric.com -
Kodo 3.0 generates invalid SQL statement when deleting an instance
Hi,
kodo 3.0 generates an invalid SQL statement when deleting an instance
that has a one-many inverse unidirectional association.
All manipulations of the data go just fine except for the deletion of
instances of Whole without Parts. Kodo 3.0 generates the following SQL
statement UPDATE PART SET WHERE PARTID= ?.
This problem does not occur when using a bidirectional relationship
between Whole and Part. Is there an error in the mapping file somewhere?
Thanks in advance,
Stijn
database schema
<table name="PART">
<column name="PARTID" type="bigint"/>
<fk to-table="WHOLE">
<join column="PARTID" to-column="WHOLEID"/>
</fk>
</table>
<table name="WHOLE">
<column name="WHOLEID" type="bigint"/>
</table>
classes
public class Whole implements javax.jdo.InstanceCallbacks{
private java.util.Set parts = new java.util.HashSet();
public void jdoPreDelete {
//implements cascading delete
public class Part implements javax.jdo.InstanceCallbacks{
private int partid;
mapping
<class name="Whole">
<field name="parts">
<jdbc-field-map type="one-many" column.PARTID="PARTID"
ref-column.WHOLEID="PARTID" table="PART"/>
</field>This bug is caused by the fact that your FK is using a column that is
not nullable (in this case, because it is also a PK column). It is
definitely a bug on our side, but I wanted to let our users know that
most one-sided one-many relations won't exhibit this problem.
Thank you for the report; we will try to correct the problem in an
upcoming release. -
Invalid cursor state when trying to insert record
Hi everyone!
I'm using JDBC-ODBC bridge to connect to a mySql database, which works fine. Then I try to insert new records, but this only works for the first record in the table.
When there is already a record in the table, I always get "[Microsoft][ODBC Driver Manager] Invalid cursor state" when calling the updateRow()-method of the result set.
Here is my code: // open db connection
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:odbc:TTManager", "xxxx", "xxxx");
// Prepare SQL statement
java.sql.Statement stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_UPDATABLE);
ResultSet result = stmt.executeQuery("SELECT * FROM Player");
result.moveToInsertRow();Then all fields are filled in this manner: result.updateString("Name", name);And finally the insertRow should be written to the db: result.insertRow();But at this point it gives the mentioned error, including these messages: at sun.jdbc.odbc.JdbcOdbcResultSet.setPos(JdbcOdbcResultSet.java:5272)
at sun.jdbc.odbc.JdbcOdbcResultSet.insertRow(JdbcOdbcResultSet.java:4132)Since I'm very unexperienced with Java, I guess (or hope^^) it's just some stupid beginner's mistake.
Oh, almost forgot to mention: The new record's data doesn't violate any unique-constraints on the table, all fields are explicitely filled and all variable's data types are matching their according field types!
Any help would be appreciated!
reinskiOk, I needed to help myself and this is what I found out:
If the table already contains records, it is not enough to doresult.moveToInsertRow();but I must beresult.last();
result.moveToInsertRow();I didn't find any explanation and even the code examples from the Sun tutorial don't mention this, so I guess it's a bug occurring in my poor IT environment: DB server running mySQL 5.0.0-alpha on a P1-233-MMX w/ 64MB under WinNT4 (hey don't laugh!!^^).
Maybe this information is of use to someone having similar problems...
Greetings!
reinski
Maybe you are looking for
-
Cannot unmount Macintosh HD to install Lion.
Hello, I have a 15" MacBook Pro on my hands with some sort of HDD issue. The machine suddenly stopped booting and so my first thought was that the HDD has failed or that the filesystem had become corrupt. My files were all backed up, so I went ahead
-
Error: Gray Menu Options? PS CC
I seem to be having an issue with Photoshop CC 2014. I'm using Windows 8.1 on an HP 110-017cb. The issue is, I was having problems using the Blending Options when working on a New Document. I solved that by resetting some presets, but now some option
-
Apache Axis Soap Envelope soap:Header
<?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Header> <DataHeader xmlns="http://m
-
i've downloaded the newest update from the web site for my ipod+video, but when i try to run the update program from itunes, i receive the message, "The ipod, "Ashle's ipod" couldn't be updated. The required file cannot be found." Where can I get the
-
Subscription to India not activated?
Dear, Today I recharge India 800 min(7.49 Euro),but my account it is not showing & i can not call any India number.My payment histry i attached in below,please take necessary action as early as possible. For your safety and protection, please never,