Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Usenet -> c.d.o.misc -> Java JDBC PreparedStatment question
i posted this to comp.lang.java.databases without much response so i'm
expanding my search...
i am running into a null pointer exception using a PreparedStatement. not sure what is causing it but here is the situation:
using a JSP running on WebLogic6.0sp1 to pull data from an Oracle8i dB. the connection to the dB is through a connection pool setup in the Weblogic config.xml. requests to the dB are made using a PreparedStatement where the arguments are set using setObject. the 1st time i view the JSP, the data appears. after that, when i refresh the page, sometimes i get the exeception that follows this explanation. refreshing more, sometimes the data will appear again, sometimes not. i do not know what is causing the problem in checkBindTypes. Oracle's MetaLink support site has no info. BEA's support site has no info.
here's the method i use to get a ResultSet using a PreparedStatement... public ResultSet getData(String sqlQuery, Object[] args) {
ResultSet result = null; Connection cnx = getConnection(); PreparedStatement stmt = null; try { if(cnx != null) stmt = cnx.prepareStatement(sqlQuery); for(int i = 0; stmt != null && i < args.length; i++) stmt.setObject(i+1, args[i]); if(stmt != null) result = stmt.executeQuery(); } catch(SQLException sqlEx) { // exception handling code deleted } return result;
the JSP calls this passing in a my SQL query string and a String[] as its argument (e.g. new String[] {"IBM"} ). the column being dynamically tested in the where clause of the SQL query is a VARCHAR2 column so the String should be accepted. it is some of the time, but i'm wondering why the request would sometimes fail.
is this a known driver problem? or is there a check that needs to be done to avoid this? has anyone run into this problem? anyone have any ideas on what's going on?
thx Received on Fri May 10 2002 - 16:34:54 CDT
![]() |
![]() |