Jdbc connectivity using type 4 driver using oracle10g

Hi while running a jdbc program using type 4 driver using oracle 10 g I am Getting following exception
java.lang.NullPointerException
java.lang.NullPointerException
at Type4ConnectTest.main(Type4ConnectTest.java:31)
Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.driver.
OracleDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:169)
at Type4ConnectTest.main(Type4ConnectTest.java:15)
My Program Code is..
import java.sql.*;
class Type4ConnectTest
public static void main(String args[])throws Exception
Connection con=null;
Statement st=null;
ResultSet rs=null;
try
// DriverManager.registerDriver(new Oracle:jdbc:OracleDriver());
Class.forName("oracle.jdbc.OracleDriver");
String url="jdbcracle:thin:@localhost:1521";
con=DriverManager.getConnection(url,"sarika","sarika");
catch(NullPointerException e)
System.out.println("e");
e.printStackTrace();
finally
try
con.close();
st.close();
rs.close();
catch(Exception e)
System.out.println(e);
e.printStackTrace();
I also set path of ojdbc14.jar and orai18n.jar in environment variable.
pls help to solve the problem

Class.forName("SOME_DRIVER_CLASS");Is tricky to use because it will compile not needing to reference the vendors jar file.
You have to remember to deploy it though where ever you plan to run this program.
If you are running from command line
java -cp PATH_TO_JAR Type4ConnectTest

Similar Messages

  • Problem JDBC Connection using OCI Driver on Weblogic Portal on Linux

    Hi Team,
    I want a JDBC connection using OCI Driver in Weblogic Portal 8.1 sp4 on Linux. When I had tested using JDBC connection using Plain Java Code it is working. Also when I create the OCI Connection Weblogic Connection Pool it is working.
    But My Requirement is to create the connection using Java Code in Portal Application
    But When I create OCI connection in the code it is throwing NO SUITABLE DRIVER Found.
    ---------- Code in Plain Java Code ------------ Same code is used in Weblogic Portal Application --------------------------------
         public static void main(String[] args) throws Exception{
              Class.forName("oracle.jdbc.driver.OracleDriver");
              DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
              String url="jdbc:oracle:oci8:@TESTDB";
              Properties props = new Properties();
         props.put("user","scott");
         props.put("password","tiger");
              conn=DriverManager.getConnection(url,props);
    When I am using the same code in Weblogic Portal and Deployed on Weblogic Portal Server 8.1 SP4 it is throwing following error.
    -------------- Exception on Server Log --------------------
    java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getConnection(Ljava.lang.String;Ljava.util.Properties;Ljava.lang.ClassLoader;)Ljava.sql.Connection;(Unknown Source)
    at java.sql.DriverManager.getConnection(Ljava.lang.String;Ljava.util.Properties;)Ljava.sql.Connection;(Unknown Source)
    My Environment is
    LINUX
    Weblogic 8.1 SP4
    Oracle 9i Client on Same Machine
    Oracle 10g Server on Different Machine
    My Environment Variables on the Linux Server also set properly as following
    PATH=/apps/pmaaum/ant/apache-ant-1.6.5/bin:.:/apps/beahomedev/jdk142_05/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/apps/oracle/ora9i/product/9.2.0/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/apps/oracle/ora9i/bin
    LD_LIBRARY_PATH=/usr/lib:/apps/oracle/ora9i/product/9.2.0/lib:/apps/oracle/ora9i/product/9.2.0/lib32:/apps/oracle/ora9i/product/9.2.0/rdbms/lib:/usr/openwin/lib:/apps/oracle/ora9i/product/9.2.0/jdbc/lib
    JAVA_HOME=/apps/beahomedev/jdk142_05
    JDBC_LIB=/apps/oracle/ora9i/product/9.2.0/jdbc/lib
    CLASSPATH=:.:/apps/beahomedev/jdk142_05/lib/rt.jar:/apps/oracle/ora9i/product/9.2.0/jdbc/lib/classes12.jar
    Please help me, Let me know if you required anything.
    Thanks in Advance
    Vishnu
    Edited by: vishnuk on Oct 23, 2009 4:07 AM
    Edited by: vishnuk on Oct 23, 2009 4:10 AM

    Hi Vishnu
    Looks like a classloader issue. BEA class loader is very tricky. Any jar added manually in classpath, will end up loading only those classes. Any imports that we have in any of those classes do not get loaded. Anyhow, coming to your point, add classes12.jar inside your portal web project Web-Inf/lib folder and see if that helps. Usually thats where we put all the JARs for 8.1 SPxx applications. If this still breaks, then remove the jar from web-inf/lib folder and add under your portal app App-Inf/lib folder. First try with app-inf/lib folder having this jar. If not then with web-inf/lib. Basically web-inf is specific to that web app only. If you have a different app having this jdbc code, then put under app-inf/lib folder. Make sure that you remove the classes12.jar that you added in classpath either in env variable or in setdomainenv.cmd file.
    When weblogic uses native OCI Drivers, it refers to jars at this location: ....\beawlp814\weblogic81\server\ext\jdbc\oracle\10g or 9g. Try using one of these jars and see if that works. Most of the times I used these jars only for oracle specific native drivers.
    Word of caution. Try to use Connection Pool and a DataSource created in weblogic console for your jdbc code. This Datasource can still use the Oracle drivers that you want (instead of BEA Weblogic wrapper oci drivers) located in above location. Use JNDI Lookup and get Datasource and then connection. This is more recommended approach with many advantages then using DriverManager approach..
    Goud

  • Jdbc connection using oracle thin driver( using jdk1.4 and oracle8 )

    hello ..
    while i was tring to connection using oracle thin driver and jdk1.4 am getting the below error message. i have set the class path for the driver also. am using oracle8 personal edition and jdk1.4.
    [java.sql.SQLException: Io exception: The Network Adapter could not establish the connection
            at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
            at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
            at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:333)
            at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:404)
            at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.ja
    va:468)
            at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
            at java.sql.DriverManager.getConnection(DriverManager.java:512)
            at java.sql.DriverManager.getConnection(DriverManager.java:171)
            at Connexa.main(Connexa.java:18)[/b]
    Press any key to continue...
    my program is....
    import java.sql.*;                                          
    import java.io.*;
    import java.util.*;
    import oracle.jdbc.driver.*;
    // needed for new BFILE class
    import oracle.sql.*;
       public class Connexa {
      public static void main (String args []) throws Exception {
            Statement stmt=null; 
      try{
        // Load the Oracle JDBC driver                            
        //DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    Class.forName("oracle.jdbc.driver.OracleDriver");
        // Connect to the database
        // You can put a database name after the @ sign in the connection URL.
    Connection conn =
    DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:orcl","scott","tiger");
        //Connection conn =
        //  DriverManager.getConnection ("jdbc:odbc:datasource", "system", "manager");
        stmt = conn.createStatement ();
    catch (SQLException e)
          e.printStackTrace();

    The code itself is fine; the problem is with one of:
    1) the connection URL
    2) intermediate networking
    3) the database itself
    1) your connection URL is "jdbc:oracle:thin:@127.0.0.1:1521:orcl"
    - is Oracle really running on the default port, 1521
    - is the installation SID really "orcl"
    2) lots of possibilities, but only a couple are likely
    - is TCP/IP configured and running on your host
    - is there a persoanl firewall rpduct running? perhaps it's blocking the connection
    3) Is Oracle running?
    Is the listener running?

  • JDBC connections using resource file

    I have heard that a resource file can be used to
    assign an URL and DB2 driver to establish a connection.
    What is a resource file and how can this be done?
    We have several URL and DB2 drivers to assign depending on what server we are processing on.
    thanks

    Hi,
    here's a sample:
    try {
    Properties properties = new Properties();
    properties.load(instance.getClass().getResourceAsStream("/sqlhandler.properties"));
    String driver = properties.getProperty("jdbc.driver");
    String url = properties.getProperty("jdbc.url");
    String login = properties.getProperty("jdbc.login");
    String password = properties.getProperty("jdbc.password");
    Class.forName(driver);
    connection = DriverManager.getConnection(url,login,password);
    The resource I use is a properties file that is (in this instance) located in the same place as class file. You can fully qualify the location of the resource if you wish.
    Hope this helps
    cheers
    Dave

  • Help me understand JDBC connections using DataSource objects

    I'm writing a simple Java server application that accepts connections from multiple clients via RMI, connects to a SQL Server 2000 database via Microsoft's SQL 2000 JDBC driver, gets some data, and returns it to the client. The server application will handle every SQL database connection. However, it must be able to establish multiple simultaneous connections, since multiple clients may connect at the same time and request data.
    Sounds like a simple multi-threaded server that utilizes a connection pool for database connectivity, right? Well, if I want to do that, I have to register a PooledDataSource object with JNDI. My server threads that are handling requests will simply grab connections out of the pool to retrieve data (presumably).
    This seems like a fairly simple server application; however, all the information and tutorials I've read on using DataSource objects for database connections rather than DriverManager.getConnection() mention XML config files, J2EE application servers, Tomcat, WebSphere, etc. I really don't want to have to deal with all that just to get connection pooling and not have to use the DriverManager.getConnection() method.
    Is there a simple way to use DataSource objects without installing a lot of extra junk on my server?

    Thanks, diazlara. Your response was exactly what I needed to know. All the information I've read prior to this suggested that I had to have a J2EE server running, and that I had to register the DataSource object with JNDI. If you ladies and gents could take a quick look at this and let me know if I'm doing it correctly, I'd appreciate it.
    As proflux suggested, I wrote a connection manager:
    import java.sql.*;
    import javax.sql.*;
    import com.microsoft.jdbcx.sqlserver.*;
    public class SQLConnectionManager {
       private static ConnectionPoolDataSource connectionPool;
       // Initialize the connection manager
       public SQLConnectionManager() {
          init();
       // Retrieve a connection from the connection pool and return it
       public static Connection getConnection() {
          Connection connection = null;
          try {
             connection = connectionPool.getPooledConnection("myUsername", "myPassword").getConnection();
          catch (SQLException ex) {
             System.err.println("A problem occurred while getting a connection from the pool.");
             ex.printStackTrace();
          return connection;
       // Initialize the datasource and connection pool
       private static void init() {
          SQLServerDataSource mds = new SQLServerDataSource();
          mds.setDescription("MS SQLServerDataSource");
          mds.setServerName("127.0.0.1");
          mds.setPortNumber(1433);
          mds.setDatabaseName("SomeTable");
          mds.setSelectMethod("cursor");
          connectionPool = (ConnectionPoolDataSource) mds;
    }As you can see, I'm hard-coding the username and password for testing purposes. I'll incorporate a login/authentication system for any production code that I use this in.
    Once the SQLConnectionManager is created, connections can be retrieved as follows:
          Connection connection = null;
          try {
             connection = SQLConnectionManager.getConnection();
             System.out.println("** Got a SQL database connection from the pool");
             DatabaseMetaData metaData = connection.getMetaData();
             ResultSet rs = metaData.getCatalogs();
             while (rs.next()) {
                System.out.println("\tcatalog: " + rs.getString(1));
             rs.close();
             connection.close();
          catch (SQLException ex) {
             System.out.println("An exception occurred while connecting to the SQL Database:");
             ex.printStackTrace();
          }So, how does that look? I tested it out, and it seems to work just fine. Using this code, I am getting a connection from a pool, correct? I want to make sure of that. Also, are there any inherent weaknesses or flaws with this method that I need to be aware of?
    Thanks so much for all the helpful responses.

  • Stack overflow error while creating connection using Oracle10G dirver

    Hi,
    Our web application built on Servlets runs on the iPlanet web server (In solaris machine). Earlier we used JDK 1.5 update 6 with oracle 9i driver and now got migrated to JDK 1.5 update 10 with same driver. Everything went fine until we started testing the environment with oracle 10G driver. Java 1.5 update 10 with oracle 10G driver throws "Stack overflow error".
    Driver version is - 10.2.0.2.0
    This occurs only when I access the portal. When I created the single main program and try to run it in the solaris machine it works fine. But wen I try to access the portal keeping this driver under classpath, it fails. Please let me know if anyone have any clues.
    When I looked into it, I am able to find that the "stack overflow error" occurs at the point the code line DriverManager.Getconnection("url", "username", "pwd") executes.
    Thanks in advance
    below the stacktrace of the exception from webserver error log..
    06/Mar/2007:04:20:40] failure (10198):
    for host 202.54.182.136 trying to POST /wr/servlet/WorkRequest, service-j2ee reports: StandardWrapperValve[WorkRequest]: WEB2769: Allocate exception for servlet WorkRequest
    javax.servlet.ServletException: WEB2778: Servlet.init() for servlet WorkRequest threw exception
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:949)
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:658)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:244)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:209)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
    at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:161)
    at com.iplanet.ias.web.WebContainer.service(WebContainer.java:580)
    ----- Root Cause -----
    java.lang.StackOverflowError
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
    at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
    at java.lang.ClassLoader.loadClass(
    [06/Mar/2007:04:22:20] info (10198):
    CORE5073: Web server shutdown in progress
    [06/Mar/2007:04:22:21] info (14506):
    CORE1116: Sun ONE Web Server 6.1SP5 (64-Bit) B12/02/2005 04:37
    [06/Mar/2007:04:22:21] warning (14513):
    CORE1251: On group ls1, servername pstst42.pedc.sbc.com does not match subject "" of certificate Server-Cert.
    [06/Mar/2007:04:22:21] warning (14513):
    CORE1250: In secure virtual server https-vts, urlhost does not match subject "" of certificate Server-Cert.
    [06/Mar/2007:04:22:21] info (14513):
    CORE5076: Using [Java HotSpot(TM) 64-Bit Server VM, Version 1.5.0_06] from [Sun Microsystems Inc.]
    [06/Mar/2007:04:22:21] info (14513):
    WEB0100: Loading web module in virtual server [https-vts] at [servlet]
    [06/Mar/2007:04:22:21] info (14513):
    WEB0100: Loading web module in virtual server [https-vts] at [vts/servlet]
    [06/Mar/2007:04:22:21] info (14513):
    WEB0100: Loading web module in virtual server [https-vts] at [cron/servlet]
    [06/Mar/2007:04:22:21] info (14513):
    WEB0100: Loading web module in virtual server [https-vts] at [find/servlet]
    [06/Mar/2007:04:22:21] info (14513):
    WEB0100: Loading web module in virtual server [https-vts] at [cb/servlet]
    [06/Mar/2007:04:22:21] info (14513):
    WEB0100: Loading web module in virtual server [https-vts] at [wr/servlet]
    [06/Mar/2007:04:22:21] info (14513):
    WEB0100: Loading web module in virtual server [https-vts] at [search]
    [06/Mar/2007:04:22:25] info (14513):
    HTTP3072: [LS ls1] ready to accept requests
    [06/Mar/2007:04:22:25] info (14513):
    CORE3274: successful server startup
    Message was edited by:
    Nandakumar_s
    Message was edited by:
    Nandakumar_s

    Yes, request goes through connection pool but weird
    thing is application throws stack excatly where
    DriverManager.getConnection gets executed.
    Not weird at all.
    This is what I am guessing that you did. You changed the driver and some other stuff, like configuration information.
    Then when it blew up you tracked down in your code where you see the stack overflow. That happens to be on the connection line. That is not where the overflow 'occurs' - it merely represents where you saw it.
    That line however isn't using the oracle driver. What it is using is a connection pool of some sort. That connection pool is configured somewhere. And that configuration is self-referential (or maybe refers to a another driver which refers back to the original.)
    And that causes you stack over flow.

  • JDBC Connection Using ColdFusion DataSource

    We are using ColdFusion MX 6 and oracle 10g.
    I am trying to code a JAVA JDBC database connection class by
    simplely pass ColdFusion datasouce name.
    i.e, instead of passing URL, user id and password, I hope my
    JAVA class can recognize ColdFusion datasource.
    Is this possible without a J2EE environment?
    If you have done this, please advice.

    DataSource is an interface which allows vendors and developers to implement their means of managing Connection objects (to add features like connection pooling, etc). You can find out about DataSource in API documentation: http://java.sun.com/j2se/1.4.2/docs/api/javax/sql/DataSource.html
    DriverManager on the other hand is a class which registers Drivers and uses them to produce Connection objects:
    http://java.sun.com/j2se/1.4.2/docs/api/java/sql/DriverManager.html

  • JDBC 2.0, Type 4 Driver for Oracle 8.0.4

    I'm looking for a Type 4 JDBC 2.0 driver for Oracle 8.0.4. Does
    Oracle provide one. I have looked at the downloads area but was
    not able to locate one.
    Any pointers?
    Ravindra Rao
    [email protected]
    null

    Ravindra Rao (guest) wrote:
    : I'm looking for a Type 4 JDBC 2.0 driver for Oracle 8.0.4. Does
    : Oracle provide one. I have looked at the downloads area but was
    : not able to locate one.
    : Any pointers?
    : Ravindra Rao
    : [email protected]
    The only oracle JDBC driver that can run with JDK 1.2.x is in the
    OTN download area and is named "816SDK for JDK 1.2"
    it will work with the JDK 1.2.X using the JDBC 1.22 spec from JDK
    1.1.X.
    IT DOES NOT PROVIDE THE FULL JDBC 2.0 FEATURES/ FUNCTIONALITY
    THAT ARE INCLUDED IN THE JDK 1.2.X CLASSES.
    you're using a jdk 1.2.x/jdbc 2.0 feature -- which is anticipated
    to be included in the 816 driver later this year -- it's not in
    the "816SDK" JDBC driver you're using now..
    816SDK can be thought of as stepping stone between 815 using jdk
    1.1.x and 816 supporting jdk 1.1.x and 1.2.x.
    i think of it as "8.1.5 and a half" to avoid the naming confusion
    between "816sdk" and "816" .
    SEE the following FAQ link for additional details :
    http://technet.oracle.com/tech/java/sqlj_jdbc/htdocs/jdbc_faq.htm
    null

  • JDBC connection pool failures when used by JMS stores

              We are using WebLogic 6.1 sp2. We defined a separate connection pool for use by
              a JMS Store.
              <JDBCConnectionPool Name="sybaseJMSPool"
              Targets="cluster00"
              InitialCapacity="2"
              MaxCapacity="10"
              DriverName="com.sybase.jdbc2.jdbc.SybDriver"
              Properties="[email protected]@;[email protected]@;charset=utf8"
              URL="jdbc:sybase:Tds:@jms.db.host@/@jms.db.name@"/>
              (note that the @xxx@ string are replaced by actual values).
              We are using Sybase Jconnect 5.5 to a Sybase ASE 12.5 database.
              We deployed this configuration on a number of environments (testing, staging,
              ..). The actual hardware and network configuration is different for the different
              system, but the WebLogic domain stays the same regarding this issue.
              On the test system we frequently get the following exceptions:
              <Aug 13, 2002 1:56:04 PM CEST> <Alert> <JMS> <www00-test> <node00>
              <ExecuteThread: '6' for queue: 'JMS.TimerClientPool'> <> <> <040048>
              <JMSServer "JMSServer00", store failure while writing message for topic
              OrderChangeTopic, java.io.IOException: JMS JDBC store, connection pool =
              <sybaseJMSPool>, prefix = <JMS00>: write failed
              java.sql.SQLException: JZ006: Caught IOException:
              com.sybase.jdbc2.jdbc.SybConnectionDeadException: JZ0C0: Connection is already
              closed.
              at com.sybase.jdbc2.jdbc.ErrorMessage.raiseErrorCheckDead
              (ErrorMessage.java:715)
              at com.sybase.jdbc2.tds.Tds.handleIOE(Tds.java:3124)
              at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1412)
              at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1341)
              at com.sybase.jdbc2.jdbc.SybStatement.doCancel(SybStatement.java:564)
              at com.sybase.jdbc2.jdbc.SybStatement.updateLoop(SybStatement.java:1672)
              at com.sybase.jdbc2.jdbc.SybStatement.executeUpdate
              (SybStatement.java:1625)
              at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeUpdate
              (SybPreparedStatement.java:91)
              at com.p6spy.engine.logging.P6LogPreparedStatement.executeUpdate
              (P6LogPreparedStatement.java:179)
              at weblogic.jdbc.pool.Statement.executeUpdate(Statement.java:293)
              at weblogic.jms.store.JDBCIOStream.write(JDBCIOStream.java:1246)
              at weblogic.jms.store.StoreRequest.doTheIO(StoreRequest.java:250)
              at weblogic.jms.store.JMSStore.execute(JMSStore.java:182)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              .>
              java.io.IOException: JMS JDBC store, connection pool = <sybaseJMSPool>, prefix
              = <JMS00>: write failed
              java.sql.SQLException: JZ006: Caught IOException:
              com.sybase.jdbc2.jdbc.SybConnectionDeadException: JZ0C0: Connection is already
              closed.
              at com.sybase.jdbc2.jdbc.ErrorMessage.raiseErrorCheckDead
              (ErrorMessage.java:715)
              at com.sybase.jdbc2.tds.Tds.handleIOE(Tds.java:3124)
              at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1412)
              at com.sybase.jdbc2.tds.Tds.cancel(Tds.java:1341)
              at com.sybase.jdbc2.jdbc.SybStatement.doCancel(SybStatement.java:564)
              at com.sybase.jdbc2.jdbc.SybStatement.updateLoop(SybStatement.java:1672)
              at com.sybase.jdbc2.jdbc.SybStatement.executeUpdate
              (SybStatement.java:1625)
              at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeUpdate
              (SybPreparedStatement.java:91)
              at com.p6spy.engine.logging.P6LogPreparedStatement.executeUpdate
              (P6LogPreparedStatement.java:179)
              at weblogic.jdbc.pool.Statement.executeUpdate(Statement.java:293)
              at weblogic.jms.store.JDBCIOStream.write(JDBCIOStream.java:1246)
              at weblogic.jms.store.StoreRequest.doTheIO(StoreRequest.java:250)
              at weblogic.jms.store.JMSStore.execute(JMSStore.java:182)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              at weblogic.jms.store.JDBCIOStream.throwIOException
              (JDBCIOStream.java:1213)
              at weblogic.jms.store.JDBCIOStream.write(JDBCIOStream.java:1256)
              at weblogic.jms.store.StoreRequest.doTheIO(StoreRequest.java:250)
              at weblogic.jms.store.JMSStore.execute(JMSStore.java:182)
              at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
              at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
              Before that this message appeared:
              <Aug 13, 2002 11:31:16 AM CEST> <Error> <ConnectionManager> <www00-test>
              <node00> <ExecuteThread: '26' for queue: 'default'> <> <> <000000>
              <Closing: 'weblogic.rjvm.t3.T3JVMConnection@795af6' because of: 'Server
              received a message over an uninitialized connection: 'JVMMessage from: 'null'
              to: '-4555218188801970213S:192.168.13.1:[7001,7001,7002,7002,7001,7002,-
              1]:ADIS:node00' cmd: 'CMD_REQUEST', QOS: '101', responseId: '1',
              invokableId: '287', flags: 'JVMIDs Not Sent, TX Context Not Sent', abbrev
              offset: '34'''>
              This problem did not occur on another system which was used during a 2 day stress
              testing session.
              It seems that the problem occurs after a period in which no user request where
              made. The user requests trigger EJB's that start sending JMS messages.
              When the problem occurs, the JMS messaging systems seems to lock up as no messages
              are received anymore by the different listeners (MDBs).
              Undeploying and redeploying the JBDC connection pool solves the problem. This
              solution is unacceptable in case of a production system.
              A similarly defined connection pool, which is used by the EJBs to make database
              connection, does not manifest this problem.
              <JDBCConnectionPool Name="sybasePool"
              Targets="cluster00"
              InitialCapacity="10"
              CapacityIncrement="5"
              MaxCapacity="50"
              PreparedStatementCacheSize="150"
              DriverName="com.sybase.jdbc2.jdbc.SybDriver"
              Properties="[email protected]@;[email protected]@;JCONNECT_VERSION=6;charset=utf8"
              URL="jdbc:sybase:Tds:@db.host@/@db.name@"/>
              The JDBC connection pool is used as follows by the JDBC store
              <JMSJDBCStore ConnectionPool="sybaseJMSPool" Name="JDBCStore00" PrefixName="JMS00"/>
              <JMSServer Name="JMSServer00" Store="JDBCStore00" Targets="node00">
              <JMSTopic JNDIName="ADIS.JMSError" JNDINameReplicated="false" Name="ErrorTopic"/>
              <JMSTopic JNDIName="ADIS.Status"
              Name="StatusTopic" RedeliveryDelayOverride="300000"/>
              <JMSTopic JNDIName="ADIS.OrderChange" JNDINameReplicated="false"
              Name="OrderChangeTopic" RedeliveryLimit="3"/>
              </JMSServer>
              Turning on the "Test Reserved Connection" with a appropriate test table does not
              help.
              Some sources on the internet tell us that JZ0C0 errors in the Jconnect driver
              can be related to network problems. Nevertheless the connection pool should be
              able to cope with this.
              Can you provide any solution for this ? Or give us hints what can cause the problem
              

    Zhenhao Qi wrote:
    thanks! Joe.
    The SQL statement itself can no longer be simplified, the long excuation time is due to the database size and complicated Select criteria. I can easily reproduce the problem by using this SQL. I tried "BEA's Oracle driver (Type 4): Version 8.1.7,9.0.1,9.2.0". the question can be dissect into 2 pieces:
    1) why the jdbc connection (using oracle.jdbc.OracleDriver) won't return anything if the SQL execution time > 5min, that is probably the Oracle's problem
    2) why the occupied connection pool won't release even I set "Statementtimeout=600", this is Weblogic's problem.
    ZhenhaoHi. Yes, (1) is oracle's problem. (2) may also be. The JDBC spec has very few
    allowances for one thread to interrupt a second thread's JDBC call. If we
    transmit your timeout request by calling setQueryTimeout() on the oracle
    statement, and if you have a weblogic-controlled transaction we call
    Statement.cancel() on any ongoing statement, we end up relying on whether
    the Oracle driver implements and responds to those calls.
    Are you doing weblogic-controlled transactions? Are you/can you
    call Statement.setQueryTimeout() on your statements, or are these
    generated JDBC queries?
    If you can duplicate the problem using the weblogic.jdbc.oracle.OracleDriver
    we have some other debug avenues. This would be good even if you really
    want to use the thin driver, because we will do the same JDBC calls to
    either driver, and the debug would prove (if) we set up a query timeout
    and if we call cancel(). If we do, then we can know that it is the Oracle
    driver failing in these regards.
    Joe

  • Jdbc connection in EJB using wsad 5.0

    Hi,
    I want to develop a small application using Ejbs by using oracle 9i as D/b, wsad 5.0 as app server . The problem is i am not able to connect to oracle database in WSAD. What i am doing is i have installed Oracle 9i in my system and has given the Global database name as "samp" while installation . I open my SQL plus with username scott and password tiger and i am able to do all my sql queries successfully.
    Now coming to WSAD,
    while creating a JDBC connection using Oracle 9i driver,
    i ve opened in Data perspective and in that go to DB Servers -> Right click -> New Connection
    There a window is opened for Database Connection.
    We need to fill the fields there.
    I have given samp as Global d/b name while installing Oracle 9i .
    In the window , the feilds are
    Connection Name : conn
    Database Name : samp
    user id : scott
    password : tiger
    D/b vendor type: Oracle 9i
    Jdbc Driver : Oracle Thin Driver
    Host : 127.0.0.1
    port No: 1521
    class location : c:\oracle\ora90\jdbc\lib\classes12.zip
    connection url : jdbc:oracle:thin:@127.0.0.1:1521:samp
    the class location and connection url are automatically coming.
    and please check whether all fields are correct or not
    Is this the correct way.
    Next in code if i want to connect to database should i use connection establish commands again or i can directly use create statement or prepare statement.
    Please reply.
    Thanks

    Create New Server and configure it properly
    It will work
    procedure is as follows:
    Pls visit the following link:
    http://www.webagesolutions.com/knowledgebase/waskb/waskb001/index.html
    Adding a Oracle9i DataSource from WSAD5
    Bibhas Bhattacharya, Web Age Solutions Inc.
    Before you begin, make sure that you have Oracle installed and a database is created. In this document we will use a database called MALL.
    Create a WAS V5 Server
    If you don't already have a WebSphere V5 server created, do so following these steps. Switch to the Server perspective. Right click in the Server Configuration view and select New->Server and Server Configuration.
    Name the server WASV5. Make sure that the Server type is set to WebSphere version 5.0->Test Environment. Click on Finish.
    Add the Database User
    In WSAD5, the default user ID and password to be used by a DataSource are first entered as a JAAS authentication entry.
    In the Server Configuration view, double click on WASV5 to open the configuration editor. Click on the Security tab. Next to the JAAS Authentication Entries list click on Add and add the user.
    Add the JDBC Driver
    Still in the server configuration GUI click on the DataSource tab. You can add the DataSource at the server level or at the node level. We will add it at the server level. Make sure that the Server Settings is expanded. Next to the JDBC providers list click on Add.
    Select the following options:
    Database type: Oracle
    JDBC provider type: Oracle JDBC Thin Driver or the XA version of it if you need two phase commit transaction.
    Click on Next.
    Set the name to Oracle Thin Driver.
    Notice that the location of the driver's class is automatically set to ${ORACLE_JDBC_DRIVER_PATH}/classes12.zip. Here, ORACLE_JDBC_DRIVER_PATH is a node level variable. We need to make sure that the variable is pointing to the correct directory where Oracle's JDBC driver is installed. In our case, we had installed Oracle in c:\oracle. This had installed the JDBC driver class in C:/oracle/ora81/jdbc/lib/classes12.zip.
    In the server configuration GUI click on the Variables tab. Under the Node settings select ORACLE_JDBC_DRIVER_PATH from the Defined variables list. Click on Edit and set the value to C:/oracle/ora81/jdbc/lib.
    Add the DataSource
    Click on the DataSource tab again. Select the Oracle Thin Driver you had created in the previous step. Click on Add next to the Data source defined in the JDBC provider selected above list.
    Select the following options:
    Select the type of JDBC Driver: Oracle JDBC Thin Driver.
    Select the data source type: Unless you will be testing your application with WAS V4, select Version 5.0. You can not use a V4 DataSource from a J2EE 1.3 EJB module running in WebSphere V5.
    Click on Next.
    Enter these key attributes in this screen:
    Name: My Oracle DataSource
    JNDI Name: jdbc/MyDataSource
    DataSource helper class name: com.ibm.websphere.rsadapter.OracleDataStoreHelper. Should be selected by default. The helper class is needed if you wish to access IBM extensions to JDBC. For more details search in WSAD help for "WSDataSource interface".
    Component-managed authentication alias: Set this if you wish to lookup the DataSource using its global JNDI name or using the java:comp/env/ name space and have set the authentication type of the resource reference to Application. Select the JAAS entry you had created. That is, Database user.
    Container-managed authentication alias: Set this if you intend to lookup the DataSource using the java:comp/env/ name space and have set the authentication type of the resource reference to Container. Select the JAAS entry you had created. That is, Database user.
    Use this data source in container managed persistence (CMP): Check on if you intend to use the DataSource from CMP EJBs.
    Click on Next.
    You need to set these properties:
    databaseName: MALL in our case.
    URL: jdbc:oracle:thin:@noble.webagesolutions.com:1521:MALL. In my case the server host name is noble.webagesolutions.com. The listener port number is 1521 (usually the default in most Oracle installations).
    Click on Finish.
    You have finished adding the DataSource. Save the server settings by clicking Control+S. Close the server configuration GUI.
    Testing the DataSource
    There is no out of the box way to test the DataSource. You can create a simple Servlet and add the following code:
    public void doGet(HttpServletRequest req, HttpServletResponse resp)
    javax.sql.DataSource ds = null;
    java.sql.Connection con = null;
    java.io.PrintWriter out = resp.getWriter();
    resp.setContentType("text/html");
    try {
    out.println("Looking up DataSource<br>");
    javax.naming.InitialContext ctx = new javax.naming.InitialContext();
    ds = (javax.sql.DataSource) ctx.lookup("jdbc/MyDataSource");
    out.println("Getting connection<br>");
    con = ds.getConnection();
    con.close();
    } catch (Exception e) {
    e.printStackTrace(out);
    out.println("Done<br>");
    Feedback
    Your e-mail:
    Rate this article:
    Very useful Somewhat useful Not bad Needs many corrections
    Comments:

  • JDBC connection in session using HttpSessionBindingListener

    Hi All,
    Our architechture needs us to store an OCI connection in the HTTPSession once
    the user logs in. This connection is then used for any DB related queries(passed
    around to workshop controls etc). I know this is againt generally recommended
    practice, but given that we need to do it, i thought of wrapping this connection
    in an HttpSessionBindingListener ,so that when the Servlet API calls the onValueUnbound(),
    i can close the internal connection. However, it has come to my notice that the
    valueUnbound method is not called each and every time a browser window is closed
    or a session times out. Does my wrapper object NEED to implement Serializable?Even
    if it does, the internal OracleOCIConnection is still unserializable. Is there
    any way i can close such a connection reliably when session is closed/invalidated/expired?
    Thanks.
    Vik.

    Hi, I'd refer you to the ejb newsgroup for expert help in that
    area. I'm jdbc, and what you wanted sounded like that.
    Joe
    vik wrote:
    Joe,
    If we were to use a Statefull session bean to do this, could you guide me on how
    i would go about doing it in general terms? One way i can think of is:have a ejbCreate(userName,passWord),
    which is called on login. This calls the getConnection(userName,passWord) from
    the connectionPool,and if the username/pwd is invalid, i will get a CreateException
    wrapping a SQLException. If it goes allright, i now have a session bean associated
    with this client holding a JDBC connection using his credentials.How would i share
    this session bean across the app so that if there are any SQL operations to be
    performed by any action(we are using WorkShop and Weblogic8.1), they are done
    using this session bean. Should i be storing this Stateful Session Bean in the
    HTTP session then?
    Regards,
    Vikram.
    Joe Weinstein <[email protected]> wrote:
    vik wrote:
    Hi All,
    Our architechture needs us to store an OCI connection in the HTTPSessiononce
    the user logs in. This connection is then used for any DB related queries(passed
    around to workshop controls etc). I know this is againt generally recommended
    practice, but given that we need to do it, i thought of wrapping thisconnection
    in an HttpSessionBindingListener ,so that when the Servlet API callsthe onValueUnbound(),
    i can close the internal connection. However, it has come to my noticethat the
    valueUnbound method is not called each and every time a browser windowis closed
    or a session times out. Does my wrapper object NEED to implement Serializable?Even
    if it does, the internal OracleOCIConnection is still unserializable.Is there
    any way i can close such a connection reliably when session is closed/invalidated/expired?
    Thanks.
    Vik.This sounds like stateful session bean, no?
    Joe

  • Jdbc-odbc bridge (type) driver

    Hi, mavens:
    Does there any free jdbc-odbc bridge (type 1) driver except that sun provides, for I heard of that seemly there's some bugs that may cause fatal error occurred when using it?
    I appreciate any suggestions,
    sincerely.

    Does there any free jdbc-odbc bridge (type 1) driver
    except that sun provides, for I heard of that seemly
    there's some bugs that may cause fatal error occurred
    when using it? I have never seen any fatal bugs when using it. I have never actually traced a single bug to it.
    Merant, now DataDirect, wrote it. They ones they sell that are new and improved - http://www.datadirect-technologies.com/products/odbc/odbcindex.asp
    There are of course other drivers and probably even ODBC ones which you can find by searching the driver list. http://servlet.java.sun.com/products/jdbc/drivers

  • Not getting connection using DBC file in JSP page

    Hi,
    I have a custom page. I am trying to open a JDBC connection using DBC file. Below is the command I am using for that -
    ctx = new WebAppsContext(dbfilename);
    Connection conn = ctx.getJDBCConnection();
    My dbc file location is 'C:\OA\jdevhome\jdev\dbc_files\secure'.
    the code is raising exception after getJDBCConnection is called.
    Any Idea where I am missing?
    Regards,
    Adarsh

    This is not an OA question...
    The DBC information is already set in the JVM for the Oracle Application Server:
    WebAppsContext ctx = new WebAppsContext(System.getProperty("JTFDBCFILE"));
    Connection conn = ctx.getJDBCConnection();
    And always check for if the WebAppsContext or the Connection objects are null.

  • How to get DB Connection using IConnectorService

    Hi All
    I need some documents or help on how to make a jdbc connection using IConnectorService framework. Can anybody help?
    Warm Regards
    Shubhadip

    Hi Shubhadip,
    I have some usefull code for you.
    //This method is to perform the connection to the DataBase, where
              // the Database name is myDatabase
              public IConnection getConnect()
                   IConnection myconnection = null;
                   IPortalComponentRequest request = (IPortalComponentRequest) this.getRequest();
                   Object connectorservic = PortalRuntime.getRuntimeResources().getService(IConnectorService.KEY);
                   IConnectorGatewayService cgService = (IConnectorGatewayService)connectorservic;
                   mylogger = request.getLogger();
                   ConnectionProperties cp = new ConnectionProperties(request.getLocale(), request.getUser());
                   try {
                         myconnection = cgService.getConnection("myDatabase", cp);
                         catch (Exception e)
                               mylogger.severe(e.getMessage());
                   return myconnection;
    Kind Regards,
    Al-Suwaiyel

  • What Type of Driver is it?

    I am using a driver from Oracle to connect my JavaBeans to Oracle through JDBC.
    Then as per JDBC API what type of driver I am using (i.e., JDBC-ODBC Bridge, Partly-Java Driver, JDBC-Net pure Java driver or Native-protocol pure Java driver)?
    I use the driver provided with Oracle 8.1.6.0.0 Personal Edition. The file is named as classes111.zip. I use the following driver -
    oracle.jdbc.driver.OracleDriver()

    I am using a driver from Oracle to connect my
    JavaBeans to Oracle through JDBC.
    Then as per JDBC API what type of driver I am using
    (i.e., JDBC-ODBC Bridge, Partly-Java Driver,
    JDBC-Net pure Java driver or Native-protocol
    pure Java driver)?
    I use the driver provided with Oracle 8.1.6.0.0
    Personal Edition. The file is named as
    classes111.zip. I use the following driver -
    oracle.jdbc.driver.OracleDriver()Actually that is not enough information.
    It could either be a type 2 or type 4.
    The connection url differentiates - where 'thin' is type 4 and 'oci' is type 2.
    Another source of the drivers is the client side Oracle install (maybe server too.) It can be found in the oracle directory under .../jdbc/...

Maybe you are looking for

  • How to start a career path in Sap

    Hi, i need advice in selecting Sap career path. I am a Eng.(ECE) degree holder(2005). I have 2+ years of experience in Development(Java).  I am not working for the 5 Years. I want to start my career on SAP. Would anyone please advice me for selecting

  • Editing Preferences in ITunes

    I have edited My Preferences in ITunes a number of times but the changes never take. It always goes back to the origianl defaults. What am I doing wrong?

  • 'safety stck' filed in S032

    Hi, in R/3, Info structure S032, there is a field called "Safety Stck" (EISBE), whcih is not existing in the standard inventory cube 0ic_c03. but we need to build a report(query) having this KF info included. does anyone know that do we have this inf

  • How to add keywords to a website

    Hi I need to add keywords to myweb site (well I think I do) so search engines can find it, how do I do it, I can easily do this on a PC as I have done it before, but on a mac I am a little stuck, Web done in Life 11 www.michaelcrawfordhick.com can an

  • PRINTING GOODS RECEIPT DOCUMENT

    Hi MM Gurus,     Pl. let me know the settings required to print the Goods receipt document in     SAP. Regards Yoga