Problem in preparedstatements
hi all,i am using preparedstatements in my program.i use so many of them.i have so many functions and in each function i declare preparedstatements though the preparedstatements are common.but when i use these preparedstatements in the valuechanged() method of JList and actionperformed() method of JButton they work fine for 5 to 6 event changes after which they throw a SQL exception ORA 01000 saying
"maximum open cursors exceeded".
is this exception got anything to do with the number of preparedstatements.why does this exception occur and how to rectify it.thanks in advance.bye thiyagu.
As the error message says you have reached the limit of your available cursors. You can increase the number of cursors by modifying the initialization parameter OPEN_CURSORS in INITSID.ORA. After this you have to restart the database. The cursors that are counted for this are those explicit cursors that you opened and never closed, you have to use preparedStatement.close() in order to close the cursors.
Similar Messages
-
Memory problems with PreparedStatements
Driver: 9.0.1 JDBC Thin
I am having memory problems using "PreparedStatement" via jdbc.
After profiling our application, we found that a large number oracle.jdbc.ttc7.TTCItem objects were being created, but not released, even though we were "closing" the ResultSets of a prepared statements.
Tracing through the application, it appears that most of these TTCItem objects are created when the statement is executed (not when prepared), therefore I would have assumed that they would be released when the ResultSet is close, but this does not seem to be the case.
We tend to have a large number of PreparedStatement objects in use (over 100, most with closed ResultSets) and find that our application is using huge amounts of memory when compared to using the same code, but closing the PreparedStatement at the same time as closing the ResultSet.
Has anyone else found similar problems? If so, does anyone have a work-around or know if this is something that Oracle is looking at fixing?
Thanks
Bruce CrosgroveFrom your mail, it is not very clear:
a) whether your session is an HTTPSession or an application defined
session.
b) What is meant by saying: JSP/Servlet is growing.
However, some pointers:
a) Are there any timeouts associated with session.
b) Try to profile your code to see what is causing the memory leak.
c) Are there references to stale data in your application code.
Marilla Bax wrote:
hi,
we have some memory - problems with the WebLogic Application Server
4.5.1 on Sun Solaris
In our Customer Projects we are working with EJB's. for each customer
transaction we create a session to the weblogic application server.
now there are some urgent problems with the java process on the server.
for each session there were allocated 200 - 500 kb memory, within a day
the JSP process on our server is growing for each session and don't
reallocate the reserved memory for the old session. as a work around we
now restart the server every night.
How can we solve this problem ?? Is it a problem with the operating
system or the application server or the EJB's ?? Do you have problems
like this before ?
greetings from germany, -
Problems with PreparedStatement when select restrict are byte params
Hi,
i have a problem trying to select information when the "select" has a byte restrict.
The table in database is:
CREATE TABLE `positions` (
`PKID` int(10) unsigned NOT NULL auto_increment,
`POSCODE` varbinary(30) NOT NULL,
`ISWTURN` binary(1) NOT NULL,
`QTT_GAMES` int(10) unsigned NOT NULL default '1',
PRIMARY KEY (`PKID`),
UNIQUE KEY `UNIQ_POS` (`POSCODE`,`ISWTURN`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
And the test code to get the qtt_games is :
conn = DriverManager.getConnection (url,user,pwd);
byte bcode[] = poscode.getByteArrayCode();
// bcode is inserted ok in another preparedstatement...
String query = "SELECT qtt_games FROM positions "+
"WHERE poscode=? and iswturn=?";
PreparedStatement pstmt = conn.prepareStatement(query);
pstmt.setBytes (1,bcode);
pstmt.setByte (2,poscode.getIsWhiteTurn()); //it returns a byte
ResultSet rs = pstmt.executeQuery (query);
When pstmt.executeQuery is reached, it's thrown the exception:
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=? and iswturn=?' at line 1
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3170)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3099)
at com.mysql.jdbc.Statement.execute(Statement.java:695)
at app.server.bbdd.MYSQLBDManager.getGamesBasicInfo(MYSQLBDManager.java:942)
at app.server.bbdd.MYSQLBDManager.main(MYSQLBDManager.java:1068)
Can anybody tell me what's wrong?? I think the query is ok, but don't know what's happening with this...
Lots of thanks.Hi,
sorry, i know i've post this same message by error in "new to java" thread.... (i'm new in the forum... can i delete the wrong comment??)
The SQLState is 42000 (syntax error), but it doesn't give me much information because i had already searched in google why can be the cause of it, but there are only a few comments about problems like this, without a solution...
The column poscode in the table positions contains an array of bytes that codify a position in a chess board. I've to use this in the WHERE clause because i'm developing a chess game consulting project where there are millions of different positions and i've to get the games that have the same position in it's position history.
The code to insert the positions is:
query = "INSERT INTO positions VALUES "+
"(null,?,?,default) "+
"ON DUPLICATE KEY UPDATE qtt_games=qtt_games+1";
pstmt = conn.prepareStatement(query,Statement.RETURN_GENERATED_KEYS);
pstmt.setBytes(1,bcode);
pstmt.setByte(2,poscode.getIsWhiteTurn());
pstmt.executeUpdate();
which works ok and positions can be seen from mysql browser, but i can't select them using the PreparedStatement..
I have been searching a lot of information about this problem with no results... this is the why i posted this...
Any help will be useful, thanks. -
Problems with PreparedStatement and MySQL selecting bytes
Hi,
i have a problem trying to select information when the "select" has a byte restrict.
The table in database is:
CREATE TABLE `positions` (
`PKID` int(10) unsigned NOT NULL auto_increment,
`POSCODE` varbinary(30) NOT NULL,
`ISWTURN` binary(1) NOT NULL,
`QTT_GAMES` int(10) unsigned NOT NULL default '1',
PRIMARY KEY (`PKID`),
UNIQUE KEY `UNIQ_POS` (`POSCODE`,`ISWTURN`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
And the test code to get the qtt_games is :
conn = DriverManager.getConnection (url,user,pwd);
byte bcode[] = poscode.getByteArrayCode();
// bcode is inserted ok in another preparedstatement...
String query = "SELECT qtt_games FROM positions "+
"WHERE poscode=? and iswturn=?";
PreparedStatement pstmt = conn.prepareStatement(query);
pstmt.setBytes (1,bcode);
pstmt.setByte (2,poscode.getIsWhiteTurn()); //it returns a byte
ResultSet rs = pstmt.executeQuery (query);
When pstmt.executeQuery is reached, it's thrown the exception:
com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '=? and iswturn=?' at line 1
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3170)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3099)
at com.mysql.jdbc.Statement.execute(Statement.java:695)
at app.server.bbdd.MYSQLBDManager.getGamesBasicInfo(MYSQLBDManager.java:942)
at app.server.bbdd.MYSQLBDManager.main(MYSQLBDManager.java:1068)
Can anybody tell me what's wrong?? I think the query is ok, but don't know what's happening with this...
Lots of thanks.Don't cross-post, it's considered rude:
http://forum.java.sun.com/thread.jspa?threadID=5122604&messageID=9430056#9430056
http://forum.java.sun.com/thread.jspa?threadID=5122603&messageID=9430050#9430050
One to a customer, please.
% -
Problem with PreparedStatement
I'm using a statement which needs to determine if the value is in a group.
The statement will be
"select name,age,occupation from personnel where age in ?"
ps.setString(1, "(20,21,22)");
I've also tried
ps.setString(1, "('20','21','22')");
Neither brings back any values in the result set.
I can't figure out how to print what the preparedstatement looks like after setting the value.
I look in the table and there are records with age 20, 21, 22.. and age is set as a string.Try this:
query_B = "select tablename.blah_blah_blah"
+ " from tablename"
+ " where tablename.etc is null"
+ " and table.blah_term_code in (?, ?)"
+ " order by 1, 2, 4, 7";
String[] in_sem_dt = { "200307", "200308" };
pstmt_B = con.prepareStatement( query_B );
pstmt_B.setString( 1, in_sem_dt[0] );
pstmt_B.setString( 2, in_sem_dt[1] );
rs_B = pstmt_B.executeQuery();~Bill -
Problems with PreparedStatement
Please can somebody help, I am trying to run the following code,
stmt = con.prepareStatement("select * from PASSWORD where upper(USERNAME) = upper('?') and upper(PASSWORD) = upper('?')");
stmt.setString(1,inputUserid);
stmt.setString(2,inputPwd);
rs = stmt.executeQuery();
but I am getting the folowing error message
A SQL error has occurred in method validateUser [IBM][JDBC Driver] CLI0612E Invalid parameter number. SQLSTATE=S1093
Can anyone tell me what I have done wrong?No, not at all.
Just use them without the '' around the question marks
and outside db-functions like upper().
inside a where condition like
WHERE PASSWORD = ? AND USER = ?
you can use them without problems. -
Hi,
I am having some problem using PreparedStatement.executeUpdate() . I want to be able to prepare several queries before commiting and I wrote this just to test it
PreparedStatement stmt= aConnection.prepareStatement("update trans_test1 set field1='a text field' where field1='other text'");
stmt.executeUpdate();
aConnection.commit();
stmt.close();
aConnection.close();
when it hits this line "stmt.executeUpdate();" the program just stops running and after a while throws this error.
java.sql.SQLException: Lock wait timeout exceeded; try restarting transaction
I set the auto commit to false but I still can't get it working and do not understand the problem. Any one can help?
Thanks so much
AlejoHi,
I am having some problem using
PreparedStatement.executeUpdate() . I want to be able
to prepare several queries before commiting and I
wrote this just to test it
PreparedStatement stmt=
aConnection.prepareStatement("update trans_test1 set
field1='a text field' where field1='other text'");
stmt.executeUpdate();This is wrong in so many ways:
(1) Use the bind variables.
(2) Close resources properly in a finally block.
(3) You don't show where you set auto commit to false
(4) You don't show where you rollback in the event of a failure.
>
I set the auto commit to false but I still can't get
it working and do not understand the problem. Any one
can help?A snippet like this isn't enough. Post all the code.
Which database are you using, and which driver?
% -
JDBC Resultset Problem with ORACLE 10.1.0.2
Hello
I have a problem with Petstore GenericCatalogDAO. java. The problem is the behaviour of the resultset object when retrieving data from the database.Below are two synareos one that
works (when) hard coded and one that does not work when parameter values passed into the the result set.
1. The code the WORKS.
statement = connection.prepareStatement("select name from employee where a.name ='SMITH' order by name"
,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
resultSet = statement.executeQuery();
resultSet.absolute(1);
String s = resultSet.getString(1);
The code that gives me a 'exhausted resultset' error which I think means no results
String[] parameterValues = new String[] { "SMITH" };
statement = connection.prepareStatement("select name from employee where a.name =? order by name ",
ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
for (int i = 0; i < parameterValues.length; i++) {
statement.setString(i + 1, parameterValues);
resultSet = statement.executeQuery();
resultSet.absolute(1);
String s = resultSet.getString(1);
There is obviously a problem using these named parametevalues with these preparedstatement resultset, Does anybody know anything about this and a fix for it????
Cheers. RogerRoger,
It's probably a mistake you made when posting your code, but your query string is incorrect it should be either:
select name from employee where name = 'SMITH' order by nameor
select a.name from employee a where a.name = 'SMITH' order by a.nameIn other words you have prefixed a column with a table alias but have not indicated a table alias in the query.
Also, shouldn't your code be:
for (int i = 0; i < parameterValues.length; i++) {
statement.setString(i + 1, parameterValues[ i ]);
}Or was the "[ i ]" part giving you trouble? (Since "[ i ]" -- without the spaces -- is treated as a text-formatting tag.)
While I didn't try your specific query, I have no problem using "PreparedStatment"s with parameters.
What is your environment? Mine is:
Oracle 10g (10.1.0.4) database on Linux (Red Hat)
JDK 1.4.2
ojdbc14.jar JDBC driver (latest version)
Good Luck,
Avi. -
Hello!
Oracle Application Server 10g Release 3 (10.1.3.0.0) have problems with PreparedStatement java class?
WebApp code like ------
PreparedStatement pst4 = null;
pst4 = conn4.prepareStatement("UPDATE users SET LAST_LOG_DATE = SYSDATE WHERE login=?");
pst4.setString(1,login);
rs4 = pst4.executeQuery();
System.out.println(login);
} catch (SQLException e2) {
if (logger.isErrorEnabled()) {
logger.error("login() - connection in "+this.getClass().getName()+" failed "
+ e2.getMessage());
logger.error("UPDATE users SET LAST_LOG_DATE = SYSDATE WHERE login=?");
throw SQLException with message
" SQL string is not Query "
On Tomcat all working with out exceptions...
Thanks
Message was edited by:
rrrookieHi,
We run into the same problem and found, that it has nothing to do with OAS itself, but related to Oracle Driver.
We discovered, that OAS comes with older version of ojdbc14.jar (10.1.0_2) than we used (10.2.0.2 ). Creation of the shared library based on version 10.2.0.2 could solve the problem, because this version tolerates use of executeQuery( ) for Insert, Delete and Update.
Anyway, because such use of this executeQuery( ) method does not look correct, I would suggest to use method executeUpdate() instead.
Thanks. -
PreparedStatements ArrayIndexOutOfBoundsException
We are running our application on a WebLogic 5.1(sp 9)server using JDK
1.2.2 on an HP Unix box. We use a weblogic.jdbc.oci.Driver to access
an Oracle 8.1.5 database. The issue we have is with creating a
dynamic prepared statement. The prepared statement is a select
statement generated from a selection of account numbers on a web page.
First the prepared statement is dynamically built based on the number
of account numbers selected. For example, 'Select * from tablename
where accountnbr IN (?,?,?.......)'. In a while loop, a '?' is added
for each accountnbr selected. Next, in another while loop, a
variable is bound to each parameter by using a while loop (ie:
ps.setString(i++, accountnbrArray). The prepared statement is then
executed. This works fine so long as there is under 512 accounts
selected. However, once 512 or more accounts are selected, we get an
error. While looping through and binding the variables using the
setString method, the application throws an
ArrayIndexOutOfBoundsException in this method on the 512th parameter
every time. Can anyone help me out with what/why this is happening?
Thanks for your help.Hi Don,
Could you post a stacktrace of the exception you're getting?
FYI, SP9 had a problem with PreparedStatement cache, so you
may want to try turning it off by putting STATEMENT_CACHE=0
in the connection pool properties.
Regards,
Slava Imeshev
"Don" <[email protected]> wrote in message
news:[email protected]..
We are running our application on a WebLogic 5.1(sp 9)server using JDK
1.2.2 on an HP Unix box. We use a weblogic.jdbc.oci.Driver to access
an Oracle 8.1.5 database. The issue we have is with creating a
dynamic prepared statement. The prepared statement is a select
statement generated from a selection of account numbers on a web page.
First the prepared statement is dynamically built based on the number
of account numbers selected. For example, 'Select * from tablename
where accountnbr IN (?,?,?.......)'. In a while loop, a '?' is added
for each accountnbr selected. Next, in another while loop, a
variable is bound to each parameter by using a while loop (ie:
ps.setString(i++, accountnbrArray). The prepared statement is then
executed. This works fine so long as there is under 512 accounts
selected. However, once 512 or more accounts are selected, we get an
error. While looping through and binding the variables using the
setString method, the application throws an
ArrayIndexOutOfBoundsException in this method on the 512th parameter
every time. Can anyone help me out with what/why this is happening?
Thanks for your help. -
PreparedStatements and LIKE clauses
Hi,
I've come across a slight problem with PreparedStatements and LIKE clauses. Say I want my query to look something like this:
SELECT * FROM CONTENT_TABLE WHERE CONTENT LIKE '%test%'If I were to use a PreparedStatement I'd do something like this:
PreparedStatement searchContent = con.prepareStatement("SELECT * FROM CONTENT_TABLE WHERE CONTENT LIKE ?");
searchContent.setString(1, queryString);This isn't correct becuase it matches where CONTENT LIKE 'queryString'
I tried this:
PreparedStatement searchContent = con.prepareStatement("SELECT * FROM CONTENT_TABLE WHERE CONTENT LIKE '%?%'");
searchContent.setString(1, queryString);But I get a syntax error in my SQL.
Is there another way around this?
Thanksjust guessing try this:
PreparedStatement searchContent = con.prepareStatement("SELECT * FROM CONTENT_TABLE WHERE CONTENT LIKE '%?%'");searchContent.setString(1, "%"+queryString+"%");
This might work, since ? gets replaced by '...', so i am guessing %..% will fit..
give it a shot, i might be wrong. -
How to use % wildcard in jdbc plz help me
Hello all,
try
PreparedStatement st=dbcon.prepareStatement("select * from stud2 where ename=? ");
st.setString(1,ename+"%");
ResultSet rs=st.executeQuery();
while(rs.next())
out.println("<td>");
out.println(rs.getString(2));//this field is for name
out.println(rs.getString(3));//this is for addresss
}catch(Exception e){}This code is in servlets,and iam using MS-ACCESS as database.
in this way iam trying this code , usage of %wild card but iam not getting the right anser, i want the anser if i will type any letter it should search the database and display me all names of that letter
plz help me solving this problem
vidya.PreparedStatement ps = con.prepareStatement("select blah from blah where blah like ?");
ps.setString(1, "a%"); // everything that starts with 'a'
rs = ps.executeQuery(); -
hi all, i keep having this syntax error with sql statement with words like I'm, she's..etc. any words with apostrophe's is misunderstood by sql. have searched for various solutions and tried this but it still doesnt work:
String name=request.getParameter("name");
String newname=name.replaceAll(" ' "," ' ' ");
//(im replacing one apostrophe with 2 of them.)
String sqlInsert = "insert into prod values(" + " ' " + newname " ' )";
what is wrong with this? thanksThe correct answer here is the PreparedStatement (not that the other suggesstions won't work, but you should replace ' with '', that's single quote with double single quote, not single quote for double quote).
As mentioned earlier all this will be taken care of. if you use PreparedStatement You should get in the habit of using them anyway. It eliminates nearly all kinds of formatting problems, dates, variables with punctuation, etc. Save yourself from having many more problems, use PreparedStatement. -
Newbie help on JDBC, please
Hi,
I am new to Java Programming,and JDBC. I have installed jdbc driver for Postgresql, and is working fine. I have the following code (which I can compile, but when I run I gets many lines of error messages):
import java.io.*;
import java.sql.*;
import java.util.*;
public class ContactInput {
public static void main(String args[]) {
int serial = 2;
String name ="Patty Thapa";
String email ="[email protected]";
String homepage ="www.damars.net/~pat";
String tel = "2334 2747";
String add = "Hong kong";
String url = "jdbc:postgresql:contacts";
Connection con;
PreparedStatement pprStmt;
try {
Class.forName("org.postgresql.Driver");
} catch(java.lang.ClassNotFoundException e) {
System.err.print("ClassNotFoundException: ");
System.err.println(e.getMessage());
try {
con = DriverManager.getConnection(url,"damar", "");
pprStmt=con.prepareStatement("INSERT INTO address(serial, name, email, homepage, telephone, postaladdress)"
+ "values(?,?,?,?,?,?)");
pprStmt.clearParameters();
pprStmt.setInt(1,serial);
pprStmt.setString(2,name);
pprStmt.setString(3,email);
pprStmt.setString(4,homepage);
pprStmt.setString(5,tel);
pprStmt.setString(6,add);
pprStmt.executeUpdate();
pprStmt.close();
con.close();
} catch(SQLException ex) {
System.err.println("SQLException: " + ex.getMessage());
Can any one please points me what I have done wrong here?
Thanks
DamarHi,
Further to my previous problem of PreparedStatement, I have the following code:
import java.sql.*;
import java.util.*;
public class AddressDisp{
public static void main(String[] args){
try{
Class.forName("org.postgresql.Driver");
catch (ClassNotFoundException e){
System.out.println("Unable to load Driver Class");
return;
try{
Connection con = DriverManager.getConnection("jdbc:postgresql:contacts","damar","");
Statement stmt=con.createStatement();
ResultSet rs = stmt.executeQuery("Select name from address");
while(rs.next()){
System.out.print(rs.getString("name"));
System.out.print(rs.getInt("ser"));
System.out.print(", " +rs.getString("email"));
System.out.print(", " + rs.getString("telephone"));
System.out.println(", " + rs.getString("postaladdress"));
rs.close();
stmt.close();
con.close();
catch(SQLException se){
System.out.println("SQL Exception : " + se.getMessage());
se.printStackTrace(System.out);
In address table, there is 6 fields namely, ser (int), name (char(20)), email (varchar(24)), homepage (varchar(25)), telephone (char(15)), postaladdress (varchar(30)). The above code works properly only with "System.out.print(rs.getString("name"))" ie I can get all names, but all other fields end up with following message:
SQL Exception : The column name ser not found.
The column name ser not found.
at 0x4017224b: java.lang.Throwable.Throwable(java.lang.String) (/usr/lib/libgcj.so.2)
at 0x4016885b: java.lang.Exception.Exception(java.lang.String) (/usr/lib/libgcj.so.2)
at 0x401e0a40: java.sql.SQLException.SQLException(java.lang.String, java.lang.String, int) (/usr/lib/libgcj.so.2)
at 0x401e09cb: java.sql.SQLException.SQLException() (/usr/lib/libgcj.so.2)
at 0x4023925f: ffi_call_SYSV (/usr/lib/libgcj.so.2)
at 0x40239227: ffi_raw_call (/usr/lib/libgcj.so.2)
at 0x4014c8db: JvInterpMethod.continue1(_Jv_InterpMethodInvocation) (/usr/lib/libgcj.so.2)
at 0x40150703: JvInterpMethod.run(ffi_cif, void, ffi_raw, JvInterpMethodInvocation) (/usr/lib/libgcj.so.2)
at 0x4014c671: JvInterpMethod.run_normal(ffi_cif, void, ffi_raw, void) (/usr/lib/libgcj.so.2)
at 0x40239114: ?? (??:0)
at 0x4023925f: ffi_call_SYSV (/usr/lib/libgcj.so.2)
at 0x40239227: ffi_raw_call (/usr/lib/libgcj.so.2)
at 0x4014c8db: JvInterpMethod.continue1(_Jv_InterpMethodInvocation) (/usr/lib/libgcj.so.2)
at 0x40150703: JvInterpMethod.run(ffi_cif, void, ffi_raw, JvInterpMethodInvocation) (/usr/lib/libgcj.so.2)
at 0x4014c671: JvInterpMethod.run_normal(ffi_cif, void, ffi_raw, void) (/usr/lib/libgcj.so.2)
at 0x40239114: ?? (??:0)
at 0x4023925f: ffi_call_SYSV (/usr/lib/libgcj.so.2)
at 0x40239227: ffi_raw_call (/usr/lib/libgcj.so.2)
at 0x4014c8db: JvInterpMethod.continue1(_Jv_InterpMethodInvocation) (/usr/lib/libgcj.so.2)
at 0x40150703: JvInterpMethod.run(ffi_cif, void, ffi_raw, JvInterpMethodInvocation) (/usr/lib/libgcj.so.2)
at 0x4014c671: JvInterpMethod.run_normal(ffi_cif, void, ffi_raw, void) (/usr/lib/libgcj.so.2)
at 0x40239114: ?? (??:0)
at 0x4023925f: ffi_call_SYSV (/usr/lib/libgcj.so.2)
at 0x40239227: ffi_raw_call (/usr/lib/libgcj.so.2)
at 0x4014c8db: JvInterpMethod.continue1(_Jv_InterpMethodInvocation) (/usr/lib/libgcj.so.2)
at 0x40150703: JvInterpMethod.run(ffi_cif, void, ffi_raw, JvInterpMethodInvocation) (/usr/lib/libgcj.so.2)
at 0x4014c671: JvInterpMethod.run_normal(ffi_cif, void, ffi_raw, void) (/usr/lib/libgcj.so.2)
at 0x40239114: ?? (??:0)
at 0x4015365f: gnu.gcj.runtime.FirstThread.run() (/usr/lib/libgcj.so.2)
at 0x4015db63: java.lang.Thread.run_(java.lang.Object) (/usr/lib/libgcj.so.2)
at 0x402386a4: ?? (??:0)
at 0x403def76: GC_start_routine (/usr/lib/libgcjgc.so.1)
at 0x403f70ba: ?? (??:0)
at 0x4050bd4a: __clone (/lib/libc.so.6)
In "System.out.print(rs.getString("name"))", why only name field works, but others end up with column name not found error message? Is not name, or other fields are, the field/s in the database table? Is my system working?
Any pointers would be highly appreciated.
Damar -
What driver should I use for O8.1.6 using RedHat 6.2 Linux
Thanks
P.S. Please respond to [email protected]the jdbc driver readme file:
Oracle JDBC Drivers release 8.1.7 README
========================================
What Is New In This Release?
These are the major new features/enhancements in this release:
- Statement Caching
* Implicit Statement Caching
* Explicit Statement Caching
- Full XA Support
* Including XA Recover and Forget
* OracleXid independent implementation for 8.1.7 servers and above
- Connection Caching
* New Scheme (FIXED_WAIT_SCHEME)
* Statement Caching coupling
- PLSQL Tables Support for Scalar types (for OCI driver only)
- User-Defined Datatypes Performance Enhancement
- Object Types Extensions
* Serializable Type Descriptors
* Accessing collection elements in Java primitive types
* Buffering and indexing collection elements
* Creating empty Lobs
- Support for 56-bit encryption algorithms for connection using
the Thin JDBC driver.
These are the major bug fixes:
- BUG-903011
The JDBC Thin driver could not be used with usernames that
contained Latin-1 characters when the server used UTF8 character
set. This problem has been fixed in release 8.1.7.
- BUG-1052489
There was a problem with PreparedStatements being executed
multiple times and the length of one of the bind variables (bound
with setBinaryStream or setCharacterStream) increased. This
problem has been fixed in release 8.1.7.
- BUG-1069768
There was a problem with insertion of ADTs with an image bigger
than 4K with the JDBC Thin driver. This problem has been fixed
in release 8.1.7.
- BUG-1247015
When using ResultSet::getObject() to access CHAR or VARCHAR columns
in scrollable result sets, ResultSet::getObject() returned null.
- BUG-1349713
getString() of scrollable result sets returns incorrect values if
the column data contains multibyte characters.
Driver Versions
These are the driver versions in the 8.1.7 release:
- JDBC OCI Driver 8.1.7
Client-side JDBC for use on a machine where OCI 8.1.7 is installed.
- JDBC Thin Driver 8.1.7
100% Java client-side JDBC for use in applets and applications.
- JDBC Thin Server-side Driver 8.1.7
JDBC for use by Java Stored Procedures or by Java CORBA objects
running in Oracle 8.1.7. This driver is typically used in a middle
tier server.
- JDBC Server-side Internal Driver 8.1.7
Server-side JDBC for use by Java Stored procedures or by Java CORBA
objects running in Oracle 8.1.7. This driver used to be called the
"JDBC Kprb Driver".
For complete documentation, please refer to "JDBC Developer's Guide
and Reference".
Contents Of This Release
The [ORACLE_HOME]/jdbc/lib directory contains:
- classes111.zip
Classes for use with JDK 1.1.x. It contains the JDBC driver
classes except classes necessary for NLS support in Object and
Collection types.
- nls_charset11.zip
NLS classes for use with JDK 1.1.x. It contains classes necessary
for NLS support in Object and Collection types.
- classes111_g.zip
Same as classes111.zip, except that classes were compiled with
"javac -g".
- classes12.zip
Classes for use with JDK 1.2.x. It contains the JDBC driver
classes except classes necessary for NLS support in Object and
Collection types.
- nls_charset12.zip
NLS classes for use with JDK 1.2.x. It contains classes necessary
for NLS support in Object and Collection types.
- classes12_g.zip
Same as classes12.zip, except that classes were compiled with
"javac -g".
Note that the packaging of the JDBC classes to support NLS was
changed in 8i. The classes pertaining to specific character sets
support in Object and Collection types have been separated from the
basic zip files. These NLS classes are now packaged into the
extension zip files. This allows the user to include the NLS
classes only if necessary. Please refer to the "NLS Extension Zip
Files (for client-side only)" for further details.
[ORACLE_HOME]/lib directory contains libocijdbc8.so and
libocijdbc8_g.so (on Solaris), which are the shared libraries used by
the JDBC OCI driver.
[ORACLE_HOME]/jdbc/doc/javadoc.tar contains the JDBC Javadoc. This
release contains a beta release of the Javadoc files for the public
API of the public classes of Oracle JDBC.
[ORACLE_HOME]/jdbc/demo/demo.tar contains sample JDBC programs.
Demo programs written for JDK 1.1 must be modified to run in JDK 1.2.
Please refer to the "Support For JDK 1.2" for porting details.
NLS Extension Zip Files (for client-side only)
The JDBC Server-side Internal Driver provides complete NLS support.
It does not require any NLS extension zip files, nls_charset*.zip.
Discussions in this section do not apply to the JDBC Server-side
Internal Driver. You can skip this section if you only use the
Server-side Internal Driver.
The basic zip files, classes111.zip and classes12.zip, contain all the
necessary classes to provide complete NLS support for:
- Oracle Character sets for CHAR/VARCHAR/LONGVARCHAR/CLOB type data
that is not retrieved or inserted as a data member of an Oracle 8
Object or Collection type.
- NLS support for CHAR/VARCHAR data members of Objects and
Collections for a few commonly used character sets. These
character sets are: US7ASCII, WE8DEC, WE8ISO8859P1 and UTF8.
Users must include the appropriate extension zip in their CLASSPATH
if utilization of other character sets in CHAR/VARCHAR data members
of Objects/Collections is desired. It is important to note that
extension zip files are large in size due to the requirement of
supporting a large number of character sets. Users may choose to
include only the necessary classes from the extension zip file.
To do so, users can first unzip the extension zip file, and then put
only the necessary classes in the CLASSPATH. The character set
extension class files are named in the following format:
CharacterConverter<OracleCharacterSetId>.class
where <OracleCharacterSetId> is the hexidecimal representation of the
Oracle character set id of the corresponding character set.
Installation
Please do not try to put multiple versions of the Oracle JDBC drivers
in your CLASSPATH. The Oracle installer installs the JDBC Drivers in
the [ORACLE_HOME]/jdbc directory.
Setting Up Your Environment
On Win95/Win98/NT:
- Add [ORACLE_HOME]\jdbc\lib\classes111.zip and
[ORACLE_HOME]\jdbc\lib\nls_charset11.zip to your CLASSPATH.
(Add classes12.zip and nls_charset12.zip if JDK 1.2.x is used.)
- Add [ORACLE_HOME]\jdbc\lib to your PATH.
On Solaris/Digital Unix:
- Add [ORACLE_HOME]/jdbc/lib/classes111.zip and
[ORACLE_HOME]/jdbc/lib/nls_charset11.zip to your CLASSPATH.
(Add classes12.zip and nls_charset12.zip if JDK 1.2.x is used.)
- Add [ORACLE_HOME]/jdbc/lib to your LD_LIBRARY_PATH.
On HP/UX:
- Add [ORACLE_HOME]/jdbc/lib/classes111.zip and
[ORACLE_HOME]/jdbc/lib/nls_charset11.zip to your CLASSPATH.
(Add classes12.zip and nls_charset12.zip if JDK 1.2.x is used.)
- Add [ORACLE_HOME]/jdbc/lib to your SHLIB_PATH and LD_LIBRARY_PATH.
On AIX:
- Add [ORACLE_HOME]/jdbc/lib/classes111.zip and
[ORACLE_HOME]/jdbc/lib/nls_charset11.zip to your CLASSPATH.
(Add classes12.zip and nls_charset12.zip if JDK 1.2.x is used.)
- Add [ORACLE_HOME]/jdbc/lib to your LIBPATH and LD_LIBRARY_PATH.
Some Useful Hints In Using the JDBC Drivers
Please refer to "JDBC Developer's Guide and Reference" for details
regarding usage of Oracle's JDBC Drivers. This section only offers
useful hints. These hints are not meant to be exhaustive.
These are a few simple things that you should do in your JDBC program:
1. Import the necessary JDBC classes in your programs that use JDBC.
For example:
import java.sql.*;
import java.math.*;
2. Register the Oracle driver before before calling other JDBC APIs.
(This is not needed if you are using the JDBC Server-side Internal
Driver because registration is done automatically in the server.)
To register the Oracle driver, make sure the following statement
is executed at least once in your Java session:
DriverManager.registerDriver(
new oracle.jdbc.driver.OracleDriver());
3. Open a connection to the database with the getConnection call.
Different connection URLs should be used for different JDBC
drivers. The following examples demonstrate the different URLs.
For the JDBC OCI8 Driver:
Connection conn = DriverManager.getConnection(
"jdbc:oracle:oci8:@<database>",
"scott", "tiger");
where <database> is either an entry in tnsnames.ora or a SQL*net
name-value pair.
For the JDBC Thin Driver, or Server-side Thin Driver:
Connection conn = DriverManager.getConnection(
"jdbc:oracle:thin:@<database>",
"scott", "tiger");
where <database> is either a string of the form
<host>:<port>:<sid> or a SQL*net name-value pair.
For the JDBC Server-side Internal Driver:
Connection conn = DriverManager.getConnection(
"jdbc:oracle:kprb:");
Note that the trailing ':' character is necessary. When you use
the Server-side Internal Driver, you always connect to the
database you are executing in. You can also do this:
Connection conn
= new oracle.jdbc.driver.OracleDriver().defaultConnection();
Java Stored Procedures
Please note that examples for callins and instance methods using Oracle
8 Object Types are provided in:
[ORACLE_HOME]/javavm/demo/demo.zip
Once unzipped, the directory containing the examples is:
[ORACLE_HOME]/javavm/demo/examples/jsp
Known Problems/Limitations In This Release
The following is a list of known problems/limitations:
1. There is a limitation regarding the use of stream input for LOB
types. Stream input for LOB types can only be used for 8.1.7
JDBC OCI driver connecting to an 8.1.7 Oracle server. The use of
stream input for LOB types in all other configurations may result
in data corruption. PreparedStatement stream input APIs include:
setBinaryStream(), setAsciiStream(), setUnicodeStream(),
setCharacterStream() and setObject().
2. BUG-1018797
Extra characters may be appended to the end of a CLOB value
mistakenly under the following conditions:
- setCharacterStream() is used to insert a CLOB value, and
- The Oracle server uses multi-byte character set.
(See 1 for limitation of stream input for LOB type.)
3. Programs can fail to open 16 or more connections using our
client-side drivers at any one time. This is not a limitation
caused by the JDBC drivers. It is most likely that the limit of
per-process file descriptors is exceeded. The solution is to
increase the limit.
4. The Server-side Internal Driver has the following limitation:
- Data access for LONG and LONG RAW types is limited to 32K of
data.
- Inserts of Object Types (Oracle 8 Objects, Collections and
References) will not work when the database compatibility mode
is set to 8.0. This limitation does not apply when the
compatibility mode is set to 8.1.
- Statement.cancel() is not implemented.
- In a chain of SQLExceptions, only the first one in the chain
will have a getSQLState value.
5. The JDBC OCI driver on an SSL connection hangs when the Java
Virtual Machine is running in green threads mode. A work-around
is to run the Java Virtual Machine in native threads mode.
6. Date-time format, currency symbol and decimal symbols are always
presented in American convention.
7. When using OracleStatement.defineColumnType(), it is not necessary
to define the column type to be the same as the column type
declared in the database. If the types are different, the
retrieved values are converted to the type specified in
defineColumnType.
Note: Most reasonable conversions work, but not all. If you find
a conversion that you think is reasonable, but that does not wo rk,
please submit a TAR to Oracle Support.
8. The utility dbms_java.set_output or dbms_java.set_stream that is
used for redirecting the System.out.println() in JSPs to stdout
SHOULD NOT be used when JDBC tracing is turned on. This is
because the current implementation of dbms_java.set_output and
set_stream uses JDBC to write the output to stdout. The result
would be an infinite loop.
9. The JDBC OCI and Thin drivers do not read CHAR data via binary
streams correctly. In other word, using getBinaryStream() to
retrieve CHAR data may yield incorrect results. A work-around is
to use either getCHAR() or getAsciiStream() instead. The other
alternative is to use getUnicodeStream() although the method is
deprecated.
10. BUG-899078 (since 8.1.6 SDK):
The JDBC Server-side Internal driver has extra space padding with
PL/SQL CHAR OUT (2 to 3 space depending on character set).
Problem occurs in most of the multibyte database character set
except UTF8.
11. There is a limitation for Triggers implemented in Java and Object
Types. It only affects the IN argument types of triggers
implemented using Java on the client-side. The restriction does
not apply to JDBC programs running inside the server. Triggers
implemented as Java methods cannot have IN arguments of Oracle 8
Object or Collection type. This means the Java methods used to
implement triggers cannot have arguments of the following types:
- java.sql.Struct
- java.sql.Array
- oracle.sql.STRUCT
- oracle.sql.ARRAY
- oracle.jdbc2.Struct
- oracle.jdbc2.Array
- any class implementing oracle.jdbc2.SQLData or
oracle.sql.CustomDatum
12. The scrollable result set implementation has the following
limitation:
- setFetchDirection() on ScrollableResultSet is not supported.
- refreshRow() on ScrollableResultSet does not support all
combinations of sensitivity and concurrency. The following
table depicts the supported combinations.
Support Type Concurrency
no TYPE_FORWARD_ONLY CONCUR_READ_ONLY
no TYPE_FORWARD_ONLY CONCUR_UPDATABLE
no TYPE_SCROLL_INSENSITIVE CONCUR_READ_ONLY
yes TYPE_SCROLL_INSENSITIVE CONCUR_UPDATABLE
yes TYPE_SCROLL_SENSITIVE CONCUR_READ_ONLY
yes TYPE_SCROLL_SENSITIVE CONCUR_UPDATABLE
13. BUG-1324918
Repeatedly updating a clob with jdbc-oci, prepared statement,
and setCharacterStream consumes the temporary tablespace. If
you repeatedly update the clob, either the temp tablespace will
continue to grow, or you may get a Exception in thread "main"
java.sql.SQLException: ORA-01652: unable to extend segment if
you have a limit on the tablespace size. The work-around is to
use oracle.sql.CLOB::setCharacterOutputStream() instead.
Maybe you are looking for
-
"ipod cannot be updated becuase the required file is in use"
I upgraded to itunes 7 this weekend and so did my husband. I am running the latest versions of all mac software with my fifth gen ipod and he is running the same with the ipod mini. We both get teh same error message: "ipod cannot be updated becuase
-
Hello SAP Buddy My user had done successfully MIGO , MIRO as well as Payment process and also he had processed check payment ( already issue ) to the vendor Finally he came to know the user not assign Account assignment category Q for 2nd line
-
60 GB Video Ipod ..
So basically, My warrenty just ran up a few days ago. My ipod hard drive crashed, I went to the Apple Store and they said their was nothing they could do for my 400 dollar ipod. How unfair is that? I contacted Apple and they told me theirs a year war
-
When I try to use Ni Spy I receive the error: The procedure entry point _StopSpying@0 coule not be located in the dynamic link library NiSpyLog.dll Ni VISA 4.0 Ni Spy 2.0.0.16 Windows 2000
-
Burn music files and a pdf file?
Is it possible to burn some music files and a pdf file on the same CD using iTunes? If not, maybe using some other software? Numbers