Java.sql.Statement hangs
I'm having trouble executing the following statement. It never moves past execute(String sql)
execute("insert into wtchangerequest2master(IDA2A2,WTCHGREQUESTNUMBER,MARKFORDELETEA2) select IDA2A2,WTCHGREQUESTNUMBER,MARKFORDELETEA2 from ccrmaster where ccrmaster.ida2a2=239207");
whereas the following line executes perfectly
execute("select distinct ida2a2 from ccrmaster");
The statement that fails with Statement.execute works in sqlplus.
Anybody have any ideas?
Println("1 pre select");
Execute("select ...");
Println("2 post select");
Println("3 pre insert select");
Execute("insert ... Select ...");
Println("4 post insert select");
The app prints 1, 2, and 3, but hangs on the second execute and never gets to 4. No exception, no stack trace. It doesn't terminate. It just sits there.
The pseudo might be a little rough.. I sent this from my phone.
Similar Messages
-
Problem in addBatch method in java.sql.Statement Interface
Hi
I am facing a problem java.lang.UnsupportedOperationException when using addbatch() method of java.sql.Statement Interface.
Please suggest solutions.
Thanks
nsgindiaYour JDBC driver doesn't support batch operation, try another driver(not all databases support batch'es eg MySQL)
-
Java.beans.Statement & java.sql.Statement
My old code from jdk1.3.1 throws the ambiguous class thingie-mo-bob. Why did they implement the new java.beans.Statement, and is there anyway to make it default to the old java.sql.Statement without having to go through all the old code and add import java.sql.Statement. I have like 200 jsp files 'n it will take a loooong time!
PeteThere r two ways to do this.
(i) One is Implement the java.sql.Statement
like
package java.beans;
public interface Statement implements
java.sql.Statement {
}What? Are you suggesting he edit the source code for java.beans.Statement and make it implement java.sql.Statement?? I would most certainly not suggest that solution- beside violating the licensing agreement, it has troubling consequences since you are basically redefining the structure of a class in a way that makes no functional sense- that is, there is no reason for java.beans.Statement to implement methods like getConnection() and the other signatures of java.sql.Statement.
I'm not sure if I'm reading your response correctly or not, but I would definitely not refactor java.beans.Statement just to get this problem solved with out editing files ... ... since java.sql.Statement is used so widely, perhaps they should have considered a different name for java.beans.Statement , although you hate to base a name off of what's going to cause the least problems, rather then what makes the most sense ... ... any way, I guess it doesn't matter now: the name has been selected .... I'd be interested to hear how you solved the problem. -
SELECT statements hang (e.g., SELECT * FROM <table>). My connection is fine but when I attempt to execute a SQL statement (F9) it hangs; the progress bar just goes back and forth with no error reported.
Any ideas???P.S. I get the following error when selecting a database connection from Tools >> SQL Worksheet:
java.lang.NoClassDefFoundError: oracle/bali/xml/dom/buffer/util/EncodingUtils
at oracle.jdeveloper.model.JavaEditionAddin$2.recognize(JavaEditionAddin.java:356)
at oracle.ide.model.NodeFactory.findOrCreateUsingDefault(NodeFactory.java:159)
at oracle.ide.model.NodeFactory.findOrCreate(NodeFactory.java:89)
at oracle.ide.editor.RecentFile.getNode(RecentFile.java:168)
at oracle.ide.editor.RecentFile._getNode(RecentFile.java:217)
at oracle.ide.editor.RecentFile.getContext(RecentFile.java:46)
at oracle.ideimpl.editor.RecentFilesLRU.removeOldest(RecentFilesLRU.java:94)
at oracle.ideimpl.editor.RecentFilesLRU.adjustSize(RecentFilesLRU.java:76)
at oracle.ideimpl.editor.RecentFilesLRU.raiseContextInLRUList(RecentFilesLRU.java:157)
at oracle.ideimpl.editor.EditorManagerImpl.raiseContextInLRUList(EditorManagerImpl.java:1705)
at oracle.ideimpl.editor.TabGroup.setCurrentTabGroupState(TabGroup.java:1316)
at oracle.ideimpl.editor.TabGroup.activateEditor(TabGroup.java:639)
at oracle.ideimpl.editor.EditorManagerImpl.createEditor(EditorManagerImpl.java:1292)
at oracle.ideimpl.editor.EditorManagerImpl.createEditor(EditorManagerImpl.java:1215)
at oracle.ideimpl.editor.EditorManagerImpl.openEditor(EditorManagerImpl.java:1150)
at oracle.dbtools.sqlworksheet.sqlview.SqlEditorWizard.invoke(SqlEditorWizard.java:128)
at oracle.ide.wizard.WizardManager.invokeWizard(WizardManager.java:310)
at oracle.dbtools.sqlworksheet.sqlview.SqlEditorAddin$1.actionPerformed(SqlEditorAddin.java:151)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1849)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2169)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:420)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258)
at javax.swing.AbstractButton.doClick(AbstractButton.java:302)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1000)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1041)
at java.awt.Component.processMouseEvent(Component.java:5488)
at javax.swing.JComponent.processMouseEvent(JComponent.java:3126)
at java.awt.Component.processEvent(Component.java:5253)
at java.awt.Container.processEvent(Container.java:1966)
at java.awt.Component.dispatchEventImpl(Component.java:3955)
at java.awt.Container.dispatchEventImpl(Container.java:2024)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4212)
at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3892)
at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3822)
at java.awt.Container.dispatchEventImpl(Container.java:2010)
at java.awt.Window.dispatchEventImpl(Window.java:1774)
at java.awt.Component.dispatchEvent(Component.java:3803)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:463)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:242)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:163)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:157)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:149)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:110)
Right-clicking on a database connection (or double-clicking) connects fine without error. -
Sql statement hanging in prod. fast in dev.
Hi,
Sql statement is hanging in production.
In development it is executing in 2 secs.
From explainplan , noticed that taking different indexes.
I have posted the staement and explain plan (prod and dev) below.
Statement:
SELECT
REP_V_SERVICE_REQUEST.SERVICE_REQ_ID,
REP_V_ACTIVITY.EXTERNAL_REF,
REP_V_ACTIVITY.VENUS_PROBLEM_START,
REP_V_ACTIVITY.VENUS_ALERT_ISSUED,
REP_V_ACTIVITY.VENUS_NOTIFIED,
REP_V_ACTIVITY.ACTIVITY_ID,
REP_V_ACTIVITY.CREATED_BY_WORKGROUP,
REP_V_ACTIVITY.ABSTRACT,
REP_V_ACTIVITY.TIME_TO_VENUS_ALERT,
REP_V_ACTIVITY.TIME_TO_VENUS_ISSUE,
REP_V_ACTIVITY.TIME_TO_VENUS_NOTIFIED,
REP_V_SERVICE_REQUEST.TYPE,
REP_V_SERVICE_REQUEST.SUB_TYPE,
REP_V_SERVICE_REQUEST.CLASSIFICATION_TYPE,
REP_V_SERVICE_REQUEST.CLASSIFICATION_SUB_TYPE,
( REP_V_SERVICE_REQUEST.TIME_OPENED ),
REP_V_SERVICE_REQUEST.CREATED_BY_WORKGROUP,
REP_V_ACTIVITY.VENUS_SENT_TO_SDN,
SR_RESOLVER_WG.WORKGROUP
FROM
REP_V_SERVICE_REQUEST,
REP_V_ACTIVITY,
REP_V_WORKGROUP SR_RESOLVER_WG
WHERE
( SR_RESOLVER_WG.WORKGROUP_ID=REP_V_SERVICE_REQUEST.RESOLUTION_GROUP_ID )
AND ( REP_V_ACTIVITY.SERVICE_REQUEST_ROW_ID=REP_V_SERVICE_REQUEST.SERVICE_REQUEST_ROW_ID )
AND (
REP_V_ACTIVITY.PLANNED_START_TIME BETWEEN '01-JAn-2006' AND '19-Jun-2006'
AND REP_V_ACTIVITY.VENUS_PROBLEM_STATUS NOT IN ('Information', 'Planned')
AND REP_V_ACTIVITY.VENUS_ALERT_STATUS != 'Withdrawn'
AND REP_V_ACTIVITY.CREATED_BY_WORKGROUP LIKE '%SSHD%'
AND REP_V_ACTIVITY.STATUS != 'Cancelled'
AND REP_V_ACTIVITY.CREATED_BY_WORKGROUP NOT LIKE 'GLO_SSHD_MTC'
Exp. plan(prod)
24 SELECT STATEMENT
23 NESTED LOOPS (OUTER)
21 NESTED LOOPS (OUTER)
19 NESTED LOOPS
16 NESTED LOOPS
13 NESTED LOOPS
10 NESTED LOOPS (OUTER)
8 NESTED LOOPS
5 NESTED LOOPS
2 TABLE ACCESS (BY INDEX ROWID), S_ORG_EXT (SIEBEL)
1 INDEX (FULL SCAN), S_ORG_EXT_F13 (SIEBEL)
4 TABLE ACCESS (BY INDEX ROWID), S_BU (SIEBEL)
3 INDEX (UNIQUE SCAN), S_BU_P1 (SIEBEL)
7 TABLE ACCESS (BY INDEX ROWID), S_SRV_REQ (SIEBEL)
6 INDEX (RANGE SCAN), S_SRV_REQ_U2 (SIEBEL)
9 INDEX (UNIQUE SCAN), S_SRV_REGN_P1 (SIEBEL)
12 TABLE ACCESS (BY INDEX ROWID), SERVICE_REQUEST (CRMREP_REP)
11 INDEX (UNIQUE SCAN), PK_SR (CRMREP_REP)
15 TABLE ACCESS (BY INDEX ROWID), S_EVT_ACT (SIEBEL)
14 INDEX (RANGE SCAN), S_EVT_ACT_F14 (SIEBEL)
18 TABLE ACCESS (BY INDEX ROWID), ACTIVITY (CRMREP_REP)
17 INDEX (UNIQUE SCAN), PK_A (CRMREP_REP)
20 INDEX (RANGE SCAN), S_EVT_MAIL_U1 (SIEBEL)
22 INDEX (RANGE SCAN), S_EVT_ACT_X_U1 (SIEBEL
Exp plan(Dev):
24 SELECT STATEMENT
23 NESTED LOOPS (OUTER)
21 NESTED LOOPS (OUTER)
19 NESTED LOOPS
16 NESTED LOOPS
13 NESTED LOOPS (OUTER)
11 NESTED LOOPS
8 NESTED LOOPS
5 NESTED LOOPS
2 TABLE ACCESS (BY INDEX ROWID), S_EVT_ACT (SIEBEL)
1 INDEX (RANGE SCAN), S_EVT_ACT_M8 (SIEBEL)
4 TABLE ACCESS (BY INDEX ROWID), S_SRV_REQ (SIEBEL)
3 INDEX (UNIQUE SCAN), S_SRV_REQ_P1 (SIEBEL)
7 TABLE ACCESS (BY INDEX ROWID), S_ORG_EXT (SIEBEL)
6 INDEX (UNIQUE SCAN), S_ORG_EXT_U3 (SIEBEL)
10 TABLE ACCESS (BY INDEX ROWID), S_BU (SIEBEL)
9 INDEX (UNIQUE SCAN), S_BU_P1 (SIEBEL)
12 INDEX (UNIQUE SCAN), S_SRV_REGN_P1 (SIEBEL)
15 TABLE ACCESS (BY INDEX ROWID), SERVICE_REQUEST (REPORT)
14 INDEX (UNIQUE SCAN), PK_SR (REPORT)
18 TABLE ACCESS (BY INDEX ROWID), ACTIVITY (REPORT)
17 INDEX (UNIQUE SCAN), PK_A (REPORT)
20 INDEX (RANGE SCAN), S_EVT_MAIL_U1 (SIEBEL)
22 INDEX (RANGE SCAN), S_EVT_ACT_X_U1 (SIEBEL)
I checked the v$session_wait while it is hanging,
It is waiting for table s_evt_act (prod. 1.6 crores,dev. 1 crore)
In development it is accessing S_EVT_ACT_M8 (SINGLE COLUMN)index,in production
it is accessing S_EVT_ACT_F14(COMBN. TWO COLUMNS BUT DIFFERENT FROM PRODUCTION).
Thanks,
kumar.This query is not executing for last 5 to 6 months.
I am new to this issue.
pls find the outof v$session_event for this session.
It is waiting for db file sequential read and the wait is keep on increasing.
SID EVENT TOTAL_WAITS TOTAL_TIMEOUTS TIME_WAITED AVERAGE_WAIT MAX_WAIT TIME_WAITED_MICRO
43 db file sequential read 141459 0 130565 1 66 1305647401
43 db file scattered read 77437 0 54259 1 466 542587342
43 direct path write 1222 0 867 1 26 8671937
43 buffer busy waits 570 0 318 1 4 3175286
43 SQL*Net message to client 339 0 0 0 0 866
43 SQL*Net message from client 338 0 84716 251 32623 847156015
43 latch free 14 12 6 0 2 59905
43 direct path read 6 0 1 0 0 12290
43 log file sync 1 0 0 0 0 2268 -
MS Access queries different to Java SQL statements
Ok, i dont understand something:
My program is connected to a MSAccess datasource. The query in MSAccess is
SELECT *
FROM Food_Data
WHERE Description Like 'Cheese*';
...but this wont work with a Java SQl query. I have to use this instead:
String query = "SELECT * FROM Food_Data " +
"WHERE Description LIKE 'Cheese%'";
Surely java would just passes the string query to MSAccess. But no. Java needs '%' as the wildcard, and MSAccess needs '*' as the wildcard.
Can anyone please explain this to me?Well % is the standard wildcard character for SQL as defined by the ANSI standard. MS Access just doesn't conform to this standard.
Having said that, I'm still kind of astonished that it doesn't work :-)
The JDBC driver should pass the statement "as is" to the underlying DBMS, but obviously the JDBC/ODBC bridge does some "quirking". But maybe it
s the ODBC datasource. I can see a "ExtendedAnsiSQL" setting in one of my Access ODBC settings, maybe that changes something. -
Java.sql functions hanging for 60 seconds
I have an Oracle 8.1.6 application on Solaris with Tomcat 3.1 using JDBC to talk to the database. I am using the thin driver for JDK 1.2.2. I moved a box from development to production and changed the network information in the database and in Solaris. Now I have strange behavior where about 5% of the time functions such as Connection.prepareStatement, ResultSet.close, and PreparedStatement.close will sleep for 60 seconds. Then they proceed as normal. It is always 60 seconds, never a hard deadlock. The application is multithreaded, being inside Tomcat and all. The other strange behavior is that when another thread accesses the database, the first thread that was sleeping will wake up and proceed as normal. I will try to switch to the OCI driver, but I think it is very strange that the thread hangs for exactly 60 seconds inside the calls to the JDBC driver. The other 95% of the time it works great.
We switched the driver to OCI instead of thin. It looks like it is working OK now. I suppose it was some strange behavior in the thin driver.
-
About java.sql.Statement
Hi friends, i want to ask if there is any way to display the complete statement as a string after setting it's parameters(that is for debuging purpose).
Hi friends, i want to ask if there is any way to
display the complete statement as a string after
setting it's parameters(that is for debuging purpose).JDBC related questions should be asked in the JDBC forum.
Your subject line is contraindicative to your question which is about PreparedStatements.
The answer to your question is no. You can however use a tracing driver that will log your queries so that you can see what is going on. Look at http://www.p6spy.com/ -
Hello!
Our tests indicate that fetch size option mentioned makes visible difference in performance for non-scrollable result sets also. In the same time, it seems there is no way to set this option for such result sets at TopLink level, and default fetch size is always used instead.
Can somebody propose a solution for this, I mean a way to specify custom fetch size (for results without any scrolling)?
Thanks,
SergeyTo set the JDBC fetch size for a query, use the following APIs:
int desiredFetchSize = 500;
ReadAllQuery query = new ReadAllQuery(YourClass.class);
CallQueryMechanism queryMechanism =
(CallQueryMechanism) query.getQueryMechanism();
DatabaseCall call = queryMechanism.getCall();
call.setResultSetFetchSize(desiredFetchSize);
If you wish to set the fetch size for all queries, consider using named queries for all queries (see the TopLink documentation for more information on named queries), and then configure them on startup.
Information taking from Metalink Note:237093.1 -
Java.sql.Statement: setQueryTimeout(int seconds) ???
Anyboby knows if this method is working with MySQL-Connector JDBC driver ?
If not, is there another way to time out a select query ?
Thanks a lot
LudovicDo you have an idea of how I can test it ?Well you can time a select query and afterwards set the timeout interval to a value less than the time of the query. Start the same query and check the results.
So long. -
Does Java support mutliple sql statements in one call?
statment.executeUpdate("DROP DATABASE IF EXISTS diy55;CREATE DATABASE IF NOT EXISTS diy55 DEFAULT CHARACTER SET utf8;GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,ALTER,INDEX,USAGE on diy55.* TO 'diy55'@'localhost' identified by 'diy55';FLUSH PRIVILEGES;");Java seemes doesn't support multiple sql statements in one call, just like PHP mysql_query(), is it?
Then just extend the java.sql.Statement to your own Statement class and write logic which splits the given query at the right places and executes them one by one.
That the mysql_query() already has it built-in wouldn't say that it isn't possible in Java. Comparing with PHP is a bit pointless, it is a completely different language. -
Java.sql.SQLException: Io exception: End of TNS data channel
Hello folks,
Has amyone encountered this exception? If so, could you please shed some light for what might be going wrong?
Here is my confuguration:
400MB RAM
1.2GHTz processor
Win2K Pro
Oracle server 9.0.1
JDBC Thin driver (libs for 9.0.1)
Scenario:
My Java code uses Oracle Spatial to insert SDO_GEOMETRY objects into my DB model.
I have a config file where I store my connection properties, e.g.,
<DBConnection name="twatest">
<JDBCDriver>oracle.jdbc.driver.OracleDriver</JDBCDriver>
<URL>jdbc:oracle:thin:@saturn:1521:saturn</URL>
<Username>user1</Username>
<Password>twatest</Password>
</DBConnection>
We have 2 schemas defined: user1 and twatest.
The problem first occured when I switched from user1 to twatest. Consequent attempt to run the process as user user1 failed! The Java SQL statements do not use schemas (so they default, I suppose, to the default schema for that particular user, in our case being user1-->user1, twatest-->twatest).
The problem happens in the following Java class (search for "HERE" to see where exactly the problem occurs):
package com.vividsolutions.twatest;
import java.util.*;
import java.sql.*;
import oracle.sql.*;
import oracle.sdoapi.OraSpatialManager;
import oracle.sdoapi.geom.*;
import oracle.sdoapi.adapter.*;
import oracle.sdoapi.sref.*;
import com.vividsolutions.twatest.parser.*;
import com.vividsolutions.twatest.config.*;
import com.vividsolutions.twatest.model.*;
* This class is responsible for loading lakes into the SDO Oracle Spatial DB.
public class LakeLoader
static boolean initialized = false;
private static GeometryFactory gF;
private static SRManager srManager;
private static SpatialReference sref;
private static GeometryAdapter sdoAdapter;
public static void loadLake(EdgedLake slake, Connection conn) throws Exception {
com.vividsolutions.jts.geom.Envelope e = slake.getEnvelope();
if (e == null) {
System.out.println("Invalid envilope (feature ID="+slake.getFeatureId()+")! Ignoring...");
return; // ignore lake - it's invalid (no envilope)
if (!initialized) {
initialize(conn);
initialized = true;
Geometry geom;
STRUCT str;
// insert Lake
String lakeQuery = "INSERT INTO lake " +
"(lake_id, area, bounding_box, name, instantiation_date) " +
"VALUES(?,?,?,?,?)";
PreparedStatement ps = conn.prepareStatement(lakeQuery);
int lakeId = getId(Lake.ID, conn);
ps.setInt(1, lakeId);
ps.setDouble(2, Double.parseDouble(slake.getArea()));
// Creates a 2-D rectangle (special case of Polygon geometry).
geom = gF.createRectangle(e.getMinX(), e.getMinY(), e.getMaxX(), e.getMaxY());
ps.setObject(3, sdoAdapter.exportGeometry(STRUCT.class, geom));
ps.setString(4, slake.getName());
ps.setTimestamp(5, new Timestamp(new java.util.Date().getTime()));
ps.executeUpdate(); // <-- HERE I got: java.sql.SQLException: Io exception: End of TNS data channel
//ps.close();
String ringQuery = null;
int ringId = 0;
List shellEdges = slake.getShellEdges();
if (shellEdges != null && shellEdges.size() > 0) { // if there is valid shell, insert it...
// insert shell Rings
ringQuery = "INSERT INTO ring (ring_id, lake_id, type) VALUES(?,?,?)";
ps = conn.prepareStatement(ringQuery);
ringId = getId(Ring.ID, conn);
ps.setInt(1, ringId);
ps.setInt(2, lakeId);
ps.setString(3, Ring.SHELL);
ps.executeUpdate();
//ps.close();
// insert shell ring Edges
insertEdges(shellEdges, lakeId, Ring.SHELL, ringId, conn);
List holeEdges = slake.getHoleEdges();
if (holeEdges != null && holeEdges.size() > 0) { // if there are valid holes, insert them...
// insert hole Rings
ringQuery = "INSERT INTO ring (ring_id, lake_id, type) VALUES(?,?,?)";
ps = conn.prepareStatement(ringQuery);
ringId = getId(Ring.ID, conn);
ps.setInt(1, ringId);
ps.setInt(2, lakeId);
ps.setString(3, Ring.HOLE);
ps.executeUpdate();
//ps.close();
// insert hole ring Edges
insertEdges(holeEdges, lakeId, Ring.HOLE, ringId, conn);
ps.close();
private static void insertEdges(List edges, int lakeId, String ringType,
int ringId, Connection conn) throws Exception {
if (!initialized) {
initialize(conn);
initialized = true;
Geometry geom;
STRUCT str;
// insert shell ring Edges
String edgeQuery = "INSERT INTO edge " +
"(edge_id, lake_id, ring_type, ring_id, edge_sequence, shape) " +
"VALUES(?,?,?,?,?,?)";
int edge_sequence = 0;
for (Iterator it=edges.iterator(); it.hasNext(); ) {
Edge edge = (Edge)it.next();
geom = gF.createLineString(LakeFactory.edgeToArray2D(edge)); // 2-dimensional coordinates
PreparedStatement ps = conn.prepareStatement(edgeQuery);
int edgeId = getId(Edge.ID, conn);
ps.setInt(1, edgeId);
ps.setInt(2, lakeId);
ps.setString(3, ringType);
ps.setInt(4, ringId);
ps.setInt(5, edge_sequence++);
ps.setObject(6, sdoAdapter.exportGeometry(STRUCT.class, geom));
ps.executeUpdate();
ps.close();
* @param key This can be: "lake", "ring", or "edge".
* @param conn The connection to use.
* @return the unique ID corresponding to the given key.
public static int getId(String key, Connection conn) {
int id = -1;
try {
String query = "SELECT "+key+"_SEQUENCE.NEXTVAL FROM DUAL";
Statement stmt = conn.createStatement();
ResultSet rs = stmt.executeQuery(query);
while (rs.next()) {
id = rs.getInt(1);
stmt.close();
} catch(SQLException sqle) {
sqle.printStackTrace();
return id;
private static void initialize(Connection conn) throws Exception {
gF = OraSpatialManager.getGeometryFactory();
// Set spatial reference system in which the geometries will be created
srManager = OraSpatialManager.getSpatialReferenceManager(conn);
sref = srManager.retrieve(8307);
gF.setSpatialReference(sref);
sdoAdapter = OraSpatialManager.getGeometryAdapter("SDO", "8.1.6",
null, STRUCT.class, null, conn);
public static void main(String args[]) throws Exception
String[] xmlLakeFiles = {
"lakes101to1400.xml",
"lakes1401to10000.xml",
"lakes10001to20000.xml",
"lakes20001to30000.xml",
"lakes30001to40000.xml",
"lakes40001to50000.xml",
"lakes50001to60000.xml"
PropertyManager pm = new PropertyManager();
int numberOfLoadedLakes = 0;
try {
pm.initialize();
Map modelMap = (Map)pm.get(XMLConfigFile.MODEL_MAP);
LakeModel lakeModel = (LakeModel)modelMap.get(LREConcreteLakeModel.NAME);
Connection connection = ConnectionManager.getConnection();
lakeModel.setConnection(connection);
for (int i=0; i<xmlLakeFiles.length; i++) {
long then = System.currentTimeMillis();
System.out.println("Loading lake "+xmlLakeFiles[i]+"...");
numberOfLoadedLakes = lakeModel.loadModel(xmlLakeFiles);
long now = System.currentTimeMillis();
System.out.println("Loaded "+numberOfLoadedLakes+" lakes!");
System.out.println("Execution time: "+(now-then)/1000+" seconds!");
System.out.println("Loading lake "+xmlLakeFiles[i]+"...done!");
connection.close();
} catch(Exception e) {
e.printStackTrace();
My client class calls LakeLoader.loadLake() method in a loop to load a bunch of Lake objects into the DB. The first lake in the list is created without problems, but when the 2-nd lake is being inserted, I get an exception at the preparedStatement.executeUpdate() statement. This happens consistently.
I tried to find information on this on the net, but seems that this problem only happened when people dealt with LOBs?!
Thank you very much!
GeorgiSuresh -- I'd probably log a TAR with Oracle support for this question if you definitely need it resolved. Support have access to all manner of existing cases, so this may be something they have seen before.
cheers
-steve- -
Java.sql.PreparedStament
when i use the java.sql.statement i cant create it with scrollable property. like this:
// Create a Statement object that will be used to excecute the query.
// The arguments specify that the returned ResultSet will be
// scrollable, read-only, and insensitive to changes in the db.
Statement statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
// Run the query, creating a ResultSet
ResultSet r = statement.executeQuery(query);
the java.sql.PreparedStatement is scrollable or can be ???
regardsConnection class has this method (signature copied and pasted from my 1.3 javadoc):
public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) throws SQLException -
Numeric Overflow; nested exception is java.sql.SQLException: Numeric Overfl
Dear Team,
We are getting below errors in java,
SQL state [99999]; error code [17026]; Numeric Overflow; nested exception is java.sql.SQLException: Numeric Overflow
java.sql.SQLException: Numeric Overflow
at oracle.jdbc.driver.NumberCommonAccessor.throwOverflow(NumberCommonAccessor.java:4380)
at oracle.jdbc.driver.NumberCommonAccessor.getInt(NumberCommonAccessor.java:214)
at oracle.jdbc.driver.OracleResultSetImpl.getInt(OracleResultSetImpl.java:896)
at oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java:434)
Thanks,
selva
Edited by: SELVAPA on Apr 25, 2013 4:05 PM>
at oracle.jdbc.driver.OracleResultSet.getInt(OracleResultSet.java:434)
>
That 'getInt' method returns a Java 'int'. It will attempt to convert the actual data value in the result set column to an int.
If the value is too large, too small or isn't even numeric you will get an exception.
Isolate the problem (e.g. by debugging) to the row giving the exception and then examine the actual data value. If you are using NetBeans (or other) you can use the 'getString' method to see what the value is that is causing the problem.
The actual 'solution' to the problem depends on your database, the table column definition and the business rules being implemented.
You table could contain 'dirty' data and contain values larger than you want to be stored.
Or your actual data could be correct and you are just using 'getInt' instead of 'getBigDecimal' or other method to get the value.
Don't apply a 'solution' until you actually know what the problem is and the proper solution to implement. -
i am trying to execute the following query using jdbc
String state = "select * from cs_test where Start_Time < DateAdd(\"s\",-19800,now()) AND End_Time >
DateAdd(\"s\",-19800,now())";
/java.sql.PreparedStatement querycs_test = c.prepareStatement(state);
java.sql.Statement querycs_test= c.createStatement();
java.sql.ResultSet rs = querycs_test.executeQuery(state);
when i run the same query at the prompt in MS Access it works fine.
The same line replaced with a simpler query works fine.
but when i run the above i get an error
java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.Here's the value of your query before preparing it:
select * from cs_test where Start_Time < DateAdd("s",-19800,now()) AND End_Time > DateAdd("s",-19800,now())My SQL refererence doesn't have anything about functions called DateAdd or now. It might be Microsoft specific, in which case when your organization converts to another database your query is going to stop working. Don't use vender specific extensions.
Was your intention to call a Java method called DateAdd or now? Then your problem is a few missing quotes. Otherwise, I'm sorry I can't be of more help.
Maybe you are looking for
-
For example, I want to set up a pdf embeded with code, and send it on-line. People who want it should pay for it first and get the access code. I need to set different access code in order to avoid people A give the access to people B.
-
IPod Touch 4.1 & AOL outgoing
AOL outgoing: I keep getting a message saying "the recipient was rejected by the server because it does not allow relaying". HUH? IPod touch 4.1
-
Checking/unchecking a box in "get info" with Applescript
I've never used Applescript or automator but I think one of them could help me. I need to run Photoshop CS3 normally most of the time but when I have to scan I have to run it in Rosetta. To do this I get the "get info" box up for CS3 and check or unc
-
How to Pass internal table from a program to Samrt form
Hi Pals I want to pass an internal table which I have declared in the program to Smartform..can you please help me asap. Regards Praveen
-
Not enough memory to complete operation
I've looked through the forums for the "not enough memory to complete operation" error and despite following the advice I found, the error still occurs. I'm using LabVIEW 2012 to try and continuously monitor our system, recording temperature, power,