9.2.0 Thin driver; PreparedStatement.close() gives NullPointerException when close()d
Here's the error stack:
--- Nested Exception ---
java.lang.NullPointerException
at oracle.jdbc.dbaccess.DBData.clearItem(DBData.java:431)
at oracle.jdbc.dbaccess.DBDataSetImpl.clearItem(DBDataSetImpl.java:3528)
at oracle.jdbc.driver.OraclePreparedStatement.clearParameters(OraclePreparedSta
at com.secretseal.util.sql.PooledPreparedStatement.close(PooledPreparedStatemen
at com.secretseal.util.sql.LoggableStatement.close(LoggableStatement.java:112)
Has anybody has this issue? Thank you in advance.
workaround: use Oracle proprietary batching, setExecuteBatch(). My webapp is facing the exact problem. But I used the Oracle 8i drivers and it worked. Meanwhile, will you please tell me what is the AppServer you are using? Cause this happens in Websphere 4.0.x environment but not in 3.5.x and weblogic.
Thanks,
Similar Messages
-
Using oracle thin driver with to_char gives invalid column name
select x,y,z, to_char(event_time,'YYYY-MMM-DD') from eventtable;
if i execute the above query using oracle thin driver it gives me invalid column name. It works fine if i use weblogic driver. So what could be the problem ???
thanks.Sorry , forgot to add that 'YYYY-MM-DD' or 'YYYY-Month-DD' or 'Year-MM-DD' or 'Year-Month-DD' are also allowed(please cheek also for other combinations), not 'YYYY-MMM-DD'.
Thanks -
Error configuring the Oracle 8.1.7 XA Thin driver with WLS 6.1 SP1
I am trying to configure the Oracle 8.1.7.0 thin driver and am getting an SystemException
when the pool tries to test the connection at server startup. It looks like the
start() method is failing. I have put Oracle's Classes12.zip, jndi.zip, and the
jta.zip on the classpath immediately after the weblogic.jar entry. Is this a
classpath issue? Can someone that has this working please help me. Thanks in
advance. Steve
The following is the JDBC Pool entry in the config.xml file:
<JDBCConnectionPool
DriverName="oracle.jdbc.xa.client.OracleXADataSource"
InitialCapacity="0" LoginDelaySeconds="1" MaxCapacity="20"
Name="oraclePoolSun3500XAThin" Properties="user=sschaber;url=jdbc:oracle:thin:@199.191.94.4:1521:ORCLT;password=sschaber;dataSourceName=oraclePoolSun3500XAThin"
RefreshMinutes="5" ShrinkPeriodMinutes="30"
Targets="memphisserver" TestConnectionsOnRelease="true"
TestConnectionsOnReserve="true" TestTableName="Dual" URL="jdbc:oracle:thin:@199.191.94.4:1521:ORCLT"/>
Also, here is the entire exception being thrown:
<Apr 5, 2002 1:33:08 PM CST> <Info> <JDBC Pool oraclePoolSun3500XAThin> <javax.transaction.SystemException:
start() failed on resource 'oracle.jdbc.xa.client.Or
acleXAResource' null
at weblogic.transaction.internal.ServerResourceInfo.xaStart(ServerResourceInfo.java:998)
at weblogic.transaction.internal.ServerResourceInfo.enlist(ServerResourceInfo.java:234)
at weblogic.transaction.internal.ServerTransactionImpl.enlistResource(ServerTransactionImpl.java:374)
at weblogic.jdbc.common.internal.ConnectionEnv.test(ConnectionEnv.java:915)
at weblogic.common.internal.ResourceAllocator.trigger(ResourceAllocator.java:1114)
at weblogic.time.common.internal.ScheduledTrigger.executeLocally(ScheduledTrigger.java:238)
at weblogic.time.common.internal.ScheduledTrigger.execute(ScheduledTrigger.java:229)
at weblogic.time.server.ScheduledTrigger.execute(ScheduledTrigger.java:65)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>
<Apr 5, 2002 1:33:08 PM CST> <Info> <JDBC Pool oraclePoolSun3500XAThin> <This
connection will now be refreshed.>
<Apr 5, 2002 1:33:10 PM CST> <Info> <JDBC> <Connection for XA pool "oraclePoolSun3500XAThin"
refreshed.>
<Apr 5, 2002 1:33:10 PM CST> <Info> <JDBC Pool oraclePoolSun3500XAThin> <A connection
from pool oraclePoolSun3500XAThin was tested during reserve with a select
count(*) from Dual and failed:>
<Apr 5, 2002 1:33:10 PM CST> <Info> <JDBC Pool oraclePoolSun3500XAThin> <javax.transaction.SystemException:
start() failed on resource 'oracle.jdbc.xa.client.Or
acleXAResource' null at weblogic.transaction.internal.ServerResourceInfo.xaStart(ServerResourceInfo.java:998)
at weblogic.transaction.internal.ServerResourceInfo.enlist(ServerResourceInfo.java:234)
at weblogic.transaction.internal.ServerTransactionImpl.enlistResource(ServerTransactionImpl.java:374)
at weblogic.jdbc.common.internal.ConnectionEnv.test(ConnectionEnv.java:915)
at weblogic.common.internal.ResourceAllocator.reserve(ResourceAllocator.java:465)
at weblogic.common.internal.ResourceAllocator.reserveUnused(ResourceAllocator.java:376)
at weblogic.common.internal.ResourceAllocator.trigger(ResourceAllocator.java:1103)
at weblogic.time.common.internal.ScheduledTrigger.executeLocally(ScheduledTrigger.java:238)
at weblogic.time.common.internal.ScheduledTrigger.execute(ScheduledTrigger.java:229)
at weblogic.time.server.ScheduledTrigger.execute(ScheduledTrigger.java:65)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>
<Apr 5, 2002 1:33:10 PM CST> <Info> <JDBC Pool oraclePoolSun3500XAThin> <This
connection will now be refreshed.>This still does not work for me. I must be missing something here. Any help would
be appreciated.
Thanks,
Steve
"Sree Bodapati" <[email protected]> wrote:
Hi Steve,
I see the initial capacity is set to zero , can you push it up to atleast
few connections and see if it helps, and Let me know.
thanks
sree
"Steve Schaber" <[email protected]> wrote in message
news:[email protected]...
I made sure that we have the latest version of the classes12.zip file(8.1.7).
Also, moved the classes12.zip, jndi.zip, and the jta.zip file beforethe
weblogic.jar
file in the classpath. I am still getting the same error.
Steve
"Sree Bodapati" <[email protected]> wrote:
Put the classes12.zip and other zip files before the weblogic.jar
file
in
the classpath. ensure that you have the latest classes12.zip filefrom
oracle.
sree
"Steve Schaber" <[email protected]> wrote in message
news:[email protected]...
I am trying to configure the Oracle 8.1.7.0 thin driver and am gettingan
SystemException
when the pool tries to test the connection at server startup. It
looks
like the
start() method is failing. I have put Oracle's Classes12.zip,
jndi.zip,
and the
jta.zip on the classpath immediately after the weblogic.jar entry.Is
this a
classpath issue? Can someone that has this working please help
me.
Thanks in
advance. Steve
The following is the JDBC Pool entry in the config.xml file:
<JDBCConnectionPool
DriverName="oracle.jdbc.xa.client.OracleXADataSource"
InitialCapacity="0" LoginDelaySeconds="1" MaxCapacity="20"
Name="oraclePoolSun3500XAThin"
Properties="user=sschaber;url=jdbc:oracle:thin:@199.191.94.4:1521:ORCLT;pass
word=sschaber;dataSourceName=oraclePoolSun3500XAThin"
RefreshMinutes="5" ShrinkPeriodMinutes="30"
Targets="memphisserver" TestConnectionsOnRelease="true"
TestConnectionsOnReserve="true" TestTableName="Dual"URL="jdbc:oracle:thin:@199.191.94.4:1521:ORCLT"/>
Also, here is the entire exception being thrown:
<Apr 5, 2002 1:33:08 PM CST> <Info> <JDBC Pool oraclePoolSun3500XAThin><javax.transaction.SystemException:
start() failed on resource 'oracle.jdbc.xa.client.Or
acleXAResource' null
at
weblogic.transaction.internal.ServerResourceInfo.xaStart(ServerResourceInfo..
java:998)
at
weblogic.transaction.internal.ServerResourceInfo.enlist(ServerResourceInfo.j
ava:234)
at
weblogic.transaction.internal.ServerTransactionImpl.enlistResource(ServerTra
nsactionImpl.java:374)
atweblogic.jdbc.common.internal.ConnectionEnv.test(ConnectionEnv.java:915)
at
weblogic.common.internal.ResourceAllocator.trigger(ResourceAllocator.java:11
14)
at
weblogic.time.common.internal.ScheduledTrigger.executeLocally(ScheduledTrigg
er.java:238)
at
weblogic.time.common.internal.ScheduledTrigger.execute(ScheduledTrigger.java
:229)
atweblogic.time.server.ScheduledTrigger.execute(ScheduledTrigger.java:65)
at
weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>
<Apr 5, 2002 1:33:08 PM CST> <Info> <JDBC Pool oraclePoolSun3500XAThin><This
connection will now be refreshed.>
<Apr 5, 2002 1:33:10 PM CST> <Info> <JDBC> <Connection for XA pool"oraclePoolSun3500XAThin"
refreshed.>
<Apr 5, 2002 1:33:10 PM CST> <Info> <JDBC Pool oraclePoolSun3500XAThin><A
connection
from pool oraclePoolSun3500XAThin was tested during reserve with
a
select
count(*) from Dual and failed:>
<Apr 5, 2002 1:33:10 PM CST> <Info> <JDBC Pool oraclePoolSun3500XAThin><javax.transaction.SystemException:
start() failed on resource 'oracle.jdbc.xa.client.Or
acleXAResource' null at
weblogic.transaction.internal.ServerResourceInfo.xaStart(ServerResourceInfo..
java:998)
at
weblogic.transaction.internal.ServerResourceInfo.enlist(ServerResourceInfo.j
ava:234)
at
weblogic.transaction.internal.ServerTransactionImpl.enlistResource(ServerTra
nsactionImpl.java:374)
atweblogic.jdbc.common.internal.ConnectionEnv.test(ConnectionEnv.java:915)
at
weblogic.common.internal.ResourceAllocator.reserve(ResourceAllocator.java:46
5)
at
weblogic.common.internal.ResourceAllocator.reserveUnused(ResourceAllocator.j
ava:376)
at
weblogic.common.internal.ResourceAllocator.trigger(ResourceAllocator.java:11
03)
at
weblogic.time.common.internal.ScheduledTrigger.executeLocally(ScheduledTrigg
er.java:238)
at
weblogic.time.common.internal.ScheduledTrigger.execute(ScheduledTrigger.java
:229)
atweblogic.time.server.ScheduledTrigger.execute(ScheduledTrigger.java:65)
at
weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
>
<Apr 5, 2002 1:33:10 PM CST> <Info> <JDBC Pool oraclePoolSun3500XAThin><This
connection will now be refreshed.> -
Problem in getting Time info with webLogic using Oracle Thin Driver
We have a servlet to store/retrieve date/time data from an Oracle 9i db using use the Oracle thin driver. Everyting is ok when run on JSDK2.1 servlet container or Tomcat. But when run under WebLogic 8.1, we have problem with time portion info, it is lost. After debuging, we found under WebLogic, the returned object type is a java.sql.Date which by definition has no time info, while in other servlet containers, it is a java.sql.Timestamp. Storing date/time data in a Date column is ok under WebLogic because we see the time portion data in the db table. We did not set anything about database/jdbc in WebLogic.
It would be greatly appreciated if someone can explain what effect WebLogic has on a servlet that has its own jdbc connection or how WebLogic could change data type from a jdbc sql statement.That's a function of the JDBC driver, not the J2EE app server.
Sounds like maybe you're using the WebLogic 8.1 driver when you deploy with WL instead of the Oracle driver. You certainly can deploy with the Oracle driver. Go into the WL config manager and set it up to use the ojdbc14.jar instead.
% -
BLOB insert behavior with thin driver using standard JDBC2.0 and ORACLE-JDBC2.0API
We have a problem with a BLOB insert to an oracle 8.1.7 DB using Oracle 8.1.7 JDBC thin driver.We get socket read/write error after inserting 32k of data using the standard JDBC2.0 API but using the Oracle JDBC2.0API (using OracleResultSet) it goes fine. We have a requirement to use the standard JDBC2.0 so that our code works with multiple database vendors. Is there another way to get in the blob data with standard JDBC API & using thin driver...?
thanks,
Madhu
Here is my sample test program that does both standard & oracle specific JDBC Blob test insert.
import java.sql.*;
import java.io.*;
import oracle.sql.BLOB;
import oracle.jdbc.driver.OracleResultSet;
public class testBLOB {
//trying to insert a huge file to a BLOB
static String fileName = "/kernel/genunix";
public static void main(String[] args) {
String driverName = "oracle.jdbc.driver.OracleDriver";
String dbURL = "jdbc:oracle:thin:@localhost:1521:test"; //thin driver
String user = "BlobTest";
String passwd = "BlobTest";
Connection con=null;
try {
Class.forName(driverName);
con=DriverManager.getConnection(dbURL, user,passwd);
catch (Exception e) {
e.printStackTrace();
close(con);
int i = 0;
while (i < args.length) {
if (args.equals("-f"))
fileName = args[++i];
i++;
System.out.println("The file being Stored is: "+fileName);
createTable(con);
insertUsingOracleAPI(con);
insertUsingJDBC20API(con);
//readDB(con);
static String getFileName() {
return fileName;
public static void close(Connection con) {
try {
if (con != null) {
con.close();
catch (Exception e) {
System.exit(-1);
public static void createTable(Connection con) {
Statement stmt ;
try {
stmt = con.createStatement();
stmt.execute("DROP TABLE basic_blob_table");
stmt.close();
catch (SQLException sqlEx) {
System.out.println("Dropped the Table");
try {
stmt = con.createStatement();
stmt.execute("CREATE TABLE basic_blob_table ( x varchar2(30), b blob)");
stmt.close();
catch (SQLException sqlEx) {
sqlEx.printStackTrace();
close(con);
System.out.println("Created the Table");
public static void insertUsingOracleAPI(Connection con) {
OutputStream os = null;
Statement stmt = null;
ResultSet rs = null;
FileInputStream is = null;
try {
con.setAutoCommit(false);
stmt = con.createStatement();
stmt.execute("INSERT INTO basic_blob_table VALUES( 'OracleAPI', empty_blob())");
System.out.println("Inserted the dummy Row");
rs = stmt.executeQuery("Select * from basic_blob_table where x='OracleAPI'");
if (rs != null && rs.next()) {
BLOB blob = ((OracleResultSet)rs).getBLOB(2);
File file = new File(getFileName());
is = new FileInputStream(file);
os = blob.getBinaryOutputStream();
byte[] chunk = new byte[1024];
int length = -1;
while((length = is.read(chunk)) != -1)
os.write(chunk, 0,length);
System.out.println("Inserted the File " + getFileName() );
catch (Exception e) {
e.printStackTrace();
finally {
try {
if (os != null) {
os.flush();
os.close();
if (is != null)
is.close();
stmt.close();
con.commit();
con.setAutoCommit(true);
catch (Exception e) {}
public static void insertUsingJDBC20API(Connection con) {
PreparedStatement stmt = null;
FileInputStream is = null;
try {
stmt = con.prepareStatement("INSERT INTO basic_blob_table VALUES(?,?)");
File file = new File(getFileName());
is = new FileInputStream(file);
stmt.setString(1,"JDBC20API");
stmt.setBinaryStream(2,is,(int)file.length());
stmt.executeUpdate();
catch (Exception e) {
e.printStackTrace();
finally {
try {
if (is != null)
is.close();
stmt.close();
catch (Exception e) {}
nullThanks for the response.
I understand what you are saying...
that readers don't block writers in Oracle (the same is true in SQL Server 2000).
However, I don't see how my test case is working correctly with Oracle (the exact same code acting as I'm thinking it should with SQL Server, but I still think it is acting incorrectly with Oracle).
I have transaction A do this:
update <table> set <column2>=<value> where <column1>='1'
then I use Thread.sleep() to make that program hang around for a few minutes.
Meanwhile I sneak off and start another program which begins transaction B. I have transaction B do this:
select * from <table> where <column1>='1'
and the read works immediately (no blocking... just as you have said) however, transaction A is still sleeping, it has not called commit() or rollback() yet.
So what if transaction A were to call rollback(), the value read by transaction B would be incorrect wouldn't it ?
Both A and B use setAutoCommit(false) to start their transactions, and then call setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED).
Isn't that supposed to guarantee that a reader can only read what is committed ?
And if a row is in "flux"... in the process of having one or more values changed, then the database cannot say what the value will be ?
I can almost see what you are saying.
In letting the reader have what it wants without making it wait, I suppose it could be said that Oracle is holding true to the "only let committed data be read"
So if that's it, then what if I want the blocking ?
I want an entire row to be locked until whoever it in the middle of updating, adding, or removing it has finished.
Do you know if that can be done with Oracle ? And how ?
Thanks again for helping me. -
Bug in Oracle JDBC thin driver (parameter order)
[ I'd preferably send this to some Oracle support email but I
can't find any on both www.oracle.com and www.technet.com. ]
The following program illustrates bug I found in JDBC Oracle thin
driver.
* Synopsis:
The parameters of prepared statement (I tested SELECT's and
UPDATE's) are bound in the reverse order.
If one do:
PreparedStatement p = connection.prepareStatement(
"SELECT field FROM table WHERE first = ? and second = ?");
and then bind parameter 1 to "a" and parameter to "b":
p.setString(1, "a");
p.setString(2, "b");
then executing p yields the same results as executing
SELECT field FROM table WHERE first = "b" and second = "a"
although it should be equivalent to
SELECT field FROM table WHERE first = "a" and second = "b"
The bug is present only in "thin" Oracle JDBC driver. Changing
driver to "oci8" solves the problem.
* Version and platform info:
I detected the bug using Oracle 8.0.5 server for Linux.
According to $ORACLE_HOME/jdbc/README.doc that is
Oracle JDBC Drivers release 8.0.5.0.0 (Production Release)
* The program below:
The program below illustrates the bug by creating dummy two
column table, inserting the row into it and then selecting
the contents using prepared statement. Those operations
are performed on both good (oci8) and bad (thin) connections,
the results can be compared.
You may need to change SID, listener port and account data
in getConnecton calls.
Sample program output:
$ javac ShowBug.java; java ShowBug
Output for both connections should be the same
--------------- thin Driver ---------------
[ Non parametrized query: ]
aaa
[ The same - parametrized (should give one row): ]
[ The same - with buggy reversed order (should give no answers):
aaa
--------------- oci8 driver ---------------
[ Non parametrized query: ]
aaa
[ The same - parametrized (should give one row): ]
aaa
[ The same - with buggy reversed order (should give no answers):
--------------- The end ---------------
* The program itself
import java.sql.*;
class ShowBug
public static void main (String args [])
throws SQLException
// Load the Oracle JDBC driver
DriverManager.registerDriver(new
oracle.jdbc.driver.OracleDriver());
System.out.println("Output for both connections should be the
same");
Connection buggyConnection
= DriverManager.getConnection
("jdbc:oracle:thin:@localhost:1521:ORACLE",
"scott", "tiger");
process("thin Driver", buggyConnection);
Connection goodConnection
= DriverManager.getConnection ("jdbc:oracle:oci8:",
"scott", "tiger");
process("oci8 driver", goodConnection);
System.out.println("--------------- The end ---------------");
public static void process(String title, Connection conn)
throws SQLException
System.out.println("--------------- " + title + "
Statement stmt = conn.createStatement ();
stmt.execute(
"CREATE TABLE bug (id VARCHAR(10), val VARCHAR(10))");
stmt.executeUpdate(
"INSERT INTO bug VALUES('aaa', 'bbb')");
System.out.println("[ Non parametrized query: ]");
ResultSet rset = stmt.executeQuery(
"select id from bug where id = 'aaa' and val = 'bbb'");
while (rset.next ())
System.out.println (rset.getString (1));
System.out.println("[ The same - parametrized (should give one
row): ]");
PreparedStatement prep = conn.prepareStatement(
"select id from bug where id = ? and val = ?");
prep.setString(1, "aaa");
prep.setString(2, "bbb");
rset = prep.executeQuery();
while (rset.next ())
System.out.println (rset.getString (1));
System.out.println("[ The same - with buggy reversed order
(should give no answers): ]");
prep = conn.prepareStatement(
"select id from bug where id = ? and val = ?");
prep.setString(1, "bbb");
prep.setString(2, "aaa");
rset = prep.executeQuery();
while (rset.next ())
System.out.println (rset.getString (1));
stmt.execute("DROP TABLE bug");
nullHorea
In the ejb-jar.xml, in the method a cursor is closed, set <trans-attribute>
to "Never".
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name></ejb-name>
<method-name></method-name>
</method>
<trans-attribute>Never</trans-attribute>
</container-transaction>
</assembly-descriptor>
Deepak
Horea Raducan wrote:
Is there a known bug in Oracle JDBC thin driver version 8.1.6 that would
prevent it from closing the open cursors ?
Thank you,
Horea -
I am using CLOBS with the Oracle thin driver and am experiencing horrible performance. We need datavalues more than a VARCHAR2 and have used CLOB but the method Oracle uses to get the data in and out is super slow.
MS SQL Server JDBC with text is awesome and fast. But Oracle is slow and very cumbersome.
HelpWe are using 9.0.2.
So what you are saying is although the column is CLOB
in Oracle 10 g we can use a normal result set
rset.getString( 1 ) no special oracle stuff just the
e Oracle thin driver for 10g?
Also this will retrieve a String greater than 4000
bytes?Exactly. Not only you can retieve a clob as string, you can also insert clob
as a string too. Here is the code I referred in last post in case you do not
have access to oracle ten network:
* @author Savitha
* @version 1.0
* Development Environment : Oracle JDeveloper 10g
* Name of the Application : ClobManipulationIn10g.java
* Creation/Modification History :
* Savitha 17-Mar-2004 Created.
package oracle.otnsamples.jdbc;
// Java SQL classes
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
// Oracle JDBC driver class
import oracle.jdbc.OracleDriver;
// Java IO classes
import java.io.IOException;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
//Java Util classes
import java.util.Properties;
* This class demonstrates the Oracle JDBC 10g enhanced features for inserting
* and retrieving CLOB data from the database. Using the new features, large
* data of more than 32765 bytes can be inserted into the database using the
* existing PreparedStatement.setString() and PreparedStatement.getString()
* methods.
public class ClobManipulationIn10g {
/* Database Connection object */
private Connection conn = null;
/* Variables to hold database details */
private String url = null;
private String user = null;
private String password = null;
// Create a property object to hold the username, password and
// the new property SetBigStringTryClob.
private Properties props = new Properties();
/* String to hold file name */
private String fileName = null;
* Default Constructor to instantiate and get a handle to class methods
* and variables.
public ClobManipulationIn10g(String fileName) {
this.fileName = fileName;
* Main runnable class.
public static void main(String[] args) throws SQLException {
// Instantiate the main class.
ClobManipulationIn10g clobManipulationIn10g =
new ClobManipulationIn10g(args[0]);
// Load the Oracle JDBC driver class.
DriverManager.registerDriver(new OracleDriver());
// Load the database details into the variables.
String dbUrl = "jdbc:oracle:thin:@<database host machine>:<port>:<SID>";
clobManipulationIn10g.url = dbUrl;
// Replace the username where the table 'clob_tab' was created.
clobManipulationIn10g.user = "scott";
// Replace the password of the username.
clobManipulationIn10g.password = "tiger";
// Populate the property object to hold the username, password and
// the new property 'SetBigStringTryClob' which is set to true. Setting
// this property allows inserting of large data using the existing
// setString() method, to a CLOB column in the database.
clobManipulationIn10g.props.put("user", clobManipulationIn10g.user );
clobManipulationIn10g.props.put("password", clobManipulationIn10g.password);
clobManipulationIn10g.props.put("SetBigStringTryClob", "true");
// Check if the table 'CLOB_TAB' is present in the database.
clobManipulationIn10g.checkTables();
// Call the methods to insert and select CLOB from the database.
clobManipulationIn10g.insertClob();
clobManipulationIn10g.selectClob();
* This method will insert the data into a CLOB column in the database.
* Oracle JDBC 10g has enhanced the existing PreparedStatement.setString()
* method for setting the data more than 32765 bytes. So, using setString(),
* it is now easy to insert CLOB data into the database directly.
private void insertClob() throws SQLException {
// Create a PreparedStatement object.
PreparedStatement pstmt = null;
try {
// Create the database connection, if it is closed.
if ((conn==null)||conn.isClosed()){
// Connect to the database.
conn = DriverManager.getConnection( this.url, this.props );
// Create SQL query to insert data into the CLOB column in the database.
String sql = "INSERT INTO clob_tab VALUES(?)";
// Read a big file(larger than 32765 bytes)
String str = this.readFile();
// Create the OraclePreparedStatement object
pstmt = conn.prepareStatement(sql);
// Use the same setString() method which is enhanced to insert
// the CLOB data. The string data is automatically transformed into a
// clob and inserted into the database column. Make sure that the
// Connection property - 'SetBigStringTryClob' is set to true for
// the insert to happen.
pstmt.setString(1,str);
// Execute the PreparedStatement
pstmt.executeUpdate();
} catch (SQLException sqlex) {
// Catch Exceptions and display messages accordingly.
System.out.println("SQLException while connecting and inserting into " +
"the database table: " + sqlex.toString());
} catch (Exception ex) {
System.out.println("Exception while connecting and inserting into the" +
" database table: " + ex.toString());
} finally {
// Close the Statement and the connection objects.
if (pstmt!=null) pstmt.close();
if (conn!=null) conn.close();
* This method reads the CLOB data from the database by using getString()
* method.
private void selectClob() throws SQLException {
// Create a PreparedStatement object
PreparedStatement pstmt = null;
// Create a ResultSet to hold the records retrieved.
ResultSet rset = null;
try {
// Create the database connection, if it is closed.
if ((conn==null)||conn.isClosed()){
// Connect to the database.
conn = DriverManager.getConnection( this.url, this.props );
// Create SQL query statement to retrieve records having CLOB data from
// the database.
String sqlCall = "SELECT clob_col FROM clob_tab";
pstmt= conn.prepareStatement(sqlCall);
// Execute the PrepareStatement
rset = pstmt.executeQuery();
String clobVal = null;
// Get the CLOB value from the resultset
while (rset.next()) {
clobVal = rset.getString(1);
System.out.println("CLOB length: "+clobVal.length());
} catch (SQLException sqlex) {
// Catch Exceptions and display messages accordingly.
System.out.println("SQLException while connecting and querying the " +
"database table: " + sqlex.toString());
} catch (Exception ex) {
System.out.println("Exception while connecting and querying the " +
"database table: " + ex.toString());
} finally {
// Close the resultset, statement and the connection objects.
if (rset !=null) rset.close();
if (pstmt!=null) pstmt.close();
if (conn!=null) conn.close();
* Method to check if the table ('CLOB_TAB') exists in the database; if not
* then it is created.
* Table Name: CLOB_TAB
* Column Name Type
* col_col CLOB
private void checkTables() {
Statement stmt = null;
ResultSet rset = null;
try {
// Create the database connection, if it is closed.
if ((conn==null)||conn.isClosed()){
// Connect to the database.
conn = DriverManager.getConnection( this.url, this.props );
// Create Statement object
stmt = conn.createStatement();
// Check if the table is present
rset = stmt.executeQuery(" SELECT table_name FROM user_tables "+
" WHERE table_name = 'CLOB_TAB' ");
// If the table is not present, then create the table.
if (!rset.next()) {
// Table does not exist, create it
stmt.executeUpdate(" CREATE TABLE clob_tab(clob_col CLOB)");
} catch (SQLException sqlEx) {
System.out.println("Could not create table clob_tab : "
+sqlEx.toString());
} finally {
try {
if( rset != null ) rset.close();
if( stmt != null ) stmt.close();
if (conn!=null) conn.close();
} catch(SQLException ex) {
System.out.println("Could not close objects in checkTables method : "
+ex.toString());
* This method reads the specified text file and, returns the content
* as a string.
private String readFile()
throws FileNotFoundException, IOException{
// Read the file whose content has to be passed as String
BufferedReader br = new BufferedReader(new FileReader(fileName));
String nextLine = "";
StringBuffer sb = new StringBuffer();
while ((nextLine = br.readLine()) != null) {
sb.append(nextLine);
// Convert the content into to a string
String clobData = sb.toString();
// Return the data.
return clobData;
} -
We are trying to use the Oracle supplied JDBC thin driver directly from within a jar file we add for our application.
The classes in the jar file directly connect to an oracle database via the thin driver.
The problem we've encountered is that if the JDBC Connection object is held in memory, after some time, the connection times out for no reason.
Is there some restriction with weblogic in connecting directly to database from a class file and then caching the connection reference? It almost seems as if weblogic is severing the connections.
thank you,
BJStefan,
You are right, although I would recommend just having the
TestConnectionOnReserve= true and the testTableName set. Refresh Minutes
becomes kind of redundent when you set these values.
TestConnsOnReserve allows the server to verify if a connection that the
client/application has requested is good , otherwise it recreates this
connection and gives it to the client/application.
hth
sree
"Stefan" <[email protected]> wrote in message
news:[email protected]...
Hi Sree,
If instead a WL connection pool would be used this issue could be solved
using
"Refresh Period" and TestTableName right? In this case the connection would
be
alive as long as WL server is up. As a bonus we would have an automatic
reconnection
after an Oracle server reboot?
thanks, stefan
"Sree Bodapati" <[email protected]> wrote:
Hi BJ,
When you get connection directly using the Oracle thin driver, this is
for
sure your database timing out the connection when no activity is detected
for sometime. You should consult with your DBA to ensure this timeout
is set
to a higher value at the server or ensure you dont hold on to theconnection
for long durations or ensure you handle this situation by triggering
a
generic oracle process so that you periodically keep the connection busy
to
ensure that the database does not close it.
This shouldnt be anything to do with WebLogic as you dont seem to be
using
WebLogic connection pool.
hth
sree
"BJ Choi" <bongjin.choi@neoforma> wrote in message
news:[email protected]...
We are trying to use the Oracle supplied JDBC thin driver directly from
within a jar file we add for our application.
The classes in the jar file directly connect to an oracle database via
the
thin driver.
The problem we've encountered is that if the JDBC Connection object is
held
in memory, after some time, the connection times out for no reason.
Is there some restriction with weblogic in connecting directly to database
from a class file and then caching the connection reference? It almost
seems
as if weblogic is severing the connections.
thank you,
BJ -
Multiple ResultSets with Oracle Thin Driver.
Hi,
I am using Oracle Thin Driver to Connect to the Oracle Database (8.1.7). I wanted to take advantage
of the multiple Resultsets Scenario for fetching Data from the DB. Please have a look at the code
fragment below.
String sql = "select * from TAB1; select * from TAB2";
Connection conn = getConnection();
PreparedStatement stmnt = conn.prepareStatement(sql);
stmnt.execute();
However , I am getting the following Error.
java.sql.SQLException: ORA-00911: invalid character
Could anyone give me the possible reason/corrected syntax for the SQL.
Thanks for any help in advance.It's unclear what your problem is...
However...
Oracle will only execute one SQL statement at a time in a Statement or PreparedStatement; therefore these can only return a single ResultSet.
However, an Oracle stored procedure can be written to return multiple results; it can therefore be run from a CallableStatement and getMoreResults() is then used to get the additional ResultSet data.
An example of doing this is here:
http://edocs.beasys.com/wls/docs81/jdbc_drivers/oracle.html
scroll towards the bottom and look for Listing 5-3 -
Deadlock in 9.2.0.3 thin driver
I'm using 9.2.0.3 Thin for JDK 1.4 to connect to a 9.2.0.1 database (since the 9.2.0.1 driver gives me really hard time with some "unexpected packet" errors). However, with the newer driver I stumbled upon the following deadlock (it was quite incidental, probably can't reproduce it...).
Can anyone give info whether TechNet forums get reviewed by Oracle staff, and is there a way to officialy report customer-found bugs to Oracle ? Thanks in advance !
Deadlock follows:
Found one Java-level deadlock:
=============================
"Thread-31":
waiting to lock monitor 0x8fecdc (object 0x54044f0, a oracle.jdbc.driver.OracleConnection),
which is held by "Console Reader Thread"
"Console Reader Thread":
waiting to lock monitor 0x8fec9c (object 0x5404fe8, a oracle.jdbc.ttc7.TTC7Protocol),
which is held by "Thread-31"
Java stack information for the threads listed above:
===================================================
"Thread-31":
at oracle.jdbc.driver.OracleConnection.needLine(OracleConnection.java:2389)
- waiting to lock <054044F0> (a oracle.jdbc.driver.OracleConnection)
at oracle.jdbc.ttc7.TTC7Protocol.lobRead(TTC7Protocol.java:2407)
- locked <05404FE8> (a oracle.jdbc.ttc7.TTC7Protocol)
at oracle.sql.LobDBAccessImpl.getBytes(LobDBAccessImpl.java:242)
- locked <05419570> (a oracle.sql.LobDBAccessImpl)
at oracle.sql.BLOB.getBytes(BLOB.java:340)
at oracle.jdbc.driver.OracleBlobInputStream.needBytes(OracleBlobInputStream.java:232)
at oracle.jdbc.driver.OracleBufferedStream.read(OracleBufferedStream.java:158)
- locked <059658F0> (a oracle.jdbc.driver.OracleBlobInputStream)
at oracle.jdbc.driver.OracleBufferedStream.read(OracleBufferedStream.java:131)
at com.prosyst.mprm.util.jdbc.DatabaseUtils.readBytes(DatabaseUtils.java:186)
at com.prosyst.mprm.backend.impl.database.certificate.CertificateDBService.getCertificate(Ce
rtificateDBService.java:915)
at com.prosyst.mprm.backend.impl.certificate.CertificateManagerBEImpl.getCertificate(Certifi
cateManagerBEImpl.java:155)
at com.prosyst.mprm.admin.impl.certificate.CertificateManagerImpl.getCertificate(Certificate
ManagerImpl.java:42)
at com.prosyst.mprm.backend.impl.bundles.binventory.BundleInventoryService.getPermissions(Bu
ndleInventoryService.java:884)
at com.prosyst.mprm.backend.impl.bundles.binventory.BundleInventoryService.setBEFields(Bundl
eInventoryService.java:2366)
at com.prosyst.mprm.backend.impl.bundles.binventory.BundleInventoryService.addBundleEdition(
BundleInventoryService.java:1238)
at com.prosyst.mprm.backend.impl.bundles.binventory.BundleInventoryService.addEdition(Bundle
InventoryService.java:1140)
at com.prosyst.mprm.backend.impl.bundles.BundlesActivator.addBackendBundles(BundlesActivator
.java:263)
at com.prosyst.mprm.backend.impl.bundles.BundlesActivator.registerInventory(BundlesActivator
.java:174)
at com.prosyst.mprm.backend.impl.bundles.BundlesActivator.setConfiguratorManager(BundlesActi
vator.java:302)
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:324)
at com.prosyst.mprm.util.tracker.SingleServiceTracker.setRequestor(SingleServiceTracker.java
:149)
at com.prosyst.mprm.util.tracker.SingleServiceTracker.setService(SingleServiceTracker.java:1
14)
- locked <053D1220> (a com.prosyst.mprm.util.tracker.SingleServiceTracker)
at com.prosyst.mprm.util.tracker.SingleServiceTracker.serviceChanged(SingleServiceTracker.ja
va:92)
at com.prosyst.mbs.impl.framework.EventsManager.serviceChanged(EventsManager.java:443)
at com.prosyst.mbs.impl.framework.BundleContextImpl.registerService(BundleContextImpl.java:2
25)
at com.prosyst.mbs.impl.framework.BundleContextImpl.registerService(BundleContextImpl.java:2
42)
at com.prosyst.mprm.admin.impl.system.local.Activator.initRefs(Activator.java:83)
at com.prosyst.mprm.admin.impl.system.local.Activator.serviceChanged(Activator.java:52)
- locked <052425A0> (a com.prosyst.mprm.admin.impl.system.local.Activator)
at com.prosyst.mbs.impl.framework.EventsManager.serviceChanged(EventsManager.java:443)
at com.prosyst.mbs.impl.framework.BundleContextImpl.registerService(BundleContextImpl.java:2
25)
at com.prosyst.mbs.impl.framework.BundleContextImpl.registerService(BundleContextImpl.java:2
42)
at com.prosyst.mprm.backend.impl.system.ConfigurationChangeManager.start(ConfigurationChange
Manager.java:80)
- locked <05241FA8> (a com.prosyst.mprm.backend.impl.system.ConfigurationChangeManager)
at com.prosyst.mprm.backend.impl.system.ConfigurationManager.notifyObservers(ConfigurationMa
nager.java:324)
at com.prosyst.mprm.backend.impl.system.ConfigurationManager.access$900(ConfigurationManager
.java:40)
at com.prosyst.mprm.backend.impl.system.ConfigurationManager$CT.run(ConfigurationManager.jav
a:1098)
- locked <052205C0> (a com.prosyst.mprm.backend.impl.system.ConfigurationManager)
at java.lang.Thread.run(Thread.java:536)
"Console Reader Thread":
at oracle.jdbc.ttc7.TTC7Protocol.close(TTC7Protocol.java:667)
- waiting to lock <05404FE8> (a oracle.jdbc.ttc7.TTC7Protocol)
at oracle.jdbc.driver.OracleStatement.close(OracleStatement.java:700)
- locked <0596A388> (a oracle.jdbc.driver.OracleStatement)
- locked <054044F0> (a oracle.jdbc.driver.OracleConnection)
at com.prosyst.mprm.backend.impl.dbconnection.jdbc.JDBCStatement.close(JDBCStatement.java:10
5)
at com.prosyst.mprm.backend.impl.dbconnection.jdbc.Validator.isTableFormat(Validator.java:44
5)
at com.prosyst.mprm.backend.impl.dbconnection.jdbc.Validator.parseNext(Validator.java:354)
at com.prosyst.mprm.backend.impl.dbconnection.jdbc.TableCreator.validateTables(TableCreator.
java:212)
at com.prosyst.mprm.backend.impl.dbconnection.jdbc.ConnectionManagerImpl.validateTables(Conn
ectionManagerImpl.java:864)
at com.prosyst.mprm.backend.impl.dbconnection.jdbc.ConnectionManagerImpl.validateTables(Conn
ectionManagerImpl.java:854)
at com.prosyst.mprm.backend.impl.event.scheduler.EventManager.setConnectionManager(EventMana
ger.java:155)
at com.prosyst.mprm.backend.impl.dbconnection.jdbc.ConnectionManagerImpl.addDBConnectionUser
(ConnectionManagerImpl.java:280)
at com.prosyst.mprm.backend.impl.dbconnection.jdbc.DBServerConnectorImpl.setConnectionManage
r(DBServerConnectorImpl.java:197)
at com.prosyst.mprm.backend.impl.dbconnection.jdbc.DBConnectorActivator.serviceChanged(DBCon
nectorActivator.java:77)
at com.prosyst.mbs.impl.framework.EventsManager.serviceChanged(EventsManager.java:443)
at com.prosyst.mbs.impl.framework.BundleContextImpl.registerService(BundleContextImpl.java:2
25)
at com.prosyst.mbs.impl.framework.BundleContextImpl.registerService(BundleContextImpl.java:2
42)
at com.prosyst.mprm.backend.impl.event.scheduler.EventManager.registerAsDBConnectionUser(Eve
ntManager.java:200)
at com.prosyst.mprm.backend.impl.event.scheduler.EventManager.setConfiguration(EventManager.
java:146)
at com.prosyst.mprm.backend.impl.system.DBServicesConfigurator$ConfigureDBService.run(DBServ
icesConfigurator.java:290)
at com.prosyst.mprm.backend.impl.system.DBServicesConfigurator$ConfigureDBService.<init>(DBS
ervicesConfigurator.java:282)
at com.prosyst.mprm.backend.impl.system.DBServicesConfigurator.configureDBService(DBServices
Configurator.java:247)
at com.prosyst.mprm.backend.impl.system.DBServicesConfigurator.serviceChanged(DBServicesConf
igurator.java:142)
at com.prosyst.mbs.impl.framework.EventsManager.serviceChanged(EventsManager.java:443)
at com.prosyst.mbs.impl.framework.BundleContextImpl.registerService(BundleContextImpl.java:2
25)
at com.prosyst.mbs.impl.framework.BundleContextImpl.registerService(BundleContextImpl.java:2
42)
at com.prosyst.mprm.backend.impl.event.scheduler.EventManager.start(EventManager.java:113)
at com.prosyst.mprm.backend.impl.event.scheduler.EventSchedulerImpl.start(EventSchedulerImpl
.java:53)
- locked <0596A730> (a com.prosyst.mprm.backend.impl.event.scheduler.EventSchedulerImpl)
at com.prosyst.mbs.impl.framework.BundleImpl.startIt(BundleImpl.java:1377)
at com.prosyst.mbs.impl.framework.BundleImpl.simpleStart(BundleImpl.java:467)
at com.prosyst.mbs.impl.framework.BundleImpl.start0(BundleImpl.java:459)
at com.prosyst.mbs.impl.framework.BundleImpl.initialResolve(BundleImpl.java:222)
at com.prosyst.mbs.impl.framework.BundleImpl.update0(BundleImpl.java:823)
at com.prosyst.mbs.impl.framework.BundleImpl.update(BundleImpl.java:697)
at com.prosyst.mbs.impl.framework.BundleImpl.update0(BundleImpl.java:724)
at com.prosyst.mbs.impl.framework.BundleImpl.update(BundleImpl.java:697)
at com.prosyst.mbs.impl.framework.BundleImpl.update(BundleImpl.java:638)
at com.prosyst.util.impl.parser.DefaultFrameworkPlugable.updateBundle(DefaultFrameworkPlugab
le.java:814)
at com.prosyst.util.impl.parser.DefaultFrameworkPlugable.update(DefaultFrameworkPlugable.jav
a:796)
at com.prosyst.util.impl.parser.DefaultFrameworkPlugable.executeCommand(DefaultFrameworkPlug
able.java:382)
at com.prosyst.util.impl.parser.ParserServiceImpl.parseCommand(ParserServiceImpl.java:303)
at com.prosyst.util.impl.console.ConsoleService.run(ConsoleService.java:92)
- locked <05173370> (a java.io.BufferedInputStream)
Found 1 deadlock.These forums aren't monitored by Oracle support. Bug reports and support requests are made at metalink.oracle.com.
Justin -
GUYS!! Is there any way to write BLOB's 4K using Oracle thin driver
I've been trying for 3 days to do that but nothing worked ...
Not
setBinaryStream(x, new ByteArrayInputStream(anArrayWith10KBytes), anArrayWith10KBytes);
nor setBytes(x, myArray), or setObject(x, myArray).
Is there any way to store Blobs to Oracle 8.1.6 using the thin driver ????????????
Please help ... cause I really need it !!!
Best regards,
StefigHi Stefig
Following code help you to store the files >4k in BLOB column in Oracle database
test is a table in which TEST is BLOB column
String url = "jdbc:oracle:thin:@.....";
String user = "user name";
String password = "password";
Connection conn = null;
PreparedStatement aQuery = null;
ResultSet rs = null;
try
Class.forName("oracle.jdbc.driver.OracleDriver");
conn = DriverManager.getConnection(url,user,password);
conn.setAutoCommit(false);
Statement stmt = conn.createStatement();
stmt.execute("insert into test values (EMPTY_BLOB())");
rs = stmt.executeQuery("select TEST from test");
rs.next();
BLOB blob =((OracleResultSet)rs).getBLOB(1);
File f = new File(filename);
FileInputStream io = new FileInputStream(f);
OutputStream os = blob.getBinaryOutputStream();
int size = io.available();
byte[] buffer = new byte[1024];
int length=0;
while((length=io.read(buffer)) != -1)
os.write(buffer,0,length);
io.close();
os.close();
stmt.execute("commit");
catch()
Good Luck
From
Sachin -
JDBC thin driver connection problems using cybersafe authentication
Hi
i am trying to use jdbc thin driver to connect to oracle 8.1.7 DB using ASO and cybersafe authentication.
Question:
Does the oracle jdbc thin driver in 8.1.7.0.0 support third-party authentication features supported by Oracle Advanced Security--such
as those provided by RADIUS, Kerberos, or SecurID
i am getting the following error.
Exception in thread "main" java.sql.SQLException: invalid arguments in call
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java)
at oracle.jdbc.dbaccess.DBError.check_error(DBError.java)
at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java)
at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java)
at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
va)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java)
at java.sql.DriverManager.getConnection(DriverManager.java:517)
at java.sql.DriverManager.getConnection(DriverManager.java:146)
at ASOJdbc.main(ASOJdbc.java:43)
Following is the program i am trying.
public class ASOJdbc {
public static void main(String args[]) throws SQLException {
String url = "jdbc:oracle:thin:@son1129:1521:sonias";
Connection con;
String query = "select EMPNO, ENAME from EMP";
Statement stmt;
// ASO Stuff
Properties props = new Properties();
try {
props.put("oracle.net.authentication_services", "CYBERSAFE");
props.put("oracle.net.authentication_gssapi_service", "oracle/[email protected]");
props.put("oracle.net.encryption_types_client", "DES");
props.put("oracle.net.encryption_types_server", "DES");
props.put("oracle.net.crypto_seed", "4fhXXXX");
} catch (Exception e) { e.printStackTrace();
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
// ASO
con = DriverManager.getConnection(url, props);
stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
stmt.close();
con.close();
jdk version: jdk 1.3.1
Oracle jdbc driver information, which i obtained as per Note 94091.1
=============
Database Product Name is Oracle
Database Product Version is Oracle8i Enterprise Edition Release 8.1.7.1.1 - Production With the Partitioning option
JServer Release 8.1.7.1.1 - Production
JDBC Driver Name is Oracle JDBC driver
JDBC Driver Version is 8.1.7.0.0
JDBC Driver Major Version is 8
JDBC Driver Minor Version is 11. What JDBC Thin client Driver are you using? (version) If you don't know, open up the Manifest.
2. the JDBC/OCI driver is a thick driver. It uses the oracle client, and therefore should read the tnsnames.ora
3. You have yet to give us any ORA- errors, which would help immensely in troubleshooting. -
Problems with jdbc thin driver (Euro Symbol)
Hello,
at the moment it is impossible for me to write or read euro characters to a database using a jdbc thin driver.
I am using
ojdbc14.jar (version 10.2.0.3.0) and orai18n.jar (also) together with JDK 1.4.2.
Charset of the database is WE8MSWIN1252. It does not work on ORACLE 9.2.0.1, 9.2.0.6 and 10.2.0.2.0 (others I have not tried). But the problem seams to be in thin client.
Inserting Eurosymbols using a PreparedStatement works quite well. Using a normal Statement does not work.
Also the values getting from a ResultSet are incorrect.
After several test I downloaded a patch 4659157 for ojdbc14.jar and 5470375 for orai18n.jar. After installing the patch the euro characters were returned, but:
In several selects of numeric fields (not all, seams to be random) my resultset returned the Euro character instead of 0 and so on.
Driver for 9.2 works quite well, but does not support 10g Release 2 (and contains also some funny bugs)
Following solutions are not suitable for us:
Changing the character set of the database (come on, this cannot be serious. I cannot change the character set of more than 100 databases)
Using the newest driver (ORACLE 11). We are still using JAVA 1.4.2 and cannot migrate our application at the moment.
Using an oci client. Not possible, no ORACLE client on clients...
Has anyone an idea how to deal with this?
Does anyone know when ORACLE is going to release a new jdbc driver for JAVA 1.4.2 (maybe 10.2.0.4.) ??
Regards,
ChristianJust installed PATCH 4659157 and 5470375 from metalink. The Euro problem seams to be corrected.
BUT:
Another problem occurred. Sometimes numeric values are returned wrong (0 from a numeric field comes as euro, 1 comes as Á (2 and 3 too).
This error seams to be random to me.
Our application is selecting a rowid from a table and after that fills several textfields in a frame by selecting the content in a way like this:
select [column1] from [table] where rowid=[rowid]
select [column2] from [table] where rowid=[rowid]
if I select the numeric column with select nr. 77 I get a wrong value. If I select it at nr. 10 I get the correct value.
The selects are done by a normal Statement object creating a ResultSet. The Value from the ResultSet is fetched by getObject() method.
I also tried to write a test program executing only the selects of the application, but it gives me correct results.
Also when selecting all the fields in one select I get a correct result.
Using a different charset than WE8MSWIN1252 seams to give correct results. Using the OCI driver returns correct results.
Using ojdbc14.jar and orai18n.jar Release 10.2.0.3. unpatched produces the same error (and does not return Euro symbols)
Using ojdbc14.jar and orai18n.jar Release 10.2.0.2. returns correct results (but wrong Euro)
Has anyone had the same problem yet?
Regards,
Christian -
Memory leak in weblogic 6.0 sp2 oracle 8.1.7 thin driver
Hi,
I have a simple client that opens a database connection, selects from
a table containing five rows of data (with four columns in each row)
and then closes all connections. On running this in a loop, I get the
following error after some time:
<Nov 28, 2001 5:57:40 PM GMT+06:00> <Error> <Adapter>
<OutOfMemoryError in
Adapter
java.lang.OutOfMemoryError
<<no stack trace available>>
>
<Nov 28, 2001 5:57:40 PM GMT+06:00> <Error> <Kernel> <ExecuteRequest
failed
java.lang.OutOfMemoryError
I am running with a heap size of 64 Mb. The java command that runs
the client is:
java -ms64m -mx64m -cp .:/opt/bea/wlserver6.0/lib/weblogic.jar
-Djava.naming.f
actory.initial=weblogic.jndi.WLInitialContextFactory
-Djava.naming.provider.url=
t3://garlic:7001 -verbose:gc Test
The following is the client code that opens the db connection and does
the select:
import java.util.*;
import java.sql.*;
import javax.naming.*;
import javax.sql.*;
public class Test {
private static final String strQuery = "SELECT * from tblPromotion";
public static void main(String argv[])
throws Exception
String ctxFactory = System.getProperty
("java.naming.factory.initial");
String providerUrl = System.getProperty
("java.naming.provider.url");
Properties jndiEnv = System.getProperties ();
System.out.println ("ctxFactory : " + ctxFactory);
System.out.println ("ProviderURL : " + providerUrl);
Context ctx = new InitialContext (jndiEnv);
for (int i=0; i <1000000; i++)
System.out.println("Running query for the "+i+" time");
Connection con = null;
Statement stmnt = null;
ResultSet rs = null;
try
DataSource ds = (DataSource) ctx.lookup
(System.getProperty("eaMDataStore", "jdbc/eaMarket"));
con = ds.getConnection ();
stmnt = con.createStatement();
rs = stmnt.executeQuery(strQuery);
while (rs.next ())
//System.out.print(".");
//System.out.println(".");
ds = null;
catch (java.sql.SQLException sqle)
System.out.println("SQL Exception : "+sqle.getMessage());
finally
try {
rs.close ();
rs = null;
//System.out.println("closed result set");
} catch (Exception e) {
System.out.println("Exception closing result set");
try {
stmnt.close ();
stmnt = null;
//System.out.println("closed statement");
} catch (Exception e) {
System.out.println("Exception closing result set");
try {
con.close();
con = null;
//System.out.println("closed connection");
} catch (Exception e) {
System.out.println("Exception closing connection");
I am using the Oracle 8.1.7 thin driver. Please let me know if this
memory leak is a known issue or if its something I am doing.
thanks,
rudyRepost in JDBC section ... very serious issue but it may be due to Oracle or
to WL ... does it happen if you test inside WL itself?
How many iterations does it take to blow? How long? Does changing to a
different driver (maybe Cloudscape) have the same result?
Peace,
Cameron Purdy
Tangosol Inc.
<< Tangosol Server: How Weblogic applications are customized >>
<< Download now from http://www.tangosol.com/download.jsp >>
"R.C." <[email protected]> wrote in message
news:[email protected]...
Hi,
I have a simple client that opens a database connection, selects from
a table containing five rows of data (with four columns in each row)
and then closes all connections. On running this in a loop, I get the
following error after some time:
<Nov 28, 2001 5:57:40 PM GMT+06:00> <Error> <Adapter>
<OutOfMemoryError in
Adapter
java.lang.OutOfMemoryError
<<no stack trace available>>
>
<Nov 28, 2001 5:57:40 PM GMT+06:00> <Error> <Kernel> <ExecuteRequest
failed
java.lang.OutOfMemoryError
I am running with a heap size of 64 Mb. The java command that runs
the client is:
java -ms64m -mx64m -cp .:/opt/bea/wlserver6.0/lib/weblogic.jar
-Djava.naming.f
actory.initial=weblogic.jndi.WLInitialContextFactory
-Djava.naming.provider.url=
t3://garlic:7001 -verbose:gc Test
The following is the client code that opens the db connection and does
the select:
import java.util.*;
import java.sql.*;
import javax.naming.*;
import javax.sql.*;
public class Test {
private static final String strQuery = "SELECT * from tblPromotion";
public static void main(String argv[])
throws Exception
String ctxFactory = System.getProperty
("java.naming.factory.initial");
String providerUrl = System.getProperty
("java.naming.provider.url");
Properties jndiEnv = System.getProperties ();
System.out.println ("ctxFactory : " + ctxFactory);
System.out.println ("ProviderURL : " + providerUrl);
Context ctx = new InitialContext (jndiEnv);
for (int i=0; i <1000000; i++)
System.out.println("Running query for the "+i+" time");
Connection con = null;
Statement stmnt = null;
ResultSet rs = null;
try
DataSource ds = (DataSource) ctx.lookup
(System.getProperty("eaMDataStore", "jdbc/eaMarket"));
con = ds.getConnection ();
stmnt = con.createStatement();
rs = stmnt.executeQuery(strQuery);
while (rs.next ())
//System.out.print(".");
//System.out.println(".");
ds = null;
catch (java.sql.SQLException sqle)
System.out.println("SQL Exception : "+sqle.getMessage());
finally
try {
rs.close ();
rs = null;
//System.out.println("closed result set");
} catch (Exception e) {
System.out.println("Exception closing result set");
try {
stmnt.close ();
stmnt = null;
//System.out.println("closed statement");
} catch (Exception e) {
System.out.println("Exception closing result set");
try {
con.close();
con = null;
//System.out.println("closed connection");
} catch (Exception e) {
System.out.println("Exception closing connection");
I am using the Oracle 8.1.7 thin driver. Please let me know if this
memory leak is a known issue or if its something I am doing.
thanks,
rudy -
JDBC Development team quote:
You can download the JDK 1.2 version of the 8.1.6 Thin driver from this site. It is 100% Pure Java and will run on Linux.
As you replied, I downloaded 8.1.6 Thin driver(classes12.zip) and nls_charset12.zip. Then, as instructed in readme file of 8.1.6, I modified CLASSPATH and add LD_LIBRARY_PATH.
I wrote a test program, and it compiled without errors. But when I excuted it, I got the error message below:
java.sql.SQLException: Io exception: Connection refused(DESCRIPTION=(TMP=)(VSNNU
M=135286784)(ERR=12505)(ERROR_STACK=(ERROR=(CODE=12505)(EMFI=4))))
Is there any other installation procedures I missed?
Below is the test program I used:
import java.sql.*;
import oracle.jdbc.driver.*;
public class Test
public static void main (String args [])throws SQLException
//DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
catch(ClassNotFoundException e){
System.out.println("Cannot load the Driver");
Connection conn = DriverManager.getConnection ("jdbc:oracle:thin:@host:port:sid","id", "password");
Statement stmt = conn.createStatement ();
ResultSet rset = stmt.executeQuery ("select sysdate from dual");
while (rset.next ())
System.out.println (rset.getString (1));
I'd appreciate if you give me some insight.
nullIt seems like the database listener is not setup properly. Please double check the listener is up and it's listening to the port you specified.
Thanks.
Maybe you are looking for
-
My laptop-acer-crashed. Before it crashed, my audio started to act up, It would work then silence. Then my tv shows which I purchased in itunes would freeze up then start, freeze again then played. It got to the point that I could not even play m
-
Hi Can we find out the PO line items which have been deleted by user ? We can find out the deleted POs by using EKPO-LOEKZ, but how to track which user have been deleted. Thanks in Advance MBKM
-
I am a Java developer new to Web Dynpro. I am receiving the error "http://[ipName]:[port]/webdynpro/dispatcher/local/Welcome/WelcomeApplication?SAPtestId=4 when trying to run the tutorial example (via "Deploy New Archive and Run" option), even thoug
-
Has anyone tried Lexar's ExpressCard solid state memory drives
I just saw a news article on Lexar's memory cards for the express card slot here is the link http://www.lexar.com/ssd/expresscard.html Has anyone used these yet? If so what are your impressions? Are they worth the price?
-
How many SAP BW consultants are there around the world? Is there any site that can give me such statistics information. I really would like to know how many SAP BW consultants are there in Saudi Arabia? Message was edited by: Omar