Error in preparedstatement

Hi
Is this preparedstatement valid
INSERT INTO TABLE2 (COL1,COL2,COL3,COL4)
SELECT C1,C2,?,? FROM TABLE1 WHERE condn
When I do con.prepareStatement() on this sql it is giving me error saying
"Use of parameter marker not valid"
Is this wrong??

Is this preparedstatement valid
INSERT INTO TABLE2 (COL1,COL2,COL3,COL4)
SELECT C1,C2,?,? FROM TABLE1 WHERE condnOn oracle, that PreparedStatement will compile, but setting the parameters to the column names does not produce the expected result. The Strings are treated as constants, not as column names.
If you set the parameters like this.
pstmt.setString(1,"C3");
pstmt.setString(2,"C4");
You get the effective SQL being
INSERT INTO TABLE2 (COL1,COL2,COL3,COL4)
SELECT C1,C2,'C3','C4' FROM TABLE1 WHERE condn
Could be different on other DBs.
-Scott
http://www.swiftradius.com

Similar Messages

  • JDBC error in PreparedStatement using TimesTen 6.0.3

    TimesTen supports this kind of sql statement
    select rows 3 to 5 * from products
    (it returns 2 rows started from row #3)
    I want to implement this in java thru JDBC
    PreparedStatement pstmt = con.prepareStatement(select rows ? to ? * from products);
    pstmt.setInt(1,3);
    pstmt.setInt(2,2);
    However, I got a JDBC error in the PreparedStatement line
    java.sql.SQLException: [TimesTen][TimesTen 6.0.3 ODBC Driver][TimesTen]TT1001: Syntax error in SQL statement before or at: "?", character position: 13 -- file "ptSqlY.y", lineno 1955, procedure "sbPtParseSql()"
    Anyone encounter this kind of error before? How to solve it?
    Thanks!
    Wellwin
    P.S. I am running this in Linux platform with JDBC driver come with TimesTen for java 1.4

    Hi Wellwin,
    Using SELECT ROWS m to n, you cannot parameterise m or n in order to provide them at execution time. They have to be explicitly stated as literals in the statement…
    If you need to use this with several different values for ‘m’ and ‘n’, there are a couple of options:
    1) Prepare (and subsequently execute) a different prepared statement for each combination of ‘m’ and ‘n’ that you need. This may be fine if there are only a small number of combinations but not a good choice if there are many combinations.
    2) Just use a regular SELECT (without the ROWS m TO n clause) and ‘skip’ the rows in the application code.
    Simon

  • What class should be imported to resolve the error

    Dear all,
    would you please tell me that what class should i import to resolve the error for PreparedStatement.
    plz mention the import statement
    Error(437,13): class PreparedStatement not found in class oracle.apps.ak.cacheoffice.server.CacheOfficeAMImpl

    import java.sql.PreparedStatement;

  • General error when accessing blob from oracle

    Hi
    I have successfully uploaded and saved images into oracle(8.1.5) table DATA_TYPE(dtid number, iconname varchar2(30), icon blob). When I try to retrieve icon from the database, I get "javax.servlet.ServletException: General error" at:
    PreparedStatement pstmt = myConnection.prepareStatement(mySQL);
    My code looks like this:
    imgModifyDataType.jsp
    <%
    ResultSet myResultSet = null;
    Statement myStatement = null;
    Connection myConnection = null;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    myConnection = DriverManager.getConnection("Jdbc:Odbc:Te","te","te");
    String iconName;
    String pDTID = request.getParameter("dtid");
    String mySQL = "Select iconname, icon from data_types where dtid=?";
    //Following statement throws general error exception
    PreparedStatement pstmt = myConnection.prepareStatement(mySQL);
    pstmt.setString(1,pDTID);
    myResultSet = pstmt.executeQuery();
    iconName = myResultSet.getString("iconname");
    myUpload.initialize(pageContext);
    myUpload.downloadField(myResultSet,"icon","application/x-msdownload", iconName);
    %>
    One more thing. The error occurs only when I try to execute query retrieving blob data. The same set of statements works fine for simple text or numbers.
    Please help

    When you read a BLOB with ORACLE,
    you have to lock the corresponding row.
    This means that...
    - the connection must not be in "AUTO COMMIT" mode
    - you have to do a "SELECT ... FOR UPDATE"

  • Error log related to SQL statement

    Hi SCNites,
    In sm21 there is a particular log related to SQL statement, ( error in preparedstatement ). based on this log, i checked the relavent Wp and found these statements.
    C Tue Jul 22 01:40:46 2014
    C  *** ERROR in prepareStatement[dbdb6.c, 15027] CON = 0 (BEGIN)
    C  &+     dsql_db6_exec( SQLExtendedPrepare ): [IBM][CLI Driver][DB2/NT64] SQL0204N  "SAPSID.DB2CLINETSTATS" is an undefined
    C  &+      name.  SQLSTATE=42704                                                                                   
    C  &+                                                                                                                    
    C  &+     DELETE FROM DB2CLINETSTATS WHERE intervalend < current timestamp - 7 days                                      
    C  &+       cursor type=NO_HOLD, isolation=UR, cc_release=YES, optlevel=5, degree=1, op_type=8, read_only=0              
    C  &+       ABAP location info: 'CL_SQL_STATEMENT==============CP', 975                                                  
    C  &+                                                                                                                    
    C  &+     ABAP location info 'CL_SQL_STATEMENT==============CP', 975                                                     
    C  &+                                                                                                                    
    C  *** ERROR in prepareStatement[dbdb6.c, 15027] (END) ".
    Could some tell me where exactly the error is triggering and how to troubleshoot this.
    Thanks in Advance
    Rgds,
    vamc.

    Hi Vamsi,
    Please have a look into solution described in SAP note
    Note 1706054 - DB6: Collector error SQL0204N SAPTOOLS.DBH_CURR_HOSTNAME
    Note 1554750 - DB6: SQL0204N when accessing a view over an existing table
    Hope this helps.
    Regards,
    Deepak Kori

  • Inserting strings over 2000 in length

    Hi,
    I'm trying to populate a database table which contains a long and
    I've been running into two Oracle errors:
    ORA-01462: cannot insert string literals longer than 2000
    characters
    and
    ORA-01489: result of string concatenation is too long
    Can someone point me to documentation or a solution of how you
    can get a 29k string into the database? I have code regarding how
    to use LOBs, but I'm unfamiliar with any stored procedures which
    will allow you to append to a long column with new content. I
    need to use long for the project I am working on.
    Thanks in advance for your help!
    Jill
    null

    Hi Ralf,
    If you read the documentation on
    http://java.sun.com/products/jdbc/index.html you will
    find a statement saying that the JdbcOdbcDriver is
    only for test and experimental use.Yes, but my and other's experiences with the JDBC-ODBC bridge itself are very well.
    Since it is only a bridge over the specific vendor's ODBC driver, you are limited to the capabilities of that.
    But the bridge is not to blame for this.
    For MS products you may reach efforts by updating to an actual MDAC version.
    Nethertheless, with MS ODBC there are some problems.
    Search the driver database (a link is on the above web
    page) for another (commercial) driver. I recommend the
    type 4 driver from i-net.Ok.
    Have you tried out that error David reported with the i-net driver?
    I use JDBC-ODBC with MS SQLServer 2000, actual MDAC, and I get that error with PreparedStatement.
    But it's all ok with a normal statement.
    So if you could test them both with the i-net driver, we would see if it's again the MS ODBC driver.
    Regards,
    Ralf SchumacherI think, I'm not the first you asks this:
    you are not the quick one we saw in Suzuka on Sunday, are you?

  • SQLException cannot be resolved to a type

    Can someone explain this error? It is a compile-time error on the SQLException in the throws statement. I want to go to the catch phrase in the calling routine, so instead of doing a try-catch clause in this routine, I am throwing the SQLException. I know SQLException is the right type to throw because if I remove the throws clause, then the compiler says "Unhandled exception type SQLException". Here is my code. Thanks in advance for your help.
    -Jeff
    public boolean LCExists(String LCID) throws SQLException {
         // No try catch here because I want caller to process error.
         PreparedStatement pst = Conn.prepareStatement("select LC_ID from ECLS_LOCAL_COUNSEL_MSTR where LC_ID='"+LCID+"'");
         ResultSet rSet =  pst.executeQuery();
         rSet.next();
         return false;
         }ANSWER: The problem was that I had not imported java.sql.SQLException;
    Message was edited by:
    JavaJeffrey

    Your code works fine for me (other than Conn not being defined). What error does the compiler give you?
    Maybe you could add the code where the method is called.
    Message was edited by:
    pthorson
    Well nevermind then

  • Display image from database with jspSmart

    Hi
    I have successfully uploaded and saved images into oracle(8.1.5) table DATA_TYPE(dtid number, iconname varchar2(30), icon blob). When I try to display a specific icon in my browser, I get "javax.servlet.ServletException: General error" at:
    PreparedStatement pstmt = myConnection.prepareStatement(mySQL);
    My code looks like this:
    imgModifyDataType.jsp
    <%
    ResultSet myResultSet = null;
    Statement myStatement = null;
    Connection myConnection = null;
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    myConnection = DriverManager.getConnection("Jdbc:Odbc:Te","te","te");
    String iconName;
    String pDTID = request.getParameter("dtid");
    String mySQL = "Select iconname, icon from data_types where dtid=?";
    PreparedStatement pstmt = myConnection.prepareStatement(mySQL);
    pstmt.setString(1,pDTID);
    myResultSet = pstmt.executeQuery();
    iconName = myResultSet.getString("iconname");
    myUpload.initialize(pageContext);
    myUpload.downloadField(myResultSet,"icon","application/x-msdownload", iconName);
    %>
    I call this JSP from another JSP like this:
    <img src="imgModifyDataType.jsp?dtid=<%=pDTID%>">
    If we cannt display image with the help of another jsp like this then please guide me how to modify the imgModifyDataType.jsp to a servlet because I have never worked in servlets.
    Please help
    Sajid

    I think that it may help you get image from database. I used two jsp page. First one is getphoto.jsp that makes as table based in sql statment and invoke the getimage.jsp this last returns images based on
    the getphoto.jsp PhotoId.
    /** getphoto.jsp source code */
    <%@page import="java.sql.*,oracle.jdbc.*"%>
    <html>
    <head>
    <title>
    jsp1
    </title>
    </head>
    <body bgcolor="#ffffff">
    <table width="781" border="2">
    <tr<<td>
    <td width="83" bgcolor="#C0C0C0"><b>PhotoId</b><td width="450" bgcolor="#C0C0C0"><b>Description</b></td><td width="228" bgcolor="#C0C0C0"><b>Photo Image</b></td>
    <%
    Connection conn = null;
    Statement stmt = null;
    ResultSet rset = null;
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    conn = DriverManager.getConnection("jdbc:oracle:thin:@itas:1521:oraITAS","yourDbUserId","yourDbPassword");
    stmt = conn.createStatement();
    rset = stmt.executeQuery("select photo_id,photo_description from photo");
    while (rset.next()) {
         %>
         <tr><td width="83"><%=rset.getObject("photo_id")%></td><td width="450"><%=rset.getObject("photo_description")%></td><td width="228"><img src="getimage.jsp?PhotoId=<%=rset.getObject("photo_id")%>" width="238" height="228"></td></tr>
         <%
    conn.close();
    %>
    </table>
    </body>
    </html>
    /** getimage.jsp source code */
    <%@ page contentType="image/jpeg; chaoResult=iso-8859-1" language="java" import="java.sql.*,java.io.*,java.util.*" errorPage="" %>
    <%
    String strConnString = null;
    Connection oDbConn;
    Statement oStmt;
    ResultSet oResult;
    String strConnection = null;
    String strUserId = "c_erober";
    String strUserPwd = "sybdev99";
    String strDatabase = "oraITAS";
    String strPhotoId;
    strConnString = "jdbc:odbc:" + strDatabase;
    String strSql;
    try {
    strPhotoId = (String) request.getParameter("PhotoId");
    strSql = "select photo_image from photo" + ( (strPhotoId==null) ? " where photo_id = '001'": (" where photo_id = '" + strPhotoId + "'") );
    DriverManager.registerDriver(new sun.jdbc.odbc.JdbcOdbcDriver());
    oDbConn = DriverManager.getConnection(strConnString,strUserId,strUserPwd);
    response.setContentType("image/jpeg");
    oStmt = oDbConn.createStatement();
    oResult = oStmt.executeQuery(strSql);
    oResult.next();
    byte[] bytearray = new byte[4096];
    int size=0;
    InputStream sImage;
    sImage = oResult.getBinaryStream(1);
    response.reset();
    response.setContentType("image/jpeg");
    response.addHeader("Content-Disposition","filename=getimage.jpeg");
    while((size=sImage.read(bytearray))!= -1 ) {
    response.getOutputStream().write(bytearray,0,size);
    response.flushBuffer();
    sImage.close();
    oDbConn.close();
    } catch (SQLException ex) { ex.getMessage();
    %>

  • Protocol

    Hi,
    I Am using the t3 protocol to connect to the server in the BEA weblogic, now
    I am porting my beans to IPLANET, now how can I make use of the Attached
    piece of java code, the file makes use of the table called "ts_lookup".
    java file
    package com.se.util;
    import javax.naming.*;
    import java.util.*;
    import javax.sql.*;
    import java.sql.*;
    import javax.ejb.EJBException;
    @author Author
    public class Lookup extends Object
    @roseuid 39EAE91F015B
    public static java.lang.Object getHomeObject(String lookUpID) throws
    java.rmi.RemoteException, EJBException
    Connection con = null;
    PreparedStatement ps = null;
    String initialContextFactory = null;
    String providerURL = null;
    String securityPrincipal = null;
    String securityCredentials = null;
    String jndiName = null;
    try {
    con = getConnection();
    ps = con.prepareStatement("SELECT * FROM tu_lookup WHERE lookUpID = ?");
    ps.setString(1, lookUpID);
    ResultSet rs = ps.executeQuery();
    file://ResultSet rs = ps.getResultSet();
    if (rs.next()) {
    initialContextFactory = rs.getString("initialContextFactory");
    providerURL = rs.getString("providerURL");
    securityPrincipal = rs.getString("securityPrincipal");
    securityCredentials = rs.getString("securityCredentials");
    jndiName = rs.getString("jndiName");
    } else {
    String error = lookUpID + " not found in table tu_lookup";
    System.out.println(error);
    throw new EJBException (error);
    } catch (SQLException sqe) {
    System.out.println("SQLException: " + sqe);
    throw new EJBException(sqe);
    finally {
    cleanup(con, ps);
    Object homeObj =null;
    try {
    // Get an InitialContext
    Properties h = new Properties();
    h.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
    h.put(Context.PROVIDER_URL, providerURL);
    if (securityPrincipal != null) {
    h.put(Context.SECURITY_PRINCIPAL, securityPrincipal);
    if (securityCredentials == null)
    securityCredentials = "";
    h.put(Context.SECURITY_CREDENTIALS, securityCredentials);
    Context ctx = new InitialContext(h);
    homeObj = ctx.lookup(jndiName);
    } catch (NamingException ne) {
    file://call the exception handler
    System.out.println("NamingException: " + ne);
    throw new EJBException(ne);
    return homeObj;
    * Gets current connection to the connection pool.
    * @return Connection
    * @exception javax.ejb.EJBException
    * if there is a communications or systems failure
    public static Connection getConnection()
    throws SQLException
    String poolName = null;
    InitialContext initCtx = null;
    try {
    ResourceBundle rs =
    ResourceBundle.getBundle("com.se.properties.Lookup");
    Hashtable p = new Hashtable();
    p.put(Context.INITIAL_CONTEXT_FACTORY,
    rs.getString("INITIAL_CONTEXT_FACTORY"));
    p.put(Context.PROVIDER_URL, rs.getString("PROVIDER_URL"));
    poolName = rs.getString("CONNECTION_POOL_NAME");
    initCtx = new InitialContext(p);
    DataSource ds = (javax.sql.DataSource) initCtx.lookup(poolName);
    return ds.getConnection();
    } catch(MissingResourceException mre) {
    System.out.println("UNABLE to find the Lookup.properties file");
    throw new EJBException(mre);
    } catch(NamingException ne) {
    System.out.println("UNABLE to get a connection from "+poolName+"!");
    System.out.println("Please make sure that you have setup the connection
    pool properly");
    throw new EJBException(ne);
    } finally {
    try {
    if(initCtx != null) initCtx.close();
    } catch(NamingException ne) {
    System.out.println("Error closing context: " + ne);
    throw new EJBException(ne);
    * Gets current connection to the connection pool.
    * @return Connection
    * @exception javax.ejb.EJBException
    * if there is a communications or systems failure
    public static Connection getConnection(String poolName)
    throws SQLException
    InitialContext initCtx = null;
    try {
    ResourceBundle rs =
    ResourceBundle.getBundle("com.se.properties.Lookup");
    Hashtable p = new Hashtable();
    p.put(Context.INITIAL_CONTEXT_FACTORY,
    rs.getString("INITIAL_CONTEXT_FACTORY"));
    p.put(Context.PROVIDER_URL, rs.getString("PROVIDER_URL"));
    initCtx = new InitialContext(p);
    DataSource ds = (javax.sql.DataSource) initCtx.lookup(poolName);
    return ds.getConnection();
    } catch(MissingResourceException mre) {
    System.out.println("UNABLE to find the Lookup.properties file");
    throw new EJBException(mre);
    } catch(NamingException ne) {
    System.out.println("UNABLE to get a connection from "+poolName+"!");
    System.out.println("Please make sure that you have setup the connection
    pool properly");
    throw new EJBException(ne);
    } finally {
    try {
    if(initCtx != null) initCtx.close();
    } catch(NamingException ne) {
    System.out.println("Error closing context: " + ne);
    throw new EJBException(ne);
    public static void cleanup(Connection con, PreparedStatement ps) {
    // Having problems with ps.close.
    /*try {
    if (ps != null) ps.close();
    } catch (Exception e) {
    System.out.println("Error closing PreparedStatement: "+e);
    throw new EJBException (e);
    try {
    if (con != null) con.close();
    } catch (Exception e) {
    System.out.println("Error closing Connection: " + e);
    throw new EJBException (e);
    The structure of the ts_lookup is like this
    CREATE TABLE tu_lookup (
    lookUpID char(30) NOT NULL ,
    initialContextFactory varchar (100) NOT NULL ,
    providerURL varchar (100) NOT NULL ,
    securityPrincipal varchar (15) NULL ,
    securityCredentials varchar (15) NULL ,
    jndiName varchar (25) NOT NULL
    sample data row for the above table is like this
    ItemHome weblogic.jndi.WLInitialContextFactory
    t3://208.28.177.22:7001 ItemHome
    UnitMasterHome weblogic.jndi.WLInitialContextFactory
    t3://208.28.177.22:7001 UnitMasterHome
    ShowColumnsHome weblogic.jndi.WLInitialContextFactory
    t3://208.28.177.22:7001 ShowColumnsHome
    CustomerHome weblogic.jndi.WLInitialContextFactory
    t3://208.28.177.22:7001 CustomerHome
    CompanyHome weblogic.jndi.WLInitialContextFactory
    t3://208.28.177.22:7001 CompanyHome
    CountryHome weblogic.jndi.WLInitialContextFactory
    t3://208.28.177.22:7001 CountryHome
    CustomerMasterHome weblogic.jndi.WLInitialContextFactory
    t3://208.28.177.22:7001 CustomerMasterHome

    http://en.wikipedia.org/wiki/User_Datagram_Protocol
    http://en.wikipedia.org/wiki/Inter-process_communication
    http://en.wikipedia.org/wiki/Infiniband
    For your RAC question please refer to the Remote Application Clusters Concepts and Administration Manual for your unknown version.
    Also please make sure you do the necessary prior to asking these questions!
    Sybrand Bakker
    Senior Oracle DBA

  • Closing data connection

    My program connects to a SQL database that I connect to on port 23 because outgoing connections to port 3306 are blocked from work.
    In my Database class I have this:
    public static Connection sqlConnection ()
            Connection connection = null;
            String serverName = null;
            String mydatabase = null;
            String url = null;
            String dbuser = null;
            String dbpass = null;
            String port = "23";
            try
                System.out.println ("Trying port " + port + "...");
                String driverName = "com.mysql.jdbc.Driver";
                Class.forName (driverName);
                serverName = "server_address";
                mydatabase = "database";
                url = "jdbc:mysql://" + serverName + ":" + port +  "/" + mydatabase;
                //url = "jdbc:mysql://" + serverName + "/" + mydatabase; // a JDBC url
                dbuser = "user";
                dbpass = "pass";
                connection = DriverManager.getConnection (url, dbuser, dbpass);
            catch (SQLException e)
                // Could not connect to the database
                JOptionPane.showMessageDialog (null,"<b>Unable to connect to the database.</b>\n\nPlease check your network connection."
                        + "Contact the administrator if the problem persists.", "Connection Error",
                        JOptionPane.ERROR_MESSAGE);
                System.out.println ("Error: " + e.getMessage ());
            catch (ClassNotFoundException e)
                // Could not find the database driver
                System.out.println ("Error: " + e.getMessage ());
                JOptionPane.showMessageDialog (null,"Could not find the database driver.", "Connection Error",
                        JOptionPane.ERROR_MESSAGE);
            return connection;
        }From my other classes I call the connection by using:
    Connection connection = Database.sqlConnection ();and close my connection with:
    connection.close (); System.out.println ("Connection closed.");This way in my console I can see when the connection is opening and closing.
    run:
    java.awt.Dimension[width=0,height=0]
    Trying port 23...
    6
    Tristan Lee
    [email protected]
    1
    2
    0
    2
    0
    Connection closed.
    Trying port 23...
    Connection closed.
    Trying port 23...
    Connection closed.
    Trying port 23...
    Connection closed.
    Trying port 23...
    Connection closed.When I use netstat to view my current connections, they still show a connection that, to me, looks like a connection that's staying open until it simply times out.
    [tristan@tristan ~]$ netstat
    Active Internet connections (w/o servers)
    Proto Recv-Q Send-Q Local Address               Foreign Address             State
    tcp        0    115 192.168.1.110:59820         205.188.9.53:aol            ESTABLISHED
    tcp        0      0 192.168.1.110:39436         64.12.31.96:aol             ESTABLISHED
    tcp        0    280 192.168.1.110:60949         cs8.msg.dcn.yahoo.com:mmcc  ESTABLISHED
    tcp        0     70 192.168.1.110:40097         by1msg5276706.phx.gbl:msnp  ESTABLISHED
    tcp        0      0 192.168.1.110:49336         oam-m07b.blue.aol.com:aol   ESTABLISHED
    tcp        0      0 ::ffff:192.168.1.110:43641  cpe-24-95-42-77.colu:telnet TIME_WAIT
    tcp        0      0 ::ffff:192.168.1.110:60616  cpe-24-95-42-77.colu:telnet TIME_WAIT
    tcp        0      0 ::1:36998                   ::1:38330                   TIME_WAIT
    tcp        0      0 ::ffff:192.168.1.110:51197  cpe-24-95-42-77.colu:telnet TIME_WAIT
    tcp        0      0 ::ffff:192.168.1.110:53461  cpe-24-95-42-77.colu:telnet TIME_WAIT
    tcp        0      0 ::ffff:192.168.1.110:37406  cpe-24-95-42-77.colu:telnet TIME_WAITWhy aren't my connections being closed?

    I know port 23 is for Telnet. The program runs at work and accesses a MySQL database from my house. Because I can't connect to port 3306 from work, Telnet connections are allowed so my program uses port 23 which my router forwards to port 3306 of my server, which works.
    I changed my code a bit because I noticed that I'm not closing my ResultSets, Statements, and PreparedStatements. Now I have the following in my Database class:
    public static void closeConnection (Connection connection)
            try
                connection.close ();
            catch(Exception e)
                System.out.println("Error closing connection:\n\n" + e);
        public static void closeStatement (Statement stmt)
            try
                stmt.close ();
            catch(Exception e)
                System.out.println("Error closing statement:\n\n" + e);
        public static void closePreparedStatement (PreparedStatement pstmt)
            try
                pstmt.close ();
            catch(Exception e)
                System.out.println("Error closing PreparedStatement:\n\n" + e);
        public static void closeResultSet (ResultSet rs)
            try
                rs.close ();
            catch(Exception e)
                System.out.println("Error closing ResultSet:\n\n" + e);
        }And then in my blocks where I'm connecting to the database I am using the following to close the connections:
                    Database.closeResultSet (rs);
                    Database.closePreparedStatement (pstmt);
                    Database.closeStatement (stmt);
                    Database.closeConnection (connection);
                    System.out.println ("Connection closed.");Does this look better?

  • T3://............

    Hi,
    I Am using the t3 protocol to connect to the server in the BEA weblogic, now
    I am porting my beans to IPLANET, now how can I make use of the Attached
    piece of java code, the file makes use of the table called "ts_lookup".
    java file
    package com.se.util;
    import javax.naming.*;
    import java.util.*;
    import javax.sql.*;
    import java.sql.*;
    import javax.ejb.EJBException;
    @author Author
    public class Lookup extends Object
    @roseuid 39EAE91F015B
    public static java.lang.Object getHomeObject(String lookUpID) throws
    java.rmi.RemoteException, EJBException
    Connection con = null;
    PreparedStatement ps = null;
    String initialContextFactory = null;
    String providerURL = null;
    String securityPrincipal = null;
    String securityCredentials = null;
    String jndiName = null;
    try {
    con = getConnection();
    ps = con.prepareStatement("SELECT * FROM tu_lookup WHERE lookUpID = ?");
    ps.setString(1, lookUpID);
    ResultSet rs = ps.executeQuery();
    file://ResultSet rs = ps.getResultSet();
    if (rs.next()) {
    initialContextFactory = rs.getString("initialContextFactory");
    providerURL = rs.getString("providerURL");
    securityPrincipal = rs.getString("securityPrincipal");
    securityCredentials = rs.getString("securityCredentials");
    jndiName = rs.getString("jndiName");
    } else {
    String error = lookUpID + " not found in table tu_lookup";
    System.out.println(error);
    throw new EJBException (error);
    } catch (SQLException sqe) {
    System.out.println("SQLException: " + sqe);
    throw new EJBException(sqe);
    finally {
    cleanup(con, ps);
    Object homeObj =null;
    try {
    // Get an InitialContext
    Properties h = new Properties();
    h.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
    h.put(Context.PROVIDER_URL, providerURL);
    if (securityPrincipal != null) {
    h.put(Context.SECURITY_PRINCIPAL, securityPrincipal);
    if (securityCredentials == null)
    securityCredentials = "";
    h.put(Context.SECURITY_CREDENTIALS, securityCredentials);
    Context ctx = new InitialContext(h);
    homeObj = ctx.lookup(jndiName);
    } catch (NamingException ne) {
    file://call the exception handler
    System.out.println("NamingException: " + ne);
    throw new EJBException(ne);
    return homeObj;
    * Gets current connection to the connection pool.
    * @return Connection
    * @exception javax.ejb.EJBException
    * if there is a communications or systems failure
    public static Connection getConnection()
    throws SQLException
    String poolName = null;
    InitialContext initCtx = null;
    try {
    ResourceBundle rs =
    ResourceBundle.getBundle("com.se.properties.Lookup");
    Hashtable p = new Hashtable();
    p.put(Context.INITIAL_CONTEXT_FACTORY,
    rs.getString("INITIAL_CONTEXT_FACTORY"));
    p.put(Context.PROVIDER_URL, rs.getString("PROVIDER_URL"));
    poolName = rs.getString("CONNECTION_POOL_NAME");
    initCtx = new InitialContext(p);
    DataSource ds = (javax.sql.DataSource) initCtx.lookup(poolName);
    return ds.getConnection();
    } catch(MissingResourceException mre) {
    System.out.println("UNABLE to find the Lookup.properties file");
    throw new EJBException(mre);
    } catch(NamingException ne) {
    System.out.println("UNABLE to get a connection from "+poolName+"!");
    System.out.println("Please make sure that you have setup the connection
    pool properly");
    throw new EJBException(ne);
    } finally {
    try {
    if(initCtx != null) initCtx.close();
    } catch(NamingException ne) {
    System.out.println("Error closing context: " + ne);
    throw new EJBException(ne);
    * Gets current connection to the connection pool.
    * @return Connection
    * @exception javax.ejb.EJBException
    * if there is a communications or systems failure
    public static Connection getConnection(String poolName)
    throws SQLException
    InitialContext initCtx = null;
    try {
    ResourceBundle rs =
    ResourceBundle.getBundle("com.se.properties.Lookup");
    Hashtable p = new Hashtable();
    p.put(Context.INITIAL_CONTEXT_FACTORY,
    rs.getString("INITIAL_CONTEXT_FACTORY"));
    p.put(Context.PROVIDER_URL, rs.getString("PROVIDER_URL"));
    initCtx = new InitialContext(p);
    DataSource ds = (javax.sql.DataSource) initCtx.lookup(poolName);
    return ds.getConnection();
    } catch(MissingResourceException mre) {
    System.out.println("UNABLE to find the Lookup.properties file");
    throw new EJBException(mre);
    } catch(NamingException ne) {
    System.out.println("UNABLE to get a connection from "+poolName+"!");
    System.out.println("Please make sure that you have setup the connection
    pool properly");
    throw new EJBException(ne);
    } finally {
    try {
    if(initCtx != null) initCtx.close();
    } catch(NamingException ne) {
    System.out.println("Error closing context: " + ne);
    throw new EJBException(ne);
    public static void cleanup(Connection con, PreparedStatement ps) {
    // Having problems with ps.close.
    /*try {
    if (ps != null) ps.close();
    } catch (Exception e) {
    System.out.println("Error closing PreparedStatement: "+e);
    throw new EJBException (e);
    try {
    if (con != null) con.close();
    } catch (Exception e) {
    System.out.println("Error closing Connection: " + e);
    throw new EJBException (e);
    The structure of the ts_lookup is like this
    CREATE TABLE tu_lookup (
    lookUpID char(30) NOT NULL ,
    initialContextFactory varchar (100) NOT NULL ,
    providerURL varchar (100) NOT NULL ,
    securityPrincipal varchar (15) NULL ,
    securityCredentials varchar (15) NULL ,
    jndiName varchar (25) NOT NULL
    sample data row for the above table is like this
    ItemHome weblogic.jndi.WLInitialContextFactory
    t3://208.28.177.22:7001 ItemHome
    UnitMasterHome weblogic.jndi.WLInitialContextFactory
    t3://208.28.177.22:7001 UnitMasterHome
    ShowColumnsHome weblogic.jndi.WLInitialContextFactory
    t3://208.28.177.22:7001 ShowColumnsHome
    CustomerHome weblogic.jndi.WLInitialContextFactory
    t3://208.28.177.22:7001 CustomerHome
    CompanyHome weblogic.jndi.WLInitialContextFactory
    t3://208.28.177.22:7001 CompanyHome
    CountryHome weblogic.jndi.WLInitialContextFactory
    t3://208.28.177.22:7001 CountryHome
    CustomerMasterHome weblogic.jndi.WLInitialContextFactory
    t3://208.28.177.22:7001 CustomerMasterHome

    Hi Stephen,
    On the surface this doesn't look like a webservice problem. I would
    suggest you run this by our support team: [email protected] or
    http://support.bea.com
    Bruce
    Also, make sure you are at the latest service pack:
    http://commerce.bea.com/showproduct.jsp?family=WLP&major=7.0&minor=2
    Stephen Zeng wrote:
    >
    I use wsl7.0. My client call has getten into Weblogic webservice, the log has
    printed out request from client. The log also show I can not get jdbc datasource
    from jndi. I have tried restart machine. Error is same.
    What should I do?
    Stephen
    <2003-6-13 ÉÏÎç09ʱ58·Ö02Ãë> <Error> <socket> <000413> <Failure in processSocket
    s() - GetData: weblogic.socket.NTSocketMuxer$GetData - fd: '2404', numBytes: '20
    26'
    weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ bootstrapping thro
    ugh loopback ]
    weblogic.utils.AssertionError: ***** ASSERTION FAILED *****[ bootstrapping throu
    gh loopback ]
    at weblogic.utils.Debug.assertion(Debug.java:84)
    at weblogic.rjvm.ConnectionManagerServer.handleIdentifyResponse(Connecti
    onManagerServer.java:391)
    at weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:691)
    at weblogic.rjvm.t3.T3JVMConnection.dispatch(T3JVMConnection.java:488)
    at weblogic.socket.NTSocketMuxer.processSockets(NTSocketMuxer.java:667)
    at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:
    23)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
    javax.naming.CommunicationException. Root exception is java.net.ConnectExcepti
    n: t3://10.1.2.233:7001: Bootstrap to: 'etcsl/10.1.2.233:7001' over: 't3' got
    a
    error or timed out

  • IPLANET AND WEBLOGIC

    Hi,
    I Am using the t3 protocol to connect to the server in the BEA weblogic, now
    I am porting my beans to IPLANET, now how can I make use of the Attached
    piece of java code, the file makes use of the table called "ts_lookup".
    java file
    package com.se.util;
    import javax.naming.*;
    import java.util.*;
    import javax.sql.*;
    import java.sql.*;
    import javax.ejb.EJBException;
    @author Author
    public class Lookup extends Object
    @roseuid 39EAE91F015B
    public static java.lang.Object getHomeObject(String lookUpID) throws
    java.rmi.RemoteException, EJBException
    Connection con = null;
    PreparedStatement ps = null;
    String initialContextFactory = null;
    String providerURL = null;
    String securityPrincipal = null;
    String securityCredentials = null;
    String jndiName = null;
    try {
    con = getConnection();
    ps = con.prepareStatement("SELECT * FROM tu_lookup WHERE lookUpID = ?");
    ps.setString(1, lookUpID);
    ResultSet rs = ps.executeQuery();
    file://ResultSet rs = ps.getResultSet();
    if (rs.next()) {
    initialContextFactory = rs.getString("initialContextFactory");
    providerURL = rs.getString("providerURL");
    securityPrincipal = rs.getString("securityPrincipal");
    securityCredentials = rs.getString("securityCredentials");
    jndiName = rs.getString("jndiName");
    } else {
    String error = lookUpID + " not found in table tu_lookup";
    System.out.println(error);
    throw new EJBException (error);
    } catch (SQLException sqe) {
    System.out.println("SQLException: " + sqe);
    throw new EJBException(sqe);
    finally {
    cleanup(con, ps);
    Object homeObj =null;
    try {
    // Get an InitialContext
    Properties h = new Properties();
    h.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory);
    h.put(Context.PROVIDER_URL, providerURL);
    if (securityPrincipal != null) {
    h.put(Context.SECURITY_PRINCIPAL, securityPrincipal);
    if (securityCredentials == null)
    securityCredentials = "";
    h.put(Context.SECURITY_CREDENTIALS, securityCredentials);
    Context ctx = new InitialContext(h);
    homeObj = ctx.lookup(jndiName);
    } catch (NamingException ne) {
    file://call the exception handler
    System.out.println("NamingException: " + ne);
    throw new EJBException(ne);
    return homeObj;
    * Gets current connection to the connection pool.
    * @return Connection
    * @exception javax.ejb.EJBException
    * if there is a communications or systems failure
    public static Connection getConnection()
    throws SQLException
    String poolName = null;
    InitialContext initCtx = null;
    try {
    ResourceBundle rs =
    ResourceBundle.getBundle("com.se.properties.Lookup");
    Hashtable p = new Hashtable();
    p.put(Context.INITIAL_CONTEXT_FACTORY,
    rs.getString("INITIAL_CONTEXT_FACTORY"));
    p.put(Context.PROVIDER_URL, rs.getString("PROVIDER_URL"));
    poolName = rs.getString("CONNECTION_POOL_NAME");
    initCtx = new InitialContext(p);
    DataSource ds = (javax.sql.DataSource) initCtx.lookup(poolName);
    return ds.getConnection();
    } catch(MissingResourceException mre) {
    System.out.println("UNABLE to find the Lookup.properties file");
    throw new EJBException(mre);
    } catch(NamingException ne) {
    System.out.println("UNABLE to get a connection from "+poolName+"!");
    System.out.println("Please make sure that you have setup the connection
    pool properly");
    throw new EJBException(ne);
    } finally {
    try {
    if(initCtx != null) initCtx.close();
    } catch(NamingException ne) {
    System.out.println("Error closing context: " + ne);
    throw new EJBException(ne);
    * Gets current connection to the connection pool.
    * @return Connection
    * @exception javax.ejb.EJBException
    * if there is a communications or systems failure
    public static Connection getConnection(String poolName)
    throws SQLException
    InitialContext initCtx = null;
    try {
    ResourceBundle rs =
    ResourceBundle.getBundle("com.se.properties.Lookup");
    Hashtable p = new Hashtable();
    p.put(Context.INITIAL_CONTEXT_FACTORY,
    rs.getString("INITIAL_CONTEXT_FACTORY"));
    p.put(Context.PROVIDER_URL, rs.getString("PROVIDER_URL"));
    initCtx = new InitialContext(p);
    DataSource ds = (javax.sql.DataSource) initCtx.lookup(poolName);
    return ds.getConnection();
    } catch(MissingResourceException mre) {
    System.out.println("UNABLE to find the Lookup.properties file");
    throw new EJBException(mre);
    } catch(NamingException ne) {
    System.out.println("UNABLE to get a connection from "+poolName+"!");
    System.out.println("Please make sure that you have setup the connection
    pool properly");
    throw new EJBException(ne);
    } finally {
    try {
    if(initCtx != null) initCtx.close();
    } catch(NamingException ne) {
    System.out.println("Error closing context: " + ne);
    throw new EJBException(ne);
    public static void cleanup(Connection con, PreparedStatement ps) {
    // Having problems with ps.close.
    /*try {
    if (ps != null) ps.close();
    } catch (Exception e) {
    System.out.println("Error closing PreparedStatement: "+e);
    throw new EJBException (e);
    try {
    if (con != null) con.close();
    } catch (Exception e) {
    System.out.println("Error closing Connection: " + e);
    throw new EJBException (e);
    The structure of the ts_lookup is like this
    CREATE TABLE tu_lookup (
    lookUpID char(30) NOT NULL ,
    initialContextFactory varchar (100) NOT NULL ,
    providerURL varchar (100) NOT NULL ,
    securityPrincipal varchar (15) NULL ,
    securityCredentials varchar (15) NULL ,
    jndiName varchar (25) NOT NULL
    sample data row for the above table is like this
    ItemHome weblogic.jndi.WLInitialContextFactory
    t3://208.28.177.22:7001 ItemHome
    UnitMasterHome weblogic.jndi.WLInitialContextFactory
    t3://208.28.177.22:7001 UnitMasterHome
    ShowColumnsHome weblogic.jndi.WLInitialContextFactory
    t3://208.28.177.22:7001 ShowColumnsHome
    CustomerHome weblogic.jndi.WLInitialContextFactory
    t3://208.28.177.22:7001 CustomerHome
    CompanyHome weblogic.jndi.WLInitialContextFactory
    t3://208.28.177.22:7001 CompanyHome
    CountryHome weblogic.jndi.WLInitialContextFactory
    t3://208.28.177.22:7001 CountryHome
    CustomerMasterHome weblogic.jndi.WLInitialContextFactory
    t3://208.28.177.22:7001 CustomerMasterHome

    I don't know exactly what you want to achieve, but can't you just check it in the log or check the open connections with 'netstat' which shows you which connections are open
    Schelstraete Bart
    [email protected]
    http://www.schelstraete.org
    http://www.linkedin.com/in/bschelst

  • PreparedStatment creating Syntax Error.

    The poblem is in the first prepared statment if I enter the value straight into the statement string everying works fine. However, when I use a ? for placeholder and then supply the same sting value i would have entered in the statement string I get a sytax error.
    import java.sql.*; import javax.swing.*; import java.awt.BorderLayout; import java.awt.event.*; public class Exercise34_5 extends JFrame { private JTextField jtfInput = new JTextField(10); private JButton jbShowTable = new JButton("Show Table"); private JTextArea jta = new JTextArea(); private PreparedStatement pstmt1; private PreparedStatement pstmt2; private PreparedStatement pstmt3; public Exercise34_5() { JPanel northPanel = new JPanel(); northPanel.add(new JLabel("Table Name")); northPanel.add(jtfInput); northPanel.add(jbShowTable); add(northPanel, BorderLayout.NORTH); add(new JScrollPane(jta)); try { Class.forName("com.mysql.jdbc.Driver"); Connection connection = DriverManager.getConnection("jdbc:mysql://localhost/test" , "root", "root"); pstmt1 = connection.prepareStatement("describe ?"); pstmt2 = connection.prepareStatement("select count(*) from enrollment"); pstmt3 = connection.prepareStatement("select * from enrollment"); }catch(Exception ex) { ex.printStackTrace(); } jbShowTable.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String table = jtfInput.getText(); try{ pstmt1.setString(1, "enrollment"); /*pstmt2.setString(1, "enrollment"); pstmt3.setString(1, "enrollment");*/ ResultSet rset1 = pstmt1.executeQuery(); ResultSet rset3 = pstmt3.executeQuery(); int count = 0; while(rset1.next()) { jta.append(rset1.getString(1) + "\t"); count++; } jta.append("\n"); System.out.println(count); while(rset3.next()) { for(int i = 1; i <= count; i++) { jta.append(rset3.getString(i) + "\t"); } jta.append("\n"); } }catch(Exception ex) { ex.printStackTrace(); } } }); } public static void main(String[] args) { Exercise34_5 frame = new Exercise34_5(); frame.setSize(400, 200); frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); frame.setVisible(true); } }
    java.sql.SQLException: Syntax error or access violation message from server: "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 ''enrollment'' at line 1"
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:1997)
    at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1167)
    at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1278)
    at com.mysql.jdbc.Connection.execSQL(Connection.java:2251)
    at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1586)
    at Exercise34_5$1.actionPerformed(Exercise34_5.java:47)

    Alyosha wrote:
    I don't understand.You can't just put a ? parameter any old place in a prepared statement. It's just just a simple string substitution. For instance, you cannot use a ? parameter for a table name or a column name.
    // wrong
    ps = conn.prepareStatement("select * from ? where ? = ?");
    ps.setString(1, tableName);
    ps.setString(2, columnName);
    ps.setString(3, columnValue);
    // right
    ps = conn.prepareStatement("select * from " + tableName = " where " + columnName + " = ?");
    ps.setString(1, columnValue);

  • A question about PreparedStatement and ORA-03115 error

    Dear all,
    I have an issue with JDBC and I would appreciate if you could kindly give me a hand.
    I'm using:
    - Oracle Database 11g Enterprise (Release 11.1.0.6.0)
    - JDBC thin driver version: ( 11.1.0.7.0-Production)
    - JDK 1.6
    - Operating system: Linux (Ubuntu 8.10)
    Here is my code
    import java.sql.*;
    public class Main
        public static void main(String[] args)
            String dbURL = "jdbc:oracle:thin:@localhost:1521:mydatabase";
            String username = "scott";
            String user_password = "tiger";
            try
                Connection connection = DriverManager.getConnection(dbURL, username, user_password);
                String query_text = "SELECT * FROM mytable";
                Statement statement = connection.createStatement();
                ResultSet query_result = statement.executeQuery(query_text);
                connection.close();
            catch (SQLException e)
                for (Throwable t: e)
                    t.printStackTrace();
    }This works pretty well without any problem. But when I want to use PreparedStatement instead of Statement I receive the ORA-03115 error message, that is, when I replace the Statement with PreparedStatement in the following way:
    String query_text =
            "SELECT first_name, ?, id, ?, job_title, salary  FROM mytable "+
            "WHERE id IN ('id14', ?, 'id17', 'id18')";
    PreparedStatement prepared_statement =  connection.preparedStatement(query_text);
    prepared_statement.setString(1, "last_name");
    prepared_statement.setString(2, "birthday");
    prepared_statement.setString(3, "id02");
    ResultSet query_result = prepared_statement.executeQuery(query_text);I get the following:
    java.sql.SQLException: ORA-03115: unsupported network datatype or representation
         at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
         at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:133)
         at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:206)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
         at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
         at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1034)
         at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:194)
         at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:791)
         at oracle.jdbc.driver.T4CPreparedStatement.executeMaybeDescribe(T4CPreparedStatement.java:866)
         at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1186)
         at oracle.jdbc.driver.OracleStatement.executeQuery(OracleStatement.java:1377)
         at oracle.jdbc.driver.OracleStatementWrapper.executeQuery(OracleStatementWrapper.java:387)
         at mysqlpackage.Main.main(Main.java:33)Therefore, right after
    ResultSet query_result = prepared_statement.executeQuery(query_text);the exception is thrown,
    why it works with Statement but not with PreparedStatement? I tested with several other queries, insert a new row, delete a row, everytime it works well, but when I want to use PreparedStatement instead of Statement, again I have this error message.
    Any idea?
    Thanks in advance,

    OK, I found myself the answer.
    First error, I had use ? also for column names, which is not accepted as the SQL query has to be precompiled.
    Second error: Instead of writing
    ResultSet query_result =  prepared_statement.executeQuery(query_text);I had to write:
    ResultSet query_result =  prepared_statement.executeQuery();I tested with the following
    String query_text =
                  "SELECT first_name, last_name, id, birthday, job_title, salary "+
                  "FROM myenterprise "+
                  "WHERE id IN (?, ?, ?, ?) ";
                PreparedStatement prepared_statement =
                        connection.prepareStatement(query_text);
                prepared_statement.setString(1, "id02");
                prepared_statement.setString(2, "id04");
                prepared_statement.setString(3, "id08");
                prepared_statement.setString(4, "id09");
                ResultSet query_result =  prepared_statement.executeQuery();And it works pretty well now! :)

  • Error IllegalArgumentException in java.sql.Date used PreparedStatement

    I'm found bug (probably). I have a table with column DATA type. Now I connect do database use JDBC in Java, and create PreparedStatement:
    PreparedStatement stmt = conn.prepareStatement("insert into \"Appuser\" (\"IDUser\", \"createAccountDate\") values (?,?)");
    Column createAccountDate is a DATA type. And now I invoke:
    stmt.setInt(1, 1);
    stmt.setInt(2, new java.sql.Date(-2508265596206959779));
    stmt.execute();
    and last line return exception:
    java.lang.IllegalArgumentException
    at sun.util.calendar.ZoneInfo.getOffset(ZoneInfo.java:368)
    at oracle.jdbc.driver.DateCommonBinder.zoneOffset(OraclePreparedStatement.java:15423)
    at oracle.jdbc.driver.DateCommonBinder.setOracleCYMD(OraclePreparedStatement.java:15561)
    at oracle.jdbc.driver.DateBinder.bind(OraclePreparedStatement.java:15641)
    at oracle.jdbc.driver.OraclePreparedStatement.setupBindBuffers(OraclePreparedStatement.java:2866)
    at oracle.jdbc.driver.OraclePreparedStatement.processCompletedBindRow(OraclePreparedStatement.java:2151)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3280)
    at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3390)
    at // line stmt.execute();
    Another values of Data are OK. Probably value -2508265596206959779 cause that error.
    It's a bug? Better will be SQLException if it is a bug.
    My configuration:
    Oracle Database 10g Express Edition Release 10.2.0.1.0 - Product
    PL/SQL Release 10.2.0.1.0 - Production
    CORE     10.2.0.1.0     Production
    TNS for 32-bit Windows: Version 10.2.0.1.0 - Production
    NLSRTL Version 10.2.0.1.0 - Production
    Windows XP SP3, Java 1.6.0_20,
    ojdbc14.jar, Oracle JDBC Driver version - "10.2.0.1.0XE

    Probably value -2508265596206959779 cause that errorMaybe, whatever that .date( -ReallyLotsOfmSec ) date values is, pretty sure its outside the valid values for a date column, 4712BC to 9999AD is the min/max.
    Perhaps the java code can handle it, an oracle date type can not.

Maybe you are looking for