Sql - execute statement problems
I have a "try" with a "catch" that contains an sql execute statement, and some statements after that, but it doesn't execute any of the following statements. It successfully compiles and has no errors when I run it. It just doesn't insert the information and it stops every command that follows. When I remove the execute state (the one with the asterist next to it), the following statements execute fine. Any information on what I might be missing would be greatly appreciated. Thanks.
try{
new JdbcOdbcDriver();
String url = "jdbc:odbc:javadb";
String user = "";
String password = "";
Connection con =
DriverManager.getConnection(url, user, password);
Statement stmt = con.createStatement();
System.out.println("Made the Connection");
*stmt.executeUpdate("INSERT INTO tbl VALUES ('bradley')");
System.out.println("Made the Connection");
JOptionPane.showMessageDialog(this, "Data Inserted");
}catch(Exception e)
e.printStackTrace();
}
Look in your log file. When you perform "e.printStackTrace()" the stack is sent to the System.out, which JSP has already redirected to the log.
If you're having trouble finding the log (it depends on what webserver you're using), try changing that to:
out.println("<h3>We have an error: " + e + "</h3>");
(Notice the absense of "System." here. We're using the pre-defined JSP "out" object that's going to the client browser.)
That will print the error message, plus the reason for the error, on your client as 2nd level header.
Personally, I always print out my error messages in this manner. I find that having a full, complete, extensive stack trace is next to useless. It's like asking for the definition of the word "Java", and having the Oxford Unabridged Dictionary dropped in your lap.
Similar Messages
-
SQL Case Statement Problem with Maxdb
Hello,
I'm running a J2E application on Netweaver AS. I have on problem that I just cannot figure out.
The statement works in SQL Studio but when I try to code it it does not work at all.
select COLA, SUM(CASE WHEN COLB=10 THEN 1 ELSE 0 END) from TABLE group by COLA
When executed as statement in Java I get:
Error [javax.servlet.ServletException: java.lang.IllegalStateException: illegal stack size: 4
contents:
com.sap.sql.tree.SelectStatement
com.sap.sql.tree.IntegerLiteral
com.sap.sql.tree.IntegerLiteral
com.sap.sql.tree.ComparisonPredicate], with root cause [java.lang.Exception: java.lang.IllegalStateException: illegal stack size: 4
contents:
com.sap.sql.tree.SelectStatement
com.sap.sql.tree.IntegerLiteral
com.sap.sql.tree.IntegerLiteral
com.sap.sql.tree.ComparisonPredicate].
Any thoughts on that? Thanks!
Edited by: MD on Feb 18, 2009 7:37 PMHi MD,
with SQL Studio you mean you work with MaxDB?
Are you sure you're working directly on MaxDB and not with OpenSQL? (That's different!)
If you want the first, try setting SQL type "vendor" or "native sql". In such case you have to define a new custom datasource through configuration. How that works depends on the version you are using.
Try to find out what the actual error message is. The stack trace is not enough. There should be more.
Regards,
Benny -
Java.sql.SQLException: statement handle not executed
hello,
i am calling a stored procedure and its returns a REF CURSOR and i am getting intermittent exceptions below,
org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL [{call
xxxx_pkg(?,?)}]; SQL state [99999]; error code [17144]; statement handle not executed; nested exception is java.sql.SQLException: statement handle not executed
and
org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL [{call
xxxx_pkg(?,?,?)}]; SQL state [99999]; error code [17009]; Closed Statement; nested exception is java.sql.SQLException: Closed Statement
any clue what could be the issue,
Regards
GGits pretty simple have a java class calling hibernateTemplate's findByNamedQueryAndNamedParam method by passing the procedure name and binding parameters/values, and here is the stack
org.springframework.jdbc.UncategorizedSQLException: Hibernate operation: could not execute query; uncategorized SQLException for SQL [{call
xxx_pkg(?,?)}]; SQL state [99999]; error code [17144]; statement handle not executed; nested exception is java.sql.SQLException: statement handle not executed
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.orm.hibernate3.HibernateAccessor.convertJdbcAccessException(HibernateAccessor.java:424)
at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:410)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:411)
at org.springframework.orm.hibernate3.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:374)
at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedQueryAndNamedParam(HibernateTemplate.java:1006)
Caused by: java.sql.SQLException: statement handle not executed
at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:112)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:173)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:229)
at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:403)
at oracle.jdbc.driver.T4CStatement.doDescribe(T4CStatement.java:701)
at oracle.jdbc.driver.OracleStatement.getColumnIndex(OracleStatement.java:3355)
at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:2009)
at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:494)
at org.hibernate.type.StringType.get(StringType.java:18)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:163)
at org.hibernate.type.NullableType.nullSafeGet(NullableType.java:154)
at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2091)
at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
at org.hibernate.loader.Loader.getRow(Loader.java:1206)
at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
at org.hibernate.loader.Loader.doQuery(Loader.java:701)
at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
at org.hibernate.loader.Loader.doList(Loader.java:2217)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2108)
at org.hibernate.loader.Loader.list(Loader.java:2103)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:289)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1696)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:152)
at org.springframework.orm.hibernate3.HibernateTemplate$34.doInHibernate(HibernateTemplate.java:1015)
at org.springframework.orm.hibernate3.HibernateTemplate$34.doInHibernate(HibernateTemplate.java:1)
at org.springframework.orm.hibernate3.HibernateTemplate.doExecute(HibernateTemplate.java:406) -
SQL Update statement not executing in Filter
Hi,
I am trying to update Documents table using the query resource in a custom component. The document table is requred to upate for vault file(1 row) and for weblayout file(1 row). The java code is executing in PostConversionFilter, the sql is defined in query resource.
Query Resource is defined in componet like..
MyQResource=UPDATE Documents SET dOriginalName = ?, dFormat = ?, dFileSize = ?, dExtension = ? WHERE (dID = ? AND dIsPrimary = ? AND dIsWebFormat = ?)
This SQL executes for vault file means dIsPrimary = 1 AND dIsWebFormat = 0 however the same is not executing when for weblayout file dIsPrimary = 0 AND dIsWebFormat = 1
I putting here final satement formed, got by systematabase trace as following
For vault file:
UPDATE Documents SET dOriginalName = 'XYZ009174~1.spdf', dFormat = 'application/vnd.sealedmedia.softseal.pdf', dFileSize = 0, dExtension = 'spdf' WHERE (dID = '9559' AND dIsPrimary = 1 AND dIsWebFormat = 0)
For weblayuot file:
UPDATE Documents SET dOriginalName = 'XYZ009174~1.spdf', dFormat = 'application/vnd.sealedmedia.softseal.pdf', dFileSize = 0, dExtension = 'spdf' WHERE (dID = '9559' AND dIsPrimary = 0 AND dIsWebFormat = 1)
There is no error in logs, traces. I am using UCM 11g. in Documents table 1 row is updated for vault file only I am expecting for weblyaout updation also.
Please help what could be the possible cause?
Thanks,
Manoj
Edited by: Manoj Kumar on 15-May-2012 13:03If I got your question, you state that you see a SQL statement in systemdatabase tracing, but it is not executed in the database? Btw. you should see further details (such as how much time the query took) if you turn on full verbose tracing.
I'd just go and try to execute the same queries directly in the database (e.g. in sqlplus console). My guess is that there will be no record according to the second WHERE clause... -
Jdev9i, JSP, Execute a Sql Select statement directly?
Hi,
I need the syntax to execute a Sql SELECT statement directly against Oracle database and access rows(returned by SELECT statemnet) in a JSP page or Servlet? Any sample code available for this.
Thanks.Hi Ali,
I didn't work a lot with jsp ,but on this url some help .
http://otn.oracle.com/docs/products/oracle8i/doc_library/817_doc/java.817/a83726/basics7.htm#1014578 -
Oracle 9 - find most cpu consuming SQL + latest executed statement by user
Hi,
1. Can someone tell me how to find most CPU consuming SQL statement?
(Is this CPU_TIME in v$sql and v$sqlarea? if so is it in miliseconds?)
2. How can I find latest executed statement by a user and latest executed statement on the database (no mater what user)?
Thank you in advance.
Gr,
Adhi,
SELECT CPU,Total_Rows,sql_text FROM(
SELECT (s.cpu_time/1000000) CPU, sa.rows_processed Total_Rows, SUBSTR(sa.sql_text,1,50) sql_text
FROM v$sqlarea sa, v$sql s
WHERE sa.parsing_user_id =
(SELECT user_id FROM dba_users WHERE username='USER'
AND s.sql_text = sa.sql_text)
ORDER BY s.cpu_time DESC)
WHERE ROWNUM <= 10
Or else you can generate awr/statspack report and check the sqls which are order by more cpu_time.
2. How can I find latest executed statement by a user select a.username,a.logon_time,b.SQL_FULLTEXT from v$session a,v$sqlarea b where
a.sql_id=b.sql_id
and a.username='USER'
order by a.logon_time desc
latest executed statement on the database select a.username,a.logon_time,b.SQL_FULLTEXT from v$session a,v$sqlarea b where
a.sql_id=b.sql_id
order by a.logon_time desc
HTH
regards
Jafar -
Mass SQL executing from standalone app to sever - Suggestion only.
Which way can be the best way to execute the SQL to server in mass form.
I 'm trying to make a program which executes the mass SQL to server from the local SQL server.I even need to show the progress of excuted SQL in percentage form (multi-threading via SwingWorker) and futher more it must be recoverable when there is interrupt / crash during SQL executing process.
According to my idea I'm suceeded to execute the mass SQL from local SQL via these steps (Algorithm).
1.Query for the SQL which are not being updated in server e.g "SELECT 'SQL' FROM 'PENDING' WHERE UPLOADED=0"
2.Getting SQL one by one via Loop.
3.Creating TEMP FILE in client and write "1"
4.Execute the SQL to Server
5.Change the value of '1' to '2' in TEMP FILE
6.Update the value of UPLOADED=0 to 1 in PENDING Table
7.Finally delete the TEMP FILE from client computer .
8.Goes to next SQL until the Loop ends
I'm using TEMP_FILE so that i can know whether the SQL executing process was completed sucessfully or not. And to correct the interrupted/crashed SQL process i've used 1,2 in TEMP FILE as the step of executing process.
But somehow I think there is good way to handle this problem.So I posted here to get better solution for my problem . I 've even thought about SQL Batch Processing but I don't think it's good idea for recovering SQL from crashes and interruptHello DynamicBasics
I've followed the tutorial but not working for me!
public boolean uploadData(){
boolean isUploaded = true;
Statement s = null;
ResultSet rs = null;
connectServer();
try{
//disabling autocommit = false
getServerConnection().setAutoCommit(false);
String sql = ("INSERT INTO transaction VALUES(?,?)");
PreparedStatement stmt = getServerConnection().prepareStatement(sql);
stmt.setString(1,"SALES");
stmt.setInt(2,0);
stmt.executeUpdate(); //does it update as seperately
PreparedStatement stmt2 = getServerConnection().prepareStatement(sql);
stmt2.setString(1, "PURCHASE");
stmt2.setInt(2, 1);
stmt2.executeUpdate(); //does it update as seperately
//i've not done commit() but even it's being executed
catch(SQLException se){
se.printStackTrace();
isUploaded = false;
return isUploaded;
}As I read using Transaction is meant to execute many sql as a single unit but it's being executed seperately even i've not done commit().
I think executeUpdate() already executes the sql . Or do i need to used batch for it ??
Please help -
Avoid JDBC sender error: Execute statement did not return a result set
Hi!
My JDBC sender adapter towards MS SQL server works fine, with an Execute statement calling a stored procedure that returns the source data needed. The stored procedure itself updates the status of database table records, so that only the unread records are returned each time the stored procedure is called.
However, the communication channel monitoring sets a red flag for the JDBC sender adapter, when there are no values to fetch from the database table (using the stored procedure). Message says: "Database-level error reported by JDBC driver while executing statement 'EXECUTE FetchMessage 1, 9000'. The JDBC driver returned the following error message: 'com.microsoft.sqlserver.jdbc.SQLServerException: The statement did not return a result set.'. For details, contact your database server vendor."
This is not an error situation, as I do not expect there to be any values to fetch from the database at all times.
I do not see how to change the stored procedure to avoid this error.
Is there a parameter to be set on the JDBC adapter that I can use, so the red flag is avoided?
Thanks for any input!
Regards,
Oeystein EmhjellenHi Oeystein Emhjellen.
The problem is Store Procedure that has to generate always a ResultSet (or cursor). If it doesn't have a output, you have to generate an Empty ResultSet.
Like a SELECT Statement:
If there are data, SELECT get an output result but if it get nothing the SELECT Statement get a empty ResultSet.
Ask to your database team.
I hope it helps you.
Bruno. -
Error processing request in sax parser: Error when executing statement...
Hello,
I want to INSERT data from R/3 System to AS400 via JDBC adapter into a DB2 database. The interfaces from R/3 are Ok. but i have some problems to use the JDBC in DB2 Systems. The message in comunitation channel is:
" Error processing request in sax parser: Error when executing statement for table/stored proc. 'SPE106TST' (structure 'STATEMENT'): java.sql.SQLException: SPE106TST de SADMT1 no válido para la operación."
in the SXMB_MONI -> Request Message Mapping payloads this:
The connection to the database is fine, Sender adapter with a SELECT * works perfect.
Please Can anyone help me solve this problem? I'm lost.
Best regards,
Edited by: Nicola Occhipinti on May 22, 2008 7:40 PMHi Nicola,
This error occurs when the receiver side structure is incorrect.
Your structure seems to be correct.
Please use lower case for action, access and table.
Please check whether the field names are exactly the same as in the actual Database table sadmt1.SPE106TST.
Check if the table has permissions to write.
You can try an alternate structure without using table tag.
<ns0:MT_XMLSQL_SPEC xmlns:ns0="urn:damm.com/pi/EmployeeMasterData">
<STATEMENT>
<sadmt1.SPE106TST action="INSERT">
<access>
<CODEMP>D</CODEMP>
<CODPRO>00202339</CODPRO>
<NOMPRO>ROSIQUE PERALSGENIS</NOMPRO>
<DIRPRO>GIRONA</DIRPRO>
<POBPRO>S. VICENS HORTS</POBPRO>
<RUTA>0</RUTA>
<ORDEN>0</ORDEN>
<NOMINA>S</NOMINA>
</access>
</sadmt1.SPE106TST>
</STATEMENT>
</ns0:MT_XMLSQL_SPEC>
Hope your problem gets solved.
-Shamly -
Java.sql.SQLException: Statement cancelled, probably by transaction timing
Hi all,
I have a problem with transaction handling over 2 applications. I have 2 EAR files (*A.ear* and B.ear) which are deployed on a WLS 12.1. The WLS contains a XA datasource which is connected to a Oracle XE database. Both applications are using the same datasource. The datasource is configured to use the driver oracle.jdbc.xa.client.OracleXADataSource.
EAR A contains a Remote EJB which is is calling a local EJB. The local EJB calls a Remote EJB from EAR B.
Here is an example how the code looks like:
@Remote
@Stateless(mappedName = "AnyRemote", name = "AnyRemote")
public class AnyRemoteBean implements AnyRemote {
@EJB
private AnyLocal anyLocal;
@Override
public void doIt() {
anyLocal.doSomething();
@Local
@Stateless(mappedName = "AnyLocal", name = "AnyLocal")
public class AnyLocalBean implements AnyLocal {
@PersistenceContext(unitName = "A")
private EntityManager entityManager;
@EJB(mappedName = "AnyCompositeService")
private AnyCompositeService anyCompositeService;
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public boolean doSomething() {
try {
// do some stuff and save to database within another local EJB
anyCompositeService.doSomethingOnEAR_B();
return true;
} catch (final AnyException e) {
LOGGER.error("doSomething failed", e);
return false;
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public boolean stayOnEar_A() {
// do some stuff and save to database within another local EJB
return true;
}AnyCompositeService located in EAR B looks like this:
@Remote
@Stateless(mappedName = "AnyCompositeService ", name = "AnyCompositeService ")
public class AnyCompositeServiceBean implements AnyCompositeService {
@Override
public boolean doSomethingOnEAR_B() throws AnyException {
// do some calls to some local EJBs and some other remote EJBs and save something to database
return true;
}In this process of EAR B I'm using the entitiy manager:
@PersistenceContext(unitName = "B")
private EntityManager entityManager;persistence.xml for EAR A looks like this
<persistence-unit name="A" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>MyDatasource</jta-data-source>
<!-- some entities -->
<properties>
<property name="hibernate.transaction.jta.platform"
value="org.hibernate.service.jta.platform.internal.WeblogicJtaPlatform" />
<property name="hibernate.max_fetch_depth" value="3" />
<property name="hibernate.connection.characterEncoding" value="UTF-8" />
<property name="hibernate.connection.charSet" value="UTF-8" />
<property name="hibernate.connection.useUnicode" value="true" />
<property name="hibernate.default_batch_fetch_size" value="20" />
</properties>
</persistence-unit>
</persistence>persistence.xml for EAR B looks like this
<persistence-unit name="B" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>MyDatasource</jta-data-source>
<!-- some entities -->
<properties>
<property name="hibernate.transaction.jta.platform"
value="org.hibernate.service.jta.platform.internal.WeblogicJtaPlatform" />
<property name="hibernate.max_fetch_depth" value="3" />
<property name="hibernate.connection.characterEncoding" value="UTF-8" />
<property name="hibernate.connection.charSet" value="UTF-8" />
<property name="hibernate.connection.useUnicode" value="true" />
<property name="hibernate.default_batch_fetch_size" value="20" />
</properties>
</persistence-unit>
</persistence>As you can see the method doSomething() defines the transaction attribute TransactionAttributeType.REQUIRES_NEW.
When I execute AnyRemote.doIt() I get the following exception:
Caused By: java.sql.SQLException: Statement cancelled, probably by transaction timing out
at weblogic.jdbc.wrapper.Statement.postInvocationHandler(Statement.java:69)
at weblogic.jdbc.wrapper.PreparedStatement_oracle_jdbc_driver_OraclePreparedStatementWrapper.clearBatch(Unknown Source)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.hibernate.engine.jdbc.internal.proxy.AbstractStatementProxyHandler.continueInvocation(AbstractStatementProxyHandler.java:122)
at org.hibernate.engine.jdbc.internal.proxy.AbstractProxyHandler.invoke(AbstractProxyHandler.java:81)
at $Proxy452.clearBatch(Unknown Source)
at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.releaseStatements(AbstractBatchImpl.java:163)
at org.hibernate.engine.jdbc.batch.internal.AbstractBatchImpl.release(AbstractBatchImpl.java:197)
at org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.close(JdbcCoordinatorImpl.java:139)
at org.hibernate.engine.transaction.internal.TransactionCoordinatorImpl.close(TransactionCoordinatorImpl.java:276)
at org.hibernate.internal.SessionImpl.close(SessionImpl.java:349)
at org.hibernate.ejb.EntityManagerImpl.close(EntityManagerImpl.java:137)
at weblogic.persistence.TransactionalEntityManagerProxyImpl.close(TransactionalEntityManagerProxyImpl.java:117)
at weblogic.persistence.BasePersistenceContextProxyImpl$PersistenceContextCloser.afterCompletion(BasePersistenceContextProxyImpl.java:213)
at weblogic.transaction.internal.ServerSCInfo.doAfterCompletion(ServerSCInfo.java:1068)
at weblogic.transaction.internal.ServerSCInfo.callAfterCompletions(ServerSCInfo.java:1012)
at weblogic.transaction.internal.ServerTransactionImpl.callAfterCompletions(ServerTransactionImpl.java:3074)
at weblogic.transaction.internal.ServerTransactionImpl.afterRolledBackStateHousekeeping(ServerTransactionImpl.java:2954)
at weblogic.transaction.internal.ServerTransactionImpl.setRolledBack(ServerTransactionImpl.java:2930)
at weblogic.transaction.internal.ServerTransactionImpl.globalRetryRollback(ServerTransactionImpl.java:3172)
at weblogic.transaction.internal.ServerTransactionImpl.globalRollback(ServerTransactionImpl.java:2920)
at weblogic.transaction.internal.ServerTransactionImpl.internalCommit(ServerTransactionImpl.java:374)
at weblogic.transaction.internal.ServerTransactionImpl.commit(ServerTransactionImpl.java:268)
at weblogic.ejb.container.internal.BaseLocalObject.postInvoke1(BaseLocalObject.java:332)
at weblogic.ejb.container.internal.BaseLocalObject.__WL_postInvokeTxRetry(BaseLocalObject.java:202)
at weblogic.ejb.container.internal.SessionLocalMethodInvoker.invoke(SessionLocalMethodInvoker.java:44)As long as the process only calls EJBs from EAR A only there is no issue. But if the process calls the method doSomethingOnEAR_B() on EAR B the call fails with above exception. If the process throws AnyException the rollback takes place as expected for transaction in EAR B and EAR A.
Does anybody know what is the issue here? Is there any configuration I have overseen?That is a WLS internal message. The statement did get cancelled,
probably as a part of the process of rolling back the transaction it
was involved in. If you don't find your core problem, open an
Oracle support SR, and we could help debug this further. -
Java.sql.SQLException: Statement cache size has not been set
All,
I am trying to create a light weight SQL Layer.It uses JDBC to connect to the database via weblogic. When my application tries to connect to the database using JDBC alone (outside of weblogic) everything works fine. But when the application tries to go via weblogic I am able to run the Statement objects successfully but when I try to run PreparedStatements I get the following error:
java.sql.SQLException: Statement cache size has not been set
at weblogic.rjvm.BasicOutboundRequest.sendReceive(BasicOutboundRequest.java:108)
at weblogic.rmi.internal.BasicRemoteRef.invoke(BasicRemoteRef.java:138)
at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_OracleConnection_812_WLStub.prepareStatement(Unknown Source)
i have checked the StatementCacheSize and it is 10. Is there any other setting that needs to be implemented for this to work? Has anybody seen this error before? Any help will be greatly appreciated.
Thanks.Pooja Bamba wrote:
I just noticed that I did not copy the jdbc log fully earlier. Here is the log:
JDBC log stream started at Thu Jun 02 14:57:56 EDT 2005
DriverManager.initialize: jdbc.drivers = null
JDBC DriverManager initialized
registerDriver: driver[className=oracle.jdbc.driver.OracleDriver,oracle.jdbc.driver.OracleDriver@12e0e2f]
DriverManager.getDriver("jdbc:oracle:oci:@devatl")
trying driver[className=oracle.jdbc.driver.OracleDriver,oracle.jdbc.driver.OracleDriver@12e0e2f]
getDriver returning driver[className=oracle.jdbc.driver.OracleDriver,oracle.jdbc.driver.OracleDriver@12e0e2f]
Oracle Jdbc tracing is not avaliable in a non-debug zip/jar file
DriverManager.getDriver("jdbc:oracle:oci:@devatl")
trying driver[className=oracle.jdbc.driver.OracleDriver,oracle.jdbc.driver.OracleDriver@12e0e2f]
getDriver returning driver[className=oracle.jdbc.driver.OracleDriver,oracle.jdbc.driver.OracleDriver@12e0e2f]
DriverManager.getDriver("jdbc:oracle:oci:@devatl")
trying driver[className=oracle.jdbc.driver.OracleDriver,oracle.jdbc.driver.OracleDriver@12e0e2f]
getDriver returning driver[className=oracle.jdbc.driver.OracleDriver,oracle.jdbc.driver.OracleDriver@12e0e2f]
DriverManager.getDriver("jdbc:oracle:oci:@devatl")
trying driver[className=oracle.jdbc.driver.OracleDriver,oracle.jdbc.driver.OracleDriver@12e0e2f]
getDriver returning driver[className=oracle.jdbc.driver.OracleDriver,oracle.jdbc.driver.OracleDriver@12e0e2f]
DriverManager.getDriver("jdbc:oracle:oci:@devatl")
trying driver[className=oracle.jdbc.driver.OracleDriver,oracle.jdbc.driver.OracleDriver@12e0e2f]
getDriver returning driver[className=oracle.jdbc.driver.OracleDriver,oracle.jdbc.driver.OracleDriver@12e0e2f]
registerDriver: driver[className=weblogic.jdbc.jts.Driver,weblogic.jdbc.jts.Driver@c0a150]
registerDriver: driver[className=weblogic.jdbc.pool.Driver,weblogic.jdbc.pool.Driver@17dff15]
SQLException: SQLState(null) vendor code(17095)
java.sql.SQLException: Statement cache size has not been set
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)Hi. Ok. This is an Oracle driver bug/problem. Please show me the pool's definition
in the config.xml file. I'll bet you're defining the pool in an unusual way. Typically
we don't want any driver-level pooling to be involved. It is superfluous to the functionality
we provide, and can also conflict.
Joe
at oracle.jdbc.driver.OracleConnection.prepareCallWithKey(OracleConnection.java:1037)
at weblogic.jdbc.wrapper.PoolConnection_oracle_jdbc_driver_OracleConnection.prepareCallWithKey(Unknown Source)
at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_OracleConnection.prepareCallWithKey(Unknown Source)
at weblogic.jdbc.rmi.internal.ConnectionImpl_weblogic_jdbc_wrapper_PoolConnection_oracle_jdbc_driver_OracleConnection_WLSkel.invoke(Unknown Source)
at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:477)
at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:420)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:353)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:144)
at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:415)
at weblogic.rmi.internal.BasicExecuteRequest.execute(BasicExecuteRequest.java:30)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
SQLException: SQLState(null) vendor code(17095) -
Statement not in an executed state. ?
Hi All,
I am getting the following error:
Exception: verifyPassword=java.sql.SQLException: [Microsoft][SQLServer 2000 Driv
er for JDBC]Invalid operation. Statement not in an executed state.What could be the problem ?
Thanks
Harish PathakSorry I forgot to place the code..
here is the code..
public boolean verifyPassword(String username, String password) {
String originalPassword=null;
try {
Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
Connection con = DriverManager.getConnection("jdbc:microsoft:sqlserver://sqlserver:1433","harish","harish");
PreparedStatement pstmt = con.prepareStatement("select password from registration where username='"+username+"'");
ResultSet rs = pstmt.getResultSet();
if(rs.next()) {
originalPassword=rs.getString(1);
pstmt.close();
if(originalPassword.equals(password)) {
return true;
} else {
return false;
} catch (Exception e){
System.out.println("Exception: verifyPassword="+e);
return false;
}Please reply soon. -
SQL UPDATE Statement Explaination (urgent please...)
Hi,
Could anyone explain for me what this statement will do:
update KPIR KR
set ( CA ) = (
select sum(sl.RRC_CONN_STP_ATT) CA
from PV_WCEL_SERVICE_LEVEL sl, UTP_MO um
where sl.GLOBAL_ID = um.CO_GID
group by sl.STARTTIME, um.OBJECT_INSTANCE
I could not understand how the mapping between the two tables will be ("um" clause is not used in the select statement and it is used only in the "where" and "group by" arguments) What does this mean?.
The actual problem is that when I execute the above SQL statement, it was take around just 3 minutes to be implemented. But after we upgrade from Oracle 8 to Oracle 9, this statement is taking around 3 hours to be implemented.
Anyone have any idea what is the problem?Below is the plan:
KPIR table:
RNC_ID (str), PST ('YYYYMMDD_HH24'), CA (Numner)
1, 20061105_13, 0
1, 20061105_14, 0
1, 20061105_15, 0
2, 20061105_13, 0
2, 20061105_14, 0
2, 20061105_15, 0
3, 20061105_13, 0
3, 20061105_14, 0
3, 20061105_15, 0
4, 20061105_13, 0
4, 20061105_14, 0
4, 20061105_15, 0
PV_WCEL_SERVICE_LEVEL table:
GLOBAL_ID (str), STARTTIME ('YYYYMMDD_HH24'), RRC_CONN_STP_ATT (Number)
A1, 20061101_00, 9
A1, 20061101_01, 4
A1, 20061101_23, 3
A1, 20061130_23, 4
A2, 20061101_00, 3
A2, 20061101_01, 4
A2, 20061101_23, 1
A2, 20061130_23, 5
UTP_MO table;
RNC_ID (str), GLOBAL_ID (str), OBJECT_INSTANCE (str)
1, A1, <A1_NAME>
1, A2, <A2_NAME>
1, A9, <A9_NAME>
2, B1, <B1_NAME>
2, B2, <B2_NAME>
2, B9, <B9_NAME>
3, C1, <C1_NAME>
3, C2, <C2_NAME>
3, C9, <C9_NAME>
4, D1, <D1_NAME>
4, D2, <D2_NAME>
4, D9, <D9_NAME>
Now, I want to update the value of CA in table KPIR:
For instance, for RNC_ID='1' and at PST='20061105_13', the CA should equals to the sum of value RRC_CONN_STP_ATT for all GLOBAL_IDs under RNC_ID='1' and at STARTTIME '20061105_13'.
So, is this SQL UPDATE statement will do it?
update KPIR kr
set ( CA ) = (
select sum(sl.RRC_CONN_STP_ATT) CA
from PV_WCEL_SERVICE_LEVEL sl, UTP_MO um
where sl.GLOBAL_ID = um.GLOBAL_ID and kr.RNC_ID = um.RNC_ID and kr.PST = sl.STARTTIME
group by sl.STARTTIME, um.OBJECT_INSTANCE
And if so, why it is taking around 3 hours to be implemented? This issue is happened after upgrading from Oracle 8 to 9.
Really appreciate your help and thanks in advance. -
user created a stored procedure in one database and got "unable to execute stored procedure from database name blah blah", copied the stored procedure to another database and user could then execute it. User has exactly the same mapping in
both databases (i.e. db_datareader, db_datawriter, db_ddladmin) and is only in the server public role. why does he get the execute permissions problem on the firdt database? I have created a new user myself with the same mapping and get the same
problem.
IGNORE THIS>> I can see what the problem is now, the EXECUTE effective permission is missing from the first database - anybody know how to create an effective permission?
Update on the above following your much appreciated comments:-
1. The full error message (with any sensitive detail masked out) is:-
Msg 229, Level 14, State 5, Procedure xxxxxxxx, Line 1The EXECUTE permission was denied on the object 'xxxxxxxxx', database 'xxxxxxxxx', schema 'dbo'.
2. The problem is one database automatically gives execute permission when a login is mapped to it (even with just the db_datareader role selected) but the other doesn't. To see the permissions I refer to, right click database select
properties/permissions select the user and look at effective permissions, user has connect,execute and select (explicit permissions are connect only). The same login mapped to the other database has connect and select permissions only.
I haven't given any explicit permissions to the login mapped to the first or second database so why does the first have the explicit execute permission granted atomatically and the second not?
Even when I map the logins to the db_datawriter and db_ddladmin as well I still don't get effective execute permission on the second database. I know I can grant explicit permissions at schema or database level but do I don't have to do that
on the first database. There are no specific permissions on the schemas (i.e. db_datareader/writer/ddladmin or dbo) to public role or usersuser created a stored procedure in one database and got "unable to execute stored procedure from database name blah blah",
It might be your opinion that error messages are only blah blah, and it is not worth time reading them. However, there is often useful information in error messages, and next time you have a question, please include any error message in full. Even if the
message is nonsense to you, it may not be to us.
I can see what the problem is now, the EXECUTE effective permission is missing from the first database - anybody know how to create an effective permission?
When you create a procedure in a schema, you don't become owner of the procedure, but the schema owner becomes owner of the procedure. And with no further rights, the creator can't execute. This can be resolved by granting the user EXECUTE permission
on schema level or database level:
GRANT EXECUTE ON SCHEMA::dbo TO developers -- schema-level
GRANT EXECUTE TO developers -- database-level
As the example hints, you should grant to a role rather than an individual.
Erland Sommarskog, SQL Server MVP, [email protected] -
Update statement problem for jdbc adapter
Hi all
In the jdbc sender adapter, I configured as follows:
Query statement
select * from pickdiff where tid is null
Update statement
delete from pickdiff where tid is null
I got following error message:
Database-level error reported by JDBC driver while executing statement 'delete from pickdiff where tid is null'. The JDBC driver returned the following error message: 'java.sql.SQLException: [SQLServer 2000 Driver for JDBC][SQLServer]Die Unterabfrage gab mehr als einen Wert zurück. Das ist ungültig, wenn die Unterabfrage auf =, !=, <, <= , >, >= folgt oder als Ausdruck verwendet wird.'. For details, contact your database server vendor.
If I change the Update statement to
update pickdiff set tid = 'sapxi' where tid is null
Then everything is ok.
Doese any one have some idea about this problem?
Regards
HuiHi,
The below statements are from SAP help...
http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/frameset.htm
The UPDATE statement must alter exactly those data records that have been selected by the SELECT statement. You can ensure this is the case by using an identical WHERE clause. (See Processing Parameters, SQL Statement for Query, and SQL Statement for Update below).
● Processing can only be performed correctly when the isolation level for transaction is set to repeatable_read or serializable.
SQL statement for query: SELECT * FROM table WHERE processed = 0;
SQL statement for update: UPDATE table SET processed = 1 WHERE processed = 0;
processed is the indicator in the database.
please see if setting the isolation level would help....Also are you getting this error always or is it intermitent ?
Thanks,
Renjith
Maybe you are looking for
-
Has anyone else downloaded iOS 7 on a 4S and found the WiFi and Bluetooth don't work anymore?
I'm used to Apple products that "just work", but I'm not seeing it with the installation of iOS 7 on my phone (4S). I installed it earlier today, and the Wi-Fi and Bluetooth worked for about an hour, then just quit working altogether. The WiFi button
-
How to replace # or Not assigned with blank in BEx Query Output.
Hi, While running the query through BEx Query desginer or Anlayser, I am getting # or Not assigned where there are no values. The requirement is to "Replace # or Not assigned with a blank" in the output. I want to know, is there any setting in BEx qu
-
Upgraded both computers in the household and found Lion is too disruptive to workflow. Do I turn in the new laptop for a pre-Lion rebuild to keep Snow Leopard, or do I return new computer and get upgraded memory to improve performance of existing Ma
-
Navigation from interaction history to UIU lead screen
Hello, I can't navigate from interaction history to UIU lead transaction screen. I changed a navigation profile's Generic OP mapping from IC_LEAD to TBT108M_OV. After that, when I select a lead transaction from lists, the screen is navigated to compo
-
So iChat isn't owned by Apple?? I'm so confused...
Okay, so I'm a little lost here. I used iChat once on my dualcore G5 about a year ago, with an AIM account. Now I have .mac account (paid; not trial), and suddenly iChat won't even start at all (it shows up over by trash can area of dock as a program