Bug in Oracle JDBC Driver: NullPointerException when calling clearParameters

There is a bug in the latest version of the JDBC driver that throws a NPE when calling PreparedStatement.clearParameters(). I don't need a response to this, since I have a workaround (just catching and ignoring the exception), but it should probably be fixed. I speculate that the problem only occurs when you try to call clearParameters() more than once on the same PS, but I haven't confirmed it.
It is probably an easy fix. Following is the stack trace:
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(OraclePreparedStatement.java:3401)
at com.solarmetric.datasource.PreparedStatementCache$CachePreparedStatement.close(PreparedStatementCache.java:293)
at com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatementBatch(SQLExecutionManagerImpl.java:666)
at com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executePreparedStatement(SQLExecutionManagerImpl.java:514)
at com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.executeInternal(SQLExecutionManagerImpl.java:406)
at com.solarmetric.kodo.impl.jdbc.SQLExecutionManagerImpl.flush(SQLExecutionManagerImpl.java:273)
at com.solarmetric.kodo.impl.jdbc.runtime.JDBCStoreManager.flush(JDBCStoreManager.java:421)
at com.solarmetric.kodo.runtime.PersistenceManagerImpl.flush(PersistenceManagerImpl.java:549)
at com.solarmetric.kodo.runtime.PersistenceManagerImpl.commit(PersistenceManagerImpl.java:412)
at com.sun.jdotck.api.persistencemanager.MakePersistentAssignsObjectId.testMakePersistentAssignsObjectId2(Unknown Source)
at com.sun.jdotck.api.persistencemanager.MakePersistentAssignsObjectId.testMakePersistentAssignsObjectId(Unknown Source)
at com.sun.jdotck.api.persistencemanager.MakePersistentAssignsObjectId.runTest(Unknown Source)
at com.sun.jdotck.api.persistencemanager.PersistenceManagerTest.run(Unknown Source)
at com.solarmetric.kodo.compatibility.JDOCompatabilityTestSuite$1.runTest(JDOCompatabilityTestSuite.java:493)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.run(JUnitTestRunner.java:325)
at org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner.main(JUnitTestRunner.java:524)
Marc Prud'hommeaux [email protected]
SolarMetric Inc. http://www.solarmetric.com

Take a look at the method that is causing the NullPointerException:
public void clearItem(int i)
if (!m_dynamic && m_vector == null && i < m_vector.size())
m_vector.removeElementAt(i);
if (m_items != null && i >= m_items.length)
return;
m_items[i] = null;
return;
A NullPointerException will be thrown whenever clearParameters() is called when no parameters have yet been bound.
The first IF statement should read:
if (!m_dynamic && m_vector != null && i < m_vector.size())
A simple workaround would be to make sure that your parameter list is never empty before calling clearParameters(). Is there a patch for this anywhere?

Similar Messages

  • Class Not found : oracle.jdbc.driver.OracleDriver when calling web service

    Hi,
    I have installed the Oracle Data Integrator Public Web Services on Apache Tomcat 5.5 application server with Apache Axis2
    When I try to call the web service OdiInvoke using the operation "listScenario" using only the JdbcDriver as input parameter, the response I get back from the web service call is:
    java.lang.ClassNotFoundException: Class Not found : oracle.jdbc.driver.OracleDriver
    Using the operator "getWebServiceVersion" I get a successfull response back som the connection seems fine.
    Obviously the error has to do with the driver not beeing available but where should I put the driver? Or how do I make it available? When working from Topology Manager, all connections are fine.
    Best regards
    M

    Solved it on my own by putting ojdbc14.jar in the following directory: <Apache-Tomcat install dir>/webapps/axis2/WEB-INF/lib/
    Thought I'd share in case some one else has same issue
    /M

  • Load oracle jdbc driver error when run applet via the web

    Hi All,
    I have built an applet which connect to database via jdbc thin driver. It works fine when I run it through the applet viewer, but got a problem when run it through the web.
    java.lang.NoClassDefFoundError: oracle/jdbc/driver/OracleDriver
    I am using jdev9i 9.0.4 and jdk 1.4.2. The jdbc version is 9.0.1
    I have added both the classes12.zip and ojdbc14.zip in the class path and also pack them together with my applet class. Here is the code
    public class MyApplet extends Applet
    implements Runnable
    public void start()
    if(theThread == null)
    theThread = new Thread(this);
    theThread.start();
    Retrieve R = new Retrieve();
    this.MyMap = R.retrieveDesc();
    public class Retrieve
    public Retrieve()
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    conn=DriverManager.getConnection("jdbc:oracle:thin:@babyruth.wvu.edu:1703:devdw", User, Password);
    conn.setAutoCommit(true);
    connectStatus = true;
    public HashMap retrieveDesc()
    return map;
    I have also built one HTML page NewApplet like this
    <HTML>
    <HEAD>
    <TITLE> My New Applet</TITLE>
    </HEAD>
    <APPLET CODE="MyApplet.class" CODEBASE="menu" ARCHIVE="MyApplet.zip" WIDTH=300 HEIGHT=485>
    <!--General Settings-->
    <param name="bgcolor" value="255,255,255">
    </HTML>
    Any advice is highly appreciated
    Mei

    Sir,
    Well you haven't "packed" them correctly. Why don't you just add the driver bits to the soucebase tag? or something like that anyway...
    Sincerely,
    Slappy

  • Receiving oracle.jdbc.driver error when trying to connect

    Setup:
    Windows 7 64bit
    4GB ram
    SQL Developer 3.2.20.09
    Java platform 1.6.0_37
    Oracle IDE 3.2.20.09.87
    Hello, I'm going to start by saying I'm a rank amateur when it comes to using and understand SQL developer. My entire need for this program is to connect to a virt server at my office and test out my SQL queries against our tables. It's been working great for this purpose until yesterday when I received this error:
    An error was encountered performing the requested operation:
    oracle.jdbc.driver.T2CConnection.getLibraryVersionNumber()I
    Vendor code 0
    I did some searching and found a few references to this error but due to my inexperience I was unable to follow the resolutions and fix the error. This connection was working fine until yesterday afternoon which seemed odd. Based on my control panel, here is what I installed yesterday, I believe I installed both Java's after the error occurred seeing if they would alleviate the issue.
    MySQL Administrator 1.1
    Java SE Development Kit 6 Update 41 (64-bit)
    MySQL Workbench 5.2 CE
    Java 6 Update 41 (64-bit)
    Could one of these be the root of the issue?
    Thanks for the help and sorry for the lack of technical expertise, my need is very narrow and up until now this program has worked great for me.
    -Brad
    Edited by: 998110 on Apr 4, 2013 9:46 AM

    >
    Could one of these be the root of the issue?
    >
    More likely to be that you are now using the wrong version of the oracle jdbc jar file.
    Post the name and version of the JDBC jar file that you think you are using.
    Search the pc for ALL such files.
    Examine the environment variables (e.g. PATH) to see if they reference jdbc jars other than the ojdbc6 jar you should be using.

  • Is it a bug for Oracle JDBC driver?

    Hi,
    I use the thin JDBC driver to connect my server, and try to obtain the meta data for the query data set. However, every time I issue 'getMetaData()' to get meta data, the following error is reported:
    java.lang.NumberFormatException: For input string: "4294967295"
         at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
         at java.lang.Integer.parseInt(Integer.java:480)
         at java.lang.Integer.parseInt(Integer.java:518)
         at oracle.jdbc.driver.OracleResultSetMetaData.getPrecision(OracleResultSetMetaData.java:381)
         at genentity.GenEntityForm.getTableMetaData(GenEntityForm.java:445)
         at genentity.GenEntityForm.jButton2_actionPerformed(GenEntityForm.java:336)
    and the program coding for this error is as follows:
    sql = "SELECT * FROM " + tableName;
    ps = conn.prepareStatement(sql);
    rs = ps.executeQuery();
    rsmd = rs.getMetaData(); <-- Error occurs in here.
    Does anyone get an idea for this? Please help.
    Thanks in advance,
    Athens Yan.

    Hi,
    If u have applied the patch then there shud be no problem...try applying the patch again.

  • Oracle JDBC Driver Compile Errors

    I'd like to try out this new Preview Edition but I get the following errors:
    Error(22,8): class oracle.jdbc.driver.OracleCallableStatement is not public; cannot be accessed from outside of package oracle.jdbc.driver
    Error(23,8): class oracle.jdbc.driver.OracleTypes is not public; cannot be accessed from outside of package oracle.jdbc.driver
    These erors occur at the import statements:
    import oracle.jdbc.driver.OracleCallableStatement;
    import oracle.jdbc.driver.OracleTypes;
    when I attempt to compile a JDev 10.1.3 project in the 11g Technology Preview Edition. Any idea why?
    TIA,
    Jeff

    We don't support project migration from 10.1.3 to the
    technology preview.
    Does the problem reproduce if you create a new
    project in 11tp?Shay,
    Thanks for the quick response. I created a new application in 11tp from scratch. I created a View Object and pasted the offending code into it and got the same compile errors. I actually got the code about a year ago from Steve's Not Yet Documented Applications. He has since removed the App from the page, changed the code and added it to the Dev Guide. The sample app showed how to bind a View object to a REF Cursor returned from a stored procedure and it looked something like this:
    CallableStatement cs = conn.prepareCall("{?=call package.name(P_CODIGO => ?)}");
    cs.rgisterOutParameter(1,OracleTypes.CURSOR);
    cs.setInt(2,16782);
    cs.executeQuery();
    ResultSet result = ((OracleCallableStatement)cs).getCursor(1);
    Changing the code to look more like what is now in the DEV GUIDE will more than likely work because he eliminates the need for the OracleCallableStatement.
    This brings me to my next point. If migration is not currently supported, will it be when the production release of JDEV 11g is available? Shame on me for just quickly skimming the release notes but when the import wizard ran on my project it did not warn me that the feature is not supported or that problems are likely. Upon resolving the issues with the callable statement, I had significant other compile errors in my jspx pages that will probably not be as trivial to fix. If project upgrades are not performed "easily" it will certainly push the 11g adoption date out considerably.
    Thanks again, your comments are always encouraged.
    Jeff

  • CLassCastException with oracle.jdbc.driver.OracleCallableStatement

    Hello,
    I get a ClassCastException when I try to execute a Stored Procedure with WL6.1
    and the JDriver.
    I have a servlet who intanciate a Bean and call to his execute() method in this
    way:
    Context ctx = null;
    Hashtable ht = new Hashtable();
    Connection conn = null;
    ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    try {
    ctx = new InitialContext(ht);
    javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup(connPool);
    conn = ds.getConnection();
    conn.setAutoCommit(true);
    SvcEmpEstObt empEstObt = new SvcEmpEstObt();
    empEstObt.setMaxRows(100);
    empEstObt.setConnection(conn);
    //Get parameters from Http Get and set the JB
    empEstObt.setEmpRut(request.getParameter("rut"));
    empEstObt.setEmpTimeStamp(request.getParameter("timestamp"));
    //Execute Service
    empEstObt.execute();
    /* ********* the execute() method of the jb is listed here */
    public int execute() throws ClassNotFoundException, SQLException{
    intreturnedRows = 0;
    try {if (connection == null){
    try {Class.forName(driver);
    } catch (ClassNotFoundException e) {
    System.err.println("ClassNotFoundException: " + e);
    throw e;
    connection = DriverManager.getConnection(url, user, password);
    row = -1;
    srv_message = String.valueOf(maxRows);
    String sp = "{call SvcEmpEstObt_Pkg.SvcEmpEstObt(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}";
    oracle.jdbc.driver.OracleCallableStatement procout = (oracle.jdbc.driver.OracleCallableStatement)
    connection.prepareCall(sp); // The exception is here
    procout.registerOutParameter(1, Types.VARCHAR);
    procout.setString(1, srv_message);
    procout.setString(2, empRut);
    procout.setString(3, empTimeStamp);
    procout.registerOutParameter(4, Types.VARCHAR);
    procout.registerOutParameter(5, Types.VARCHAR);
    procout.registerOutParameter(6, Types.INTEGER);
    int elemSqlType = OracleTypes.INTEGER;
    int elemMaxLen = 0;
    procout.registerIndexTableOutParameter(7, maxRows, elemSqlType, elemMaxLen);
    elemSqlType = OracleTypes.VARCHAR;
    elemMaxLen = 30;
    // register the OUT parameter
    procout.registerIndexTableOutParameter(8, maxRows, elemSqlType, elemMaxLen);
    elemSqlType = OracleTypes.VARCHAR;
    elemMaxLen = 21;
    // register the OUT parameter
    procout.registerIndexTableOutParameter(9, maxRows, elemSqlType, elemMaxLen);
    elemSqlType = OracleTypes.INTEGER;
    elemMaxLen = 0;
    // register the OUT parameter
    procout.registerIndexTableOutParameter(10, maxRows, elemSqlType, elemMaxLen);
    // execute the call
    procout.execute();
    sqlWarning = procout.getWarnings();
    srv_message = procout.getString(1);
    returnStatus = new Integer(srv_message.substring(0,1)).intValue();
    dagMessage = new DagMessage();
    dagMessage.oracleMessage(srv_message);
    // access the value using JDBC default mapping
    empEstTitulo = procout.getString(4);
    empEstUniv = procout.getString(5);
    empEstNivel = procout.getInt(6);
    curCodigo = (BigDecimal[]) procout.getPlsqlIndexTable(7);
    curNombre = (String[]) procout.getPlsqlIndexTable(8);
    curFecha = (String[]) procout.getPlsqlIndexTable(9);
    curDuracion = (BigDecimal[]) procout.getPlsqlIndexTable(10);
    // close the statement
    procout.close();
    if (curCodigo == null) {
    return 0;
    } else {
    return curCodigo.length;
    } catch (SQLException e) {
    SQLException ex = e;
    System.err.println("\n--- SQLException caught ---\n");
    while (ex != null) {
    System.err.println("Message: " + ex.getMessage ());
    System.err.println("SQLState: " + ex.getSQLState ());
    System.err.println("ErrorCode: " + ex.getErrorCode ());
    ex = ex.getNextException();
    System.out.println("");
    throw e;
    Does Someone has an idea why it happens ?

    Hans,
    Could you give us the whole text of exception?
    Regards,
    Slava Imeshev
    "Hans" <[email protected]> wrote in message
    news:[email protected]...
    >
    It Works! Thanx a lot ....
    I was working with a previous version of my App ... I fixed the problemand now
    i can Cast to weblogic.jdbc.vendor.oracle.OracleCallableStatement,
    But ...
    I get the following Exception:
    SQL Exception:
    registerIndexTableOutParameter is not supported by the
    underlying JDBC driver weblogic.jdbc.pool.Connection
    What I need to do ?
    /* this is what i`m trying to make */
    weblogic.jdbc.vendor.oracle.OracleCallableStatement procout =(weblogic.jdbc.vendor.oracle.OracleCallableStatement)
    connection.prepareCall(sp);
    procout.registerOutParameter(1, Types.VARCHAR);
    procout.setString(1, srv_message);
    procout.setString(2, empRut);
    procout.setString(3, empTimeStamp);
    procout.registerOutParameter(4, Types.VARCHAR);
    procout.registerOutParameter(5, Types.VARCHAR);
    procout.registerOutParameter(6, Types.INTEGER);
    int elemSqlType = OracleTypes.INTEGER;
    int elemMaxLen = 0;
    procout.registerIndexTableOutParameter(7, maxRows, elemSqlType,elemMaxLen);
    >
    elemSqlType = OracleTypes.VARCHAR;
    elemMaxLen = 30;
    // register the OUT parameter
    procout.registerIndexTableOutParameter(8, maxRows, elemSqlType,elemMaxLen);
    >
    elemSqlType = OracleTypes.VARCHAR;
    elemMaxLen = 21;
    // register the OUT parameter
    procout.registerIndexTableOutParameter(9, maxRows, elemSqlType,elemMaxLen);
    >
    elemSqlType = OracleTypes.INTEGER;
    elemMaxLen = 0;
    // register the OUT parameter
    procout.registerIndexTableOutParameter(10, maxRows, elemSqlType,elemMaxLen);
    >
    >
    "Hans" <[email protected]> wrote:
    Thanx Slava,
    But I have the same problem again...
    I replace oracle.jdbc.driver.OracleCallableStatement with
    weblogic.jdbc.vendor.oracle.OracleCallableStatement
    and I get the same ClassClastException in
    weblogic.jdbc.vendor.oracle.OracleCallableStatement procout =
    (weblogic.jdbc.vendor.oracle.OracleCallableStatement)
    connection.prepareCall(sp);
    Any ideas ??
    "Slava Imeshev" <[email protected]> wrote:
    Hi Hans,
    You can not cast returned object to
    oracle.jdbc.driver.OracleCallableStatement
    when accessing oracle db via connection pool.
    It can be casted to weblogic.jdbc.vendor.oracle.OracleCallableStatement.
    Here is a list of methods supported by this interface:
    void clearParameters() throws java.sql.SQLException;
    void registerIndexTableOutParameter(int i, int j, int k, int l) throws
    java.sql.SQLException;
    void registerOutParameter(int i, int j, int k, int l) throws
    java.sql.SQLException;
    java.sql.ResultSet getCursor(int i) throws java.sql.SQLException;
    java.io.InputStream getAsciiStream(int i) throws
    java.sql.SQLException;
    java.io.InputStream getBinaryStream(int i) throwsjava.sql.SQLException;
    java.io.InputStream getUnicodeStream(int i) throwsjava.sql.SQLException;
    >>>
    Regards,
    Slava Imeshev
    "Hans" <[email protected]> wrote in message
    news:[email protected]...
    Hello,
    I get a ClassCastException when I try to execute a Stored Procedurewith
    WL6.1
    and the JDriver.
    I have a servlet who intanciate a Bean and call to his execute()
    method
    in
    this
    way:
    Context ctx = null;
    Hashtable ht = new Hashtable();
    Connection conn = null;
    ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFact
    or
    y");
    try {
    ctx = new InitialContext(ht);
    javax.sql.DataSource ds = (javax.sql.DataSource)ctx.lookup(connPool);
    conn = ds.getConnection();
    conn.setAutoCommit(true);
    SvcEmpEstObt empEstObt = new SvcEmpEstObt();
    empEstObt.setMaxRows(100);
    empEstObt.setConnection(conn);
    file://Get parameters from Http Get and set the JB
    empEstObt.setEmpRut(request.getParameter("rut"));
    empEstObt.setEmpTimeStamp(request.getParameter("timestamp"));
    file://Execute Service
    empEstObt.execute();
    /* ********* the execute() method of the jb is listed here */
    public int execute() throws ClassNotFoundException, SQLException{
    intreturnedRows = 0;
    try {if (connection == null){
    try {Class.forName(driver);
    } catch (ClassNotFoundException e) {
    System.err.println("ClassNotFoundException: " + e);
    throw e;
    connection = DriverManager.getConnection(url, user, password);
    row = -1;
    srv_message = String.valueOf(maxRows);
    String sp = "{call SvcEmpEstObt_Pkg.SvcEmpEstObt(?, ?, ?, ?, ?, ?,?, ?,
    oracle.jdbc.driver.OracleCallableStatement procout =(oracle.jdbc.driver.OracleCallableStatement)
    connection.prepareCall(sp); // The exception is here
    procout.registerOutParameter(1, Types.VARCHAR);
    procout.setString(1, srv_message);
    procout.setString(2, empRut);
    procout.setString(3, empTimeStamp);
    procout.registerOutParameter(4, Types.VARCHAR);
    procout.registerOutParameter(5, Types.VARCHAR);
    procout.registerOutParameter(6, Types.INTEGER);
    int elemSqlType = OracleTypes.INTEGER;
    int elemMaxLen = 0;
    procout.registerIndexTableOutParameter(7, maxRows, elemSqlType,elemMaxLen);
    elemSqlType = OracleTypes.VARCHAR;
    elemMaxLen = 30;
    // register the OUT parameter
    procout.registerIndexTableOutParameter(8, maxRows, elemSqlType,elemMaxLen);
    elemSqlType = OracleTypes.VARCHAR;
    elemMaxLen = 21;
    // register the OUT parameter
    procout.registerIndexTableOutParameter(9, maxRows, elemSqlType,elemMaxLen);
    elemSqlType = OracleTypes.INTEGER;
    elemMaxLen = 0;
    // register the OUT parameter
    procout.registerIndexTableOutParameter(10, maxRows, elemSqlType,elemMaxLen);
    // execute the call
    procout.execute();
    sqlWarning = procout.getWarnings();
    srv_message = procout.getString(1);
    returnStatus = new Integer(srv_message.substring(0,1)).intValue();
    dagMessage = new DagMessage();
    dagMessage.oracleMessage(srv_message);
    // access the value using JDBC default mapping
    empEstTitulo = procout.getString(4);
    empEstUniv = procout.getString(5);
    empEstNivel = procout.getInt(6);
    curCodigo = (BigDecimal[]) procout.getPlsqlIndexTable(7);
    curNombre = (String[]) procout.getPlsqlIndexTable(8);
    curFecha = (String[]) procout.getPlsqlIndexTable(9);
    curDuracion = (BigDecimal[]) procout.getPlsqlIndexTable(10);
    // close the statement
    procout.close();
    if (curCodigo == null) {
    return 0;
    } else {
    return curCodigo.length;
    } catch (SQLException e) {
    SQLException ex = e;
    System.err.println("\n--- SQLException caught ---\n");
    while (ex != null) {
    System.err.println("Message: " + ex.getMessage ());
    System.err.println("SQLState: " + ex.getSQLState ());
    System.err.println("ErrorCode: " + ex.getErrorCode ());
    ex = ex.getNextException();
    System.out.println("");
    throw e;
    Does Someone has an idea why it happens ?

  • NullPointerException at oracle.jdbc.driver.T4C8Oall.getNumRows

    Hi,
    Any help is appreciated here.
    tried these drivers but didn't work: 10.2.0.5.0,10.2.0.1.0,10.1.0.5.0,
    am using 1.5.0_22 & oracle 10g xe on win7-64
    Keep on getting this when trying to fill the jasper manager:
    19:36:38,907 ERROR [STDERR] java.lang.NullPointerException
    19:36:38,908 ERROR [STDERR] at oracle.jdbc.driver.T4C8Oall.getNumRows(T4C8Oall.java:870)
    19:36:38,908 ERROR [STDERR] at oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:961)
    19:36:38,908 ERROR [STDERR] at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1168)
    19:36:38,908 ERROR [STDERR] at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3285)
    19:36:38,909 ERROR [STDERR] at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3329)
    19:36:38,909 ERROR [STDERR] at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92)
    19:36:38,909 ERROR [STDERR] at net.sf.jasperreports.engine.query.JRJdbcQueryExecuter.createDatasource(JRJdbcQueryExecuter.java:137)
    19:36:38,910 ERROR [STDERR] at net.sf.jasperreports.engine.fill.JRFillDataset.createQueryDatasource(JRFillDataset.java:686)
    19:36:38,910 ERROR [STDERR] at net.sf.jasperreports.engine.fill.JRFillDataset.initDatasource(JRFillDataset.java:606)
    19:36:38,910 ERROR [STDERR] at net.sf.jasperreports.engine.fill.JRBaseFiller.setParameters(JRBaseFiller.java:1273)
    19:36:38,911 ERROR [STDERR] at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:892)
    19:36:38,911 ERROR [STDERR] at net.sf.jasperreports.engine.fill.JRBaseFiller.fill(JRBaseFiller.java:841)
    19:36:38,911 ERROR [STDERR] at net.sf.jasperreports.engine.fill.JRFiller.fillReport(JRFiller.java:58)
    19:36:38,911 ERROR [STDERR] at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:417)
    Regards,
    Johan

    jzahri wrote:
    19:36:38,907 ERROR [STDERR] java.lang.NullPointerExceptionDriver shouldn't throw that - so it is a driver bug.
    Fastest way to fix it is to figure out exactly what query is being executed then find another way to do that.

  • NullPointerException at oracle.jdbc.driver.OracleDriver.connect()

    I have written a java stored procedure. The method can be executed properly in local PC environment.
    but when the java program is load into Oracle DB JVM by loadjava command. such method is called in SQL> prompt as a java stored procedure. I got
    java.lang.NullPointerException
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:379)
    at java.sql.DriverManager.getConnection(DriverManager.java:573)
    at java.sql.DriverManager.getConnection(DriverManager.java:187)
    at WCZSynchronizer.testLocalConn(WCZSynchronizer:901)
    as shown in the trace file.
    The line in my own java program WCZSynchronizer is simply
    Connection conn = java.sql.DriverManager.getConnection(db_connection_string,username,password);
    I am sure that the db_connection_string, username and password are correct as it works in my local PC.
    I even try to get default connection by
    Connection conn = java.sql.DriverManager.getConnection("jdbc:default:connection:");
    and
    Connection conn = new oracle.jdbc.driver.OracleDriver().defaultConnection();
    I got the same NullPointerException in both cases too.
    In fact, the java stored procedure worked before. but suddenly it's failed! The Oracle DB server is under my control and I did not change any configuration nor setting on it.
    I can't find similar case from this forum. Do any one know why?
    thanks.

    First try debugging the test case by making sure that none of the parameters passed to getConnection is null.
    When you are sure that none of the parameters are null, if the issue still reproduces. Let us know
    - The driver version
    - The jar file you are using
    cheers
    Ashok

  • 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");
    null

    Horea
    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

  • NullPointerException in oracle.jdbc.driver.T2CConnection.logon

    Hiya,
    I know little about Java, so I'm a bit lost when I get this error:
    java.lang.NullPointerException
    at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:325)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:347)
    at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:139)
    at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:79)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:549)
    at java.sql.DriverManager.getConnection(DriverManager.java:512)
    at java.sql.DriverManager.getConnection(DriverManager.java:171)
    at com.somecorp.util.pool.DatabaseConnectionFactory.create(DatabaseConnectionFactory.java:62)
    at com.somecorp.util.pool.Pool.create(Pool.java:348)
    at com.somecorp.util.pool.Pool.retain(Pool.java:169)
    at com.somecorp.util.pool.BoundedPool.retain(BoundedPool.java:137)
    at com.somecorp.util.pool.DatabaseConnectionPool.retainConnection(DatabaseConnectionPool.java:68)
    at com.somecorp.servlet.modservlet.db.DBModularServletContextFactory.loadContextBase(DBModularServletContextFactory.java:59)
    at com.somecorp.servlet.modservlet.db.DBModularServletContextFactory.getServletContext(DBModularServletContextFactory.java:46)
    at com.somecorp.servlet.modservlet.ModularServlet.init(ModularServlet.java:44)
    at com.somecorp.transaction.admin.SomeSoftwareAdminServlet.init(SomeSoftwtareAdminServlet.java:33)
    at javax.servlet.GenericServlet.init(GenericServlet.java:82)
    at com.caucho.server.http.Application.createServlet(Application.java:3114)
    at com.caucho.server.http.Application.loadServlet(Application.java:3065) at com.caucho.server.http.QServletConfig.loadServlet(QServletConfig.java:435)
    at com.caucho.server.http.Application.getFilterChainServlet(Application.java:2809)
    at com.caucho.server.http.Application.buildFilterChain(Application.java:2765)
    at com.caucho.server.http.Invocation.service(Invocation.java:313)
    at com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:135)
    at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:253)
    at com.caucho.server.http.HttpRequest.handleConnection(HttpRequest.java:170)
    at com.caucho.server.TcpConnection.run(TcpConnection.java:139)
    at java.lang.Thread.run(Thread.java:534)
    This is a Java servlet, running in resin. We're using the OCI drivers, Java2 SDK 1.4.2_11, on Solaris 9 x86 -- thick client version 10.1.0.3. Our database server is a RAC cluster, which is two Sparc boxes running Solaris 9 and 10gR2. I've done this:
    JAVA_SYSTEM="-J-hotspot -J-Xmx256M -J-Xss7m -J-Dfile.encoding=UTF-8 -J-Duser.language=en_US -J-Duser.country=US -J-Duser.region=US -J-Djava.library.path=$LD_LIBRARY_PATH -J-DGlobalProperties.filename=$INSTANCE_DIR/conf/global.properties.$HOSTNAME -J-DGatewayContext.host=secure.some.corp -J-DGatewayContext.port=4430 -J-DGatewayContext.merchantId=somesoftware-test -J-DGatewayContext.merchantKey=somesoftware-test-key -J-Dii.system.environment=test -J-Djava.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol -J-Djava.library.path=${ORACLE_HOME}/lib"
    JAVA_CLASSPATH=/usr/local/java/apps/resin/resin-ee-2.1.16/lib/dom.jar
    JAVA_CLASSPATH=${JAVA_CLASSPATH}:${ORACLE_HOME}/jdbc/lib/ojdbc14.jar
    JAVA_CLASSPATH=${JAVA_CLASSPATH}:/usr/local/java/apps/resin/resin-ee-2.1.16/lib/ejb.jar
    JAVA_CLASSPATH=${JAVA_CLASSPATH}:/usr/local/java/apps/resin/resin-ee-2.1.16/lib/jaxp.jar
    JAVA_CLASSPATH=${JAVA_CLASSPATH}:/usr/local/java/apps/resin/resin-ee-2.1.16/lib/jdbc-mysql.jar
    JAVA_CLASSPATH=${JAVA_CLASSPATH}:/usr/local/java/apps/resin/resin-ee-2.1.16/lib/jdbc2_0-stdext.jar
    JAVA_CLASSPATH=${JAVA_CLASSPATH}:/usr/local/java/apps/resin/resin-ee-2.1.16/lib/jms.jar
    JAVA_CLASSPATH=${JAVA_CLASSPATH}:/usr/local/java/apps/resin/resin-ee-2.1.16/lib/jmx.jar
    JAVA_CLASSPATH=${JAVA_CLASSPATH}:/usr/local/java/apps/resin/resin-ee-2.1.16/lib/jndi.jar
    JAVA_CLASSPATH=${JAVA_CLASSPATH}:/usr/local/java/apps/resin/resin-ee-2.1.16/lib/jta_101.jar
    JAVA_CLASSPATH=${JAVA_CLASSPATH}:/usr/local/java/apps/resin/resin-ee-2.1.16/lib/resin-ejb.jar
    JAVA_CLASSPATH=${JAVA_CLASSPATH}:/usr/local/java/apps/resin/resin-ee-2.1.16/lib/resin.jar
    JAVA_CLASSPATH=${JAVA_CLASSPATH}:/usr/local/java/apps/resin/resin-ee-2.1.16/lib/sax.jar
    JAVA_CLASSPATH=${JAVA_CLASSPATH}:/usr/local/java/apps/resin/resin-ee-2.1.16/lib/webutil.jar
    JAVA_CLASSPATH=${JAVA_CLASSPATH}:/usr/local/java/j2sdk1.4.2_11/lib/tools.jar
    JAVA_CLASSPATH=${JAVA_CLASSPATH}:/usr/local/java/j2sdk1.4.2_11/jre/lib/rt.jar
    JAVA_CLASSPATH=${JAVA_CLASSPATH}:/usr/local/java/apps/resin/resin-ee-2.1.16/lib/jsdk23.jar
    unset CLASSPATH
    unset LD_LIBRARY_PATH
    JAVA_HOME=/usr/local/java/j2sdk1.4.2_11
    export JAVA_HOME
    LD_LIBRARY_PATH=$JAVA_LD_LIBRARY_PATH
    LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${ORACLE_HOME}/lib
    export LD_LIBRARY_PATH
    <start java>
    Essentially, I set the LD_LIBRARY_PATH, make sure my user.country and user.language properties are set, include a known working version of ojdbc14.jar and everything should be happy, right? Except it's not.
    Our oracle connection string is:
    TDBConnectionPool.url=jdbc:oracle:oci:@someSID
    TDBConnectionPool.username=someuser
    TDBConnectionPool.password=somepassword
    TDBConnectionPool.targetSize=8
    TDBConnectionPool.maxSize=30
    Has anyone else run into this issue? Is this an issue I can take up with Oracle support?

    I'm pretty sure that it was this:
    # JAVA_SYSTEM="-J-hotspot -J-Xmx256M -J-Xss7m -J-Dfile.encoding=UTF-8 -J-Duser.language=en_US -J-Duser.country=US -J-Duser.region=US -J-DGatewayContext.host=some.corp -J-DGatewayContext.port=4430 -J-DGatewayContext.merchantId=somesoft-test -J-DGatewayContext.merchantKey=somesoft-test-key -J-Dii.system.environment=test -J-Djava.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol -J-Djava.library.path=${ORACLE_HOME}/lib"
    # Everything else is either somecorp specific or deprecated. user.region, etc.
    # probably isn't but we seem to get by.
    JAVA_SYSTEM="-J-Xmx256M -J-Xss7m -J-Dfile.encoding=UTF-8"

  • NullPointerException from oracle.jdbc.driver.OracleDriver.connect()

    I ran into an NPE when using Oracle thin client 11.1.0.6.0 (ojdbc6.jar) to connect to a 10g server. It is not easy to reproduce though. The following is the stack trace, any suggestions?
    java.lang.NullPointerException
    at java.util.Hashtable.get(Hashtable.java:334)
    at java.util.Properties.getProperty(Properties.java:932)
    at oracle.jdbc.driver.PhysicalConnection.parseConnectionProperty_String(PhysicalConnection.java:2037)
    at oracle.jdbc.driver.PhysicalConnection.parseConnectionProperty_int(PhysicalConnection.java:2072)
    at oracle.jdbc.driver.PhysicalConnection.readOCIConnectionPoolProperties(PhysicalConnection.java:1936)
    at oracle.jdbc.driver.PhysicalConnection.readConnectionProperties(PhysicalConnection.java:1927)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:471)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:202)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:474)
    at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:37)
    at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290)
    at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:877)
    at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:851)
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
    at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:113)
    at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:79)
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:382)
    at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:458)
    at com.verisign.uaservice.dbverify.dao.DBVerifyDAOImpl.getRecordAsPair(DBVerifyDAOImpl.java:255)
    at com.verisign.uaservice.dbverify.Verifier.verify(Verifier.java:37)
    at sun.reflect.GeneratedMethodAccessor54.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.util.MethodInvoker.invoke(MethodInvoker.java:276)
    at org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean$MethodInvokingJob.executeInternal(MethodInvokingJobDetailFactoryBean.java:260)
    at org.springframework.scheduling.quartz.QuartzJobBean.execute(QuartzJobBean.java:86)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:203)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520)

    What is the exact 10g version?
    According to MOS note 207303.1, for connection between 11g client and 10g server, there is a minimum version requirement on 10g server side.

  • Error oracle.sql.* and oracle.jdbc.driver.* not found when using oracle as a database

    I am using oracle as database and weblogic 4.5. I have copied the classes12.zip file in lib directory of weblogic. I am getting the error that oracle.sql.* and oracle.jdbc.driver.* not found when i am importing these packages in a jsp file. what i need to do to import oracle driver packages?I put it in the classpath also.
    Please Advice!
    Thanks in advance
    AnuPama

    Hi Anupama,
    First of all I would be surprised if you would not like to use the connection pooling feature of weblogic (in which case you might not be needing the import the classes directly), and would like to open direct connections to your database. Anyways for doing that I would recommend you to check out the readme doc that ships
    along with the jdbc oracle (classes12.zip etc). I am giving an excerpt over here:
    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();
    Hope this helps,
    Thanks,
    Anupama wrote:
    I am using oracle as database and weblogic 4.5. I have copied the classes12.zip file in lib directory of weblogic. I am getting the error that oracle.sql.* and oracle.jdbc.driver.* not found when i am importing these packages in a jsp file. what i need to do to import oracle driver packages?I put it in the classpath also.
    Please Advice!
    Thanks in advance
    AnuPama--
    Apurb Kumar

  • Bug in Oracle JDBC thin driver 8.1.6 ?

    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

    Horea
    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

  • Issue encountered when Login as sysdba role using Thin Oracle JDBC Driver

    Hello all,
    we are now considering to use Thin oracle JDBC driver to create database in our project, but we met one issue when we tried to connect to oracle as sysdba role using Thin driver, and it throws java.sql.SQLException: Io Exception: SO Exception was generated, I have found some tips on oracle jdbc website and it says :
    How do I connect as SYSDBA or SYSOPER?
    The only way to do this is to use the Properties object when connecting, rather than specifying the username and password as strings. Put the username into the "user" property, and the password into the "password" property. Then, put the mode into the "internal_logon" property. Something like the following:
    Properties props = new Properties();
    props.put("user", "scott");
    props.put("password", "tiger");
    props.put("internal_logon", "sysoper");
    Connection conn = DriverManager.getConnection (url, props);
    When connecting as SYSDBA or SYSOPER using the Thin driver, the RDBMS must be configured to use a password file. See "Creating and Maintaining a Password File" in the "Oracle Database Administrator's Guide".
    So, i did execute orapwd command to create a password file and also set remote_login_passwordfile=execlusive in my initxxx.ora initial parameter file, however, when i tried to connect, it failed.
    private static void createEmsdbDatabase(){
    String url = "jdbc:oracle:thin:@localhost:1521:";
    StringBuffer sqlStatement = new StringBuffer();
    sqlStatement.append("create database xxx");
    sqlStatement.append("maxdatafiles 254 ");
    sqlStatement.append("maxinstances 8 ");
    sqlStatement.append("maxlogfiles 32 ");
    sqlStatement.append("character set UTF8 ");
    sqlStatement.append("national character set UTF8 ");
    sqlStatement.append("DATAFILE 'c:\\oracle\\xxx\\system01.dbf' SIZE 18M REUSE ");
    sqlStatement.append("logfile 'c:\\oracle\\xxx\\redo01.log' SIZE 2M REUSE, ");
    sqlStatement.append("'c:\\oracle\\xxx\\redo02.log' SIZE 2M REUSE, ");
    sqlStatement.append("'c:\\oracle\\xxx\\redo03.log' SIZE 2M REUSE ");
    try {
    DriverManager.registerDriver(new OracleDriver());
    Properties props = new Properties();
    props.put("user", "sys");
    props.put("password", "password");
    props.put("database","xxx");
    props.put("internal_logon", "sysdba");
    Connection conn = DriverManager.getConnection(url, props);
    Statement statement = conn.createStatement();
    statement.executeUpdate(sqlStatement.toString());
    statement.close();
    conn.close();
    } catch (SQLException e) {
    e.printStackTrace();
    But what made me puzzled a lot is if i use OCI driver, it did work great, why??? guys, anybody knows, please give me some tips, thanks in advance.
    regards,
    Kaixuan @ Shanghai

    clarify my question in detail:
    Step 1 : create password file using orapwd command
    Step 2 : create database instance using oradim command
    Step 3 : login using sys as sysdba to startup database, e.g startup nomount pfile='...\initxxx.ora'
    Step 4 : create database.
    java code showing below:
    private static void createEmsdbDatabase(){
    String url = "jdbc:oracle:thin:@localhost:1521:";
    StringBuffer sqlStatement = new StringBuffer();
    sqlStatement.append("create database xxx ");
    sqlStatement.append("maxdatafiles 254 ");
    sqlStatement.append("maxinstances 8 ");
    sqlStatement.append("maxlogfiles 32 ");
    sqlStatement.append("character set UTF8 ");
    sqlStatement.append("national character set UTF8 ");
    sqlStatement.append("DATAFILE 'c:\\oracle\\xxx\\system01.dbf' SIZE 18M REUSE ");
    sqlStatement.append("logfile 'c:\\oracle\\xxx\\redo01.log' SIZE 2M REUSE, ");
    sqlStatement.append("'c:\\oracle\\xxx\\redo02.log' SIZE 2M REUSE, ");
    sqlStatement.append("'c:\\oracle\\xxx\\redo03.log' SIZE 2M REUSE ");
    try {
    DriverManager.registerDriver(new OracleDriver());
    Properties props = new Properties();
    props.put("user", "sys");
    props.put("password", "password");
    props.put("database","xxx");
    props.put("internal_logon", "sysdba");
    Connection conn = DriverManager.getConnection(url, props);
    Statement statement = conn.createStatement();
    statement.executeUpdate(sqlStatement.toString());
    statement.close();
    conn.close();
    } catch (SQLException e) {
    e.printStackTrace();
    issue was met here, when i tried to login as sysdba using sys, and in my java code, i use Thin driver, it then thrus exception, but when OCI driver is used, it works great, i don't know why.
    that is, when i use "jdbc:oracle:oci8:@" as database URL and then properties.put("database","xxx"), it works great. but, when i use "jdbc:oracle:thin:@localhost:1521:" as database URL and then properties.put("database","xxx"), it failed. hopefully, i have clarified my question clearly. thanks.

Maybe you are looking for