Oracle 8i jdbc/Tomcat connection issues

Tomcat 4.1.8
Oracle 8i JDBC Driver
I have been able to create the DataSource as a global resource and as a local resource inside the context of the application.
The code hangs when it attempts to create a connection. I have been able to connect to the database and perform the necessary query in a standalone application to ensure that I actually can connect.
JSP Code:
<html>
<head>
<title>VTW App</title>
</head>
<body>
<%
vtw.VTWApp tst = new vtw.VTWApp();
tst.init();
%>
<h2>Results</h2>
<%= tst.getList() %>
</body>
</html>
Java Code (Class called by JSP):
package vtw;
import javax.naming.*;
import javax.sql.*;
import java.sql.*;
public class VTWApp {
String list = "EMPTY";
public void init() {
try{
Context ctx = new InitialContext();
if(ctx == null )
throw new Exception("Boom - No Context");
System.out.println("Context Created ...");
DataSource ds =
(DataSource)ctx.lookup(
"java:comp/env/jdbc/oracleDB");
if (ds != null) {
          System.out.println("DataSource Created ...");
Connection conn = ds.getConnection();
System.out.println("Connection Pulled");
if(conn != null) {
               System.out.println("Connection Good");
               Statement st = conn.createStatement();
               String query = "";
               query += "select grpid, to_char(min(dtlastendtime),'mm-dd-yyyy hh24:mi:ss') ";
               query += "from calc_table where equipmentsernum in (";
               query += "'888000','888001'";
               query += ") group by grpid";
               ResultSet rs = st.executeQuery(query);
               if(rs != null) {
                    list = "";
                    while(rs.next()) {
                         list += (rs.getString(1) + "," + rs.getString(2));
               rs.close();
               conn.close();
               System.out.println("Connection Closed");
          } else {
               System.out.println("Connection Not Established");
}catch(Exception e) {
e.printStackTrace();
public String getList() { return list; }
}

I figured out the issue ...
In the server.xml file the resource & resource params needed to be modified..
1. Set type to oracle.jdbc.pool.OracleDataSource
2. Set factory to oracle.jdbc.pool.OracleDataSourceFactory
3. In the Java code cast the context lookup to an OracleDataSource instead of a java.sql.DataSource
Oracles DataSource does not subclass the jdbc DataSource for its OracleDataSource class everything works fine now.
<Resource name="jdbc/mydb" scope="Shareable" type="oracle.jdbc.pool.OracleDataSource"/>
<ResourceParams name="jdbc/mydb">
<parameter>
<name>validationQuery</name>
<value></value>
</parameter>
               <parameter>
                    <name>factory</name>
                    <value>oracle.jdbc.pool.OracleDataSourceFactory</value>
               </parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
     <name>url</name>
     <value>jdbc:oracle:thin:@server.company.com:1521:dbname</value>
</parameter>
<parameter>
<name>password</name>
<value>guest</value>
</parameter>
               <parameter>
                    <name>maxWait</name>
                    <value>10000</value>
               </parameter>
               <parameter>
                    <name>maxActive</name>
                    <value>100</value>
               </parameter>
<parameter>
<name>user</name>
<value>guest</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>2</value>
</parameter>
</ResourceParams>

Similar Messages

  • Oracle 8i JDBC to connect to 9i DB?

    We are having a big Java application that uses Oracle8i as underlying DB. It uses Oracle 8i JDBC for that. Now, we have to extend this application with a module that writes certain things into another DB. However, this DB is on Oracle 9i.
    Q: Can we access a 9i DB using the 8i JDBC driver? If yes, is there a special configuration for the JDBC or the 9i DB?
    Note: switching the 9i to "8i compatibility mode" is not an option, since we use loads of 9i features in that DB from another application that uses the 9i JDBC driver!
    We tried it and we got loads of exceptions from the 8i JDBC driver.
    Any comment or hint is more than welcome - we are running out of time...

    Hi
    I am trying exactly the same thing and am not able to use Oracle8i JDBC for Oracle9i DB. Have u been able to do this? In case yes, please tell me how.
    Thanks
    Ashish

  • JDBC Adapter Connection Issue

    Hi Experts,
    The scenario is file to JDBC, the messages are getting failed in XI MDT with the following error "JDBC Message processing failed ,reason when attempting to get processing resources: com.sap.aii.af.service.utill.concurrent.ResourcePoolException: Unable to create new pooled resource: DriverManagerException: Cannot establish connection to URL<JDBC Connection details maintained in CC>: SQLException: Io exception: The Network Adapter could not establish the connection".
    We got this error after changing the IP addreass of the Oralce system. we did maintained in all the communication channels with new IP Address, previously the data is updating to the Oralce table with old IP addreass.
    IP address is also maintained in XI Host file. We are able to ping the Oralce from XI with new IP.
    Can any body suggest how to rectify the issue.
    Thanks in Advance
    Bhaskar

    Hi,
    have you checked cache status. It is possbile that the change hasn't been applied yet. That would explain, why the database can't be reached.
    Stop/Start of communication channel might also help. Sometimes it si necessary to restart the whole JDBC Adapter.
    If all this fails, you should get yourself a free copy of DBVisualizer, use the same database driver as is installed on PI, provide credentials and try to reach database. Might also be a driver issue.
    Regards
    Sven

  • Oracle 10g olap cube connectivity issue using Crystal Reports 2008

    Hi
    Kindly help me out with a solution. I have created a cube in oracle 10gR2 database using Oracle Analytic Workspace Manager. I am trying to connect to this cube using Crystal report Olap datasorces. But I am only getting 4 options to connect to Hyperion Essbase, HOLOS Cube, Microsoft OLEDB, Microsoft OLAP Analysis Services 8.0 and 9.0.  I am not getting any option for connection to Oracle OLAP. How do I do that or if it does not support kindly let me know.
    Thanks in advance
    Troyee

    Hi Troyee,
    I have discussed the issue with OLAP engineer and he told me that connectivity to OLAP cube is not supported.
    and please next time address OLAP questions to the following category:
    Expert Forums » Business Objects » Other Business Objects Products
    (see the relevant category description)
    Vitaly Izmaylov
    Crystal Reports Design forum moderator

  • JDBC - Sybase Connectivity Issue

    I'm a Java beginner.When using the java JDBC i'm experiencing the following issues
    Connection string used - jdbc:sybase:Tds:<Serverip>:<ServerPort>
    Driver File - com.sybase.Jdbc2.Jdbc.SybDriver
    Initially when i tried using these values i'm able to establish the database connection.But recently i changed the machine name.I'm using the same machine for both Database and Java.After the machine name changes i'm getting the following error
    SQLException:Jz006:caught IOException:java.net.connect Exception.
    Please help me...

    Just rename back the host. Do it work?
    See [http://tmaj.pathology.jhmi.edu/doc/manual/FAQs.html#DATABASE_TROUBLESHOOTING]
    I found somewhere that
    Note: The following exception occurs when you click Test Connection to connect a Sybase data source from the administrative console.
    Test connection failed for data source isagent on server server1 at node
    svtaix24Node01 with the following exception: java.lang.Exception:
    java.sql.SQLException: JZ006: Caught IOException: java.net.ConnectException: A
    remote host refused an attempted connect operation.DSRA0010E: SQL State = JZ006,
    Error Code = 0
    This exception occurs when the Sybase data source port number is not matched to the port configured in Sybase server.
    The default port number is 5000.
    Check the port number of your Sybase server in the interfaces file under /<sybase install directory>.

  • Jdbc odbc connectivity issue

    I have made one system dsn ...in some folder..then in my jsp page my
    Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
    Connection myConn = DriverManager.getConnection."jdbc:odbc:Employee");im getting error like no data source...and its finding in root directory like c:/document seting etc etc ..not where my db lies
    if i put my db in root directory .then code wrks fine..but is it taking that root directory

    well well the code would not consider nothing here the microsoft native bridge driver has to find appropriate database.
    Are you sure u have created an entry in Odbc Data Source Administrator --> System DSN -> and you have a name called "Employee" out their pointing to appropriate database which you are trying to connect.

  • Mysql-jdbc applet connection issue

    I am developing a user interface for a mysql database. I am able to successfully access the db and execute queries through a java APPLICATION.
    I need to do the same (access the db (mysql)) through a java APPLET. When I compile the applet it complies fine. When I try to run the applet I'm getting the following error message:
    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    I tied running the applet using appletviewer and through a web browser, same result. I can run the application from the same command prompt it works fine.
    Please help.
    Relevant info:
    OS: Linux, Fedora4
    Classpath: export set CLASSPATH=/home/xyz/Java/mysql-connector-java-5.0.5/:$CLASSPATH;
    JDK: PATH=/usr/java/jdk1.6.0/bin
    Program:
    import java.sql.*;
    public class b extends java.applet.Applet
         int y = 0;
    public void paint(java.awt.Graphics g)
              y = y + 10;
    Connection conn = null;
    String driver = "com.mysql.jdbc.Driver";     
    String url = "jdbc:mysql://localhost:3306/testdb?user=usr1234&password=xyzxyz";
    try {
         Class.forName(driver).newInstance();
         conn = DriverManager.getConnection(url);
         System.out.println("Connected to the database.");
         System.out.println(" ");
         //*********BLOCK TO RETRIEVE RECORDS FROM TABLE*********          
                   try{
                        Statement st = conn.createStatement();
                        ResultSet res = st.executeQuery("SELECT * FROM table1");
                        System.out.println("Name: " + "\t" + "Age: ");
                        while (res.next()) {
                             String s = res.getString("name");
                             int i = res.getInt("age");
                             System.out.println(s + "\t" + i);
                   catch (SQLException s){
              y = y + 20;
    g.drawString("******* s: "+s,50,y);
         //*********END OF BLOCK TO RETRIEVE RECORDS FROM TABLE*********          
         conn.close();
         System.out.println("Disconnected from database");
         }      catch (Exception e) {
              y = y + 20;
    g.drawString("******* e: "+e,50,y);
                   e.printStackTrace();
    Thanks for the help in advance.
    --Mat                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    First, accessing a database from an applet is a horrendous idea.
    Having said that, did you add the mysql jar to the applet tag in the html page (in the archive property)?

  • JDBC-ORACLE CONNECTIVITY ISSUE WITYH OCI8 DRIVER using oracle 11g client..

    JDBC-ORACLE CONNECTIVITY ISSUE WITYH OCI8 DRIVER using oracle 11g client..
    I am getting below error when i m trying to access oracle db using oracle 11g client. It works with earlier oracle client versions. how do i resolve this. is there any issue with version of ojdbc6.jar that i am using??? I cant use thin driver since its an old application for which i dont have source files.
    Apr 6, 2013 1:00:59 PM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
    at java.lang.Runtime.loadLibrary0(Runtime.java:822)
    at java.lang.System.loadLibrary(System.java:992)
    at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:262)
    at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:346)
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:468)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:314)
    at java.sql.DriverManager.getConnection(DriverManager.java:525)
    at java.sql.DriverManager.getConnection(DriverManager.java:171)
    at PettyCash.SysDate.getSysSubSys(SysDate.java:232)
    at org.apache.jsp.PettyCash.index_jsp._jspService(org.apache.jsp.PettyCash.index_jsp:186)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    Code is as follow for reference
    import oracle.jdbc.driver.*;
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    conn = DriverManager.getConnection ("jdbc:oracle:oci8:@" + database,db_user, db_pass);
    eNVIRONMENT VARIABLES set are as follows:
    classpath
    C:\Program Files\apache-tomcat-5.5.12\common\lib\servlet-api.jar;C:\Program Files\apache-tomcat-5.5.12\webapps\ROOT\WEB-INF\lib\classes12.jar;C:\Program Files\apache-tomcat-5.5.12\webapps\ROOT\WEB-INF\lib\ojdbc6.jar;
    JAVA_HOME
    C:\Program Files\Java\jdk1.5.0_04
    PATH
    C:\Program Files\Java\jdk1.5.0_04\bin
    ORACLE_HOME
    D:\Oracle11\product\11.2.0\client_1\BIN

    Apr 8, 2013 5:24:06 PM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    java.lang.NullPointerException
         at org.apache.jsp.abc.index_jsp._jspService(org.apache.jsp.abc.index_jsp:280)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
         at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
         at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
         at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
         at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
         at java.lang.Thread.run(Thread.java:595)

  • Connection issues with Oracle-JDBC

    Using the Universe Design Tool in BOE 4.4 to create an Oracle-JDBC connection.
    Issue:  Test Connection fails for JDBC connection to production Oracle database.
    Getting error:
    “DBD: ORA-01034: ORACLE not available
    ORA-27101: shared memory realm does not exist
    IBM AIX RISC System/6000 Error: 2: No such file or directory”
    Things to note:
    There are three entries in the tnsnames.ora file (a prod entry, a dev entry and a test entry).  I can successfully create the JDBC connections for the test and dev entries, but not prod.
    I can go to Designer in another server (our BOE 3.5 server in a different environment) and create all three Oracle-JDBC connections.
    The Oracle middleware is the same between the two servers (11g) and the tnsnames.ora files are identical.
    The prod database is up (it would definitely be known if it were down).
    Very confused on this one.  Any help would be appreciated.

    It appears that the SAP tool “Universe Design Tool” wants to have a fully qualified (host.parent domain.org) Net Service name for this particular connection as I was able to successfully JDBC connect to our production Oracle database.  The other two databases didn't need it and the Oracle SQL Developer (which uses JDBC for connections) didn’t need a fully qualified name for our production server either.  In any case, it appears to be working now.

  • Use jdbc to connect servlet to oracle 8.1.6 database on win2k

    The code is below:
    package moreservlets;
    import java.sql.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    /** Simple servlet used to test JDBC connection. */
    public class TitleQueries extends HttpServlet {
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    String title = "Connecting to Database";
    DriverManager.registerDriver (new
    oracle.jdbc.driver.OracleDriver());
    Connection conn = DriverManager.getConnection
    ("jdbc:oracle:thin:@pc840:1521:orcl", "scott", "tiger");
    Statement stmt = conn.createStatement();
    ResultSet rset = stmt.executeQuery
    ("select ename from emp");
    while (rset.next()) {
    String name = rset.getString("ename");
    out.println(ServletUtilities.headWithTitle(title) +
    "<body bgcolor=\"#FDF5E6\">\n" +
    "<h1 align=\"center\">" + name + "</h1>\n" +
    "</body></html>");
    CLASSPATH=.;C:\J2ee;C:\j2sdkee1.3.1\lib\cloudscape;C:\Program Files\Apache Tomcat 4.0\common\lib\servlet.jar;C:\Oracle\Ora81\orb\classes\yoj.jar;C:\Oracle\Ora81\orb\classes\share.zip
    My code cannot find the JDBC driver. Any suggestions?
    Thanks.
    I get the following errors:
    C:\J2ee\moreservlets>javac -d "C:\Program Files\Apache Tomcat 4.0\webapps\ROOT\
    EB-INF\classes" TitleQueries.java
    TitleQueries.java:19: package oracle.jdbc.driver does not exist
    oracle.jdbc.driver.OracleDriver());
    ^
    TitleQueries.java:31: cannot resolve symbol
    symbol : variable name
    location: class moreservlets.TitleQueries
    "<h1 align=\"center\">" + name + "</h1>\n" +
    ^
    2 errors

    I changed my classpath variable and my servlet
    compiles okay with the:
    "import oracle.jdbc.driver.*" statement.
    However, I still get the following error.
    Why can't it find the jdbc driver, since it finds the
    import statement?
    Apache Tomcat/4.0.3
    Error loading driver: java.lang.ClassNotFoundException: oracle.jdbc.driver.Oracl
    eDriver
    WebappClassLoader: Resource '/WEB-INF/classes/moreservlets/ServletUtilities.cl
    ass' was modified; Date is now: Tue Jul 02 09:57:26 CDT 2002 Was: Tue Jul 02 09:
    37:20 CDT 2002
    Error loading driver: java.lang.ClassNotFoundException: oracle.jdbc.driver.Oracl
    eDriver
    CLASSPATH=.;C:\J2ee;C:\j2sdkee1.3.1\lib\cloudscape\RmiJdbc;C:\Program Files\Apache Tomcat 4.0\common\lib\servlet.jar;C:\Oracle\Ora81\jdbc\lib\classes12.zip;C:\Oracle\Ora81\orb\classes\yoj.jar;C:\Program Files\Oracle\JDeveloper 3.2.3\jdbc\lib\oracle8.1.7\classes12.zip;C:\Oracle\Ora81\orb\classes\share.zip
    //code begins here
    package moreservlets;
    import java.sql.*;
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import oracle.jdbc.driver.*;
    public class TitleQueries extends HttpServlet {
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection conn = DriverManager.getConnection
    ("jdbc:oracle:thin:@pc840:1521:orcl", "scott", "tiger");
    Statement stmt = conn.createStatement();
    ResultSet rset = stmt.executeQuery
    ("select * from emp");
    out.println(ServletUtilities.headWithTitle(title) +
    "<body bgcolor=\"#FDF5E6\">");
    while (rset.next()) {
    out.println("<h1 align=\"center\">"
    + rset.getString("ename") + "</h1>\n");
    out.println("</body></html>");
    catch(ClassNotFoundException cnfe) {
    System.err.println("Error loading driver: " + cnfe);
    catch(SQLException sqle) {
    System.err.println("Error connecting: " + sqle);
    }

  • JCA Binding Component connection issue in the Oracle Order Demo Application

    Hi,
    I setup the Oracle Fusion Middleware. I also deployed the Oracle Fusion Order Demo Application in the soa_server. I placed the order in the store front web.I initiated the webservice (OrderBookingService) and found the below error in the soa_server_diagnostic log file.
    =====================================================================================================================================
    Caused by: BINDING.JCA-12563
    Exception occured when binding was invoked.
    Exception occured during invocation of JCA binding: "JCA Binding execute of Reference operation 'Write' failed due to: JCA Binding Component connection issue.
    JCA Binding Component is unable to create an outbound JCA (CCI) connection.
    OrderBookingComposite:USPSShipment [ Write_ptt::Write(body) ] : The JCA Binding Component was unable to establish an outbound JCA CCI connection due to the following issue: BINDING.JCA-12510
    JCA Resource Adapter location error.
    Unable to locate the JCA Resource Adapter via .jca binding file element <connection-factory/>
    The JCA Binding Component is unable to startup the Resource Adapter specified in the <connection-factory/> element: location='eis/file/FODFileAdapter'.
    The reason for this is most likely that either
    1) the Resource Adapters RAR file has not been deployed successfully to the WebLogic Application server or
    2) the '<jndi-name>' element in weblogic-ra.xml has not been set to eis/file/FODFileAdapter. In the last case you will have to add a new WebLogic JCA connection factory (deploy a RAR).
    Please correct this and then restart the Application Server
    The invoked JCA adapter raised a resource exception.
    =====================================================================================================================================

    Thanks Guys.
    I resolved the issue.
    The issue is that FileAdapter for FulFillment mediator is missing.
    Solution 1:
    File adapter connection factory needs to be created via the weblogic console
    The details below:     
         JNDI Name: eis/file/FODFileAdapter
         controlDir          java.lang.String     /tmp/control
         inboundDataSource     java.lang.String     jdbc/SOADataSource
         outboundDataSource     java.lang.String     jdbc/SOADataSource
         outboundDataSourceLocal     java.lang.String     jdbc/SOALocalTxDataSource
         outboundLockTypeForWritejava.lang.String     oracle
    Solution 2:
    seedFodFileAdapterResources target in $FOD_HOME/bin/common-sca-tools.xml needs to be executed to create the file adaptor.
    Thanks.
    Ilayaraja

  • JDBC SSL connection to Oracle

    Hi All,
    I have been trying to connect to Oracle using a self signed certificate from a simple Java class. I am getting the below error.
    main, handling exception: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    main, SEND TLSv1 ALERT: fatal, description = handshake_failure
    I have searched many forums but couldnt find the information of my help.
    Below are the steps I have followed as per the documentation in wp-oracle-jdbc-thin-ssl-130128.pdf.
    First Step: Created a self signed certificate and a truststore with the below commands using JDK 1.6.0_16
    Create a Keystore:
    keytool -genkey -keyalg RSA -alias MyKey -keystore keystore.jks -validity 360
    Extracting the public key:
    keytool -export -rfc -alias MyKey -keystore keystore.jks -file public.cert
    Creating the Truststore:
    keytool -import -alias MyKey -file public.cert -storetype JKS -keystore keystore.truststore
    Second Step: Added the following in listener.ora and sqlnet.ora
    listerner.ora :
    # listener.ora Network Configuration File: D:\oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora
    # Generated by Oracle configuration tools.
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = CLRExtProc)
    (ORACLE_HOME = D:\oracle\product\11.2.0\dbhome_1)
    (PROGRAM = extproc)
    (ENVS = "EXTPROC_DLLS=ONLY:D:\oracle\product\11.2.0\dbhome_1\bin\oraclr11.dll")
    SSL_CLIENT_AUTHENTICATION = FALSE
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCPS)(HOST = localhost)(PORT = 2484))
    ADR_BASE_LISTENER = D:\oracle
    WALLET_LOCATION =
    (SOURCE =
    (METHOD = FILE)
    (METHOD_DATA =
    (DIRECTORY = E:\misc\Secure-jdbc\OracleCertificates)
    sqlnet.ora :
    # sqlnet.ora Network Configuration File: D:\oracle\product\11.2.0\dbhome_1\NETWORK\ADMIN\sqlnet.ora
    # Generated by Oracle configuration tools.
    ENCRYPTION_WALLET_LOCATION =
    (SOURCE =
    (METHOD = FILE)
    (METHOD_DATA =
    (DIRECTORY = E:\misc\Secure-jdbc\OracleCertificates)
    # This file is actually generated by netca. But if customers choose to
    # install "Software Only", this file wont exist and without the native
    # authentication, they will not be able to connect to the database on NT.
    SQLNET.AUTHENTICATION_SERVICES= (BEQ, TCPS, NTS)
    NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
    SSL_CLIENT_AUTHENTICATION = FALSE
    WALLET_LOCATION =
    (SOURCE =
    (METHOD = FILE)
    (METHOD_DATA =
    (DIRECTORY = E:\misc\Secure-jdbc\OracleCertificates)
    ADR_BASE = D:\oracle\product\11.2.0\dbhome_1\log
    Third Step: Created an empty auto logon wallet and added the above created certificate as a Trusted Certificate. (Imported the .cert file into the Trusted Certificates section in Wallet Manager)
    Fourth Step: Used the below Java code to connect to the database using the truststore
    public static void main(String[] args) { try { Class.forName("oracle.jdbc.driver.OracleDriver"); String url = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=localhost)(PORT=2484))(CONNECT_DATA=(SERVICE_NAME=ORCL11)))"; Properties props = new Properties(); props.setProperty("user", "system"); props.setProperty("password", "oracle"); props.setProperty("javax.net.ssl.trustStore","E:\\misc\\Secure-jdbc\\Keys and Certificates\\keystore.truststore"); props.setProperty("javax.net.ssl.trustStoreType","JKS"); props.setProperty("javax.net.ssl.trustStorePassword","sudhir123#"); Connection conn=DriverManager.getConnection(url,props); System.out.println("conn:"+conn); conn.close(); } catch(Exception e) { e.printStackTrace(); } }
    Any help would be appreciated.
    Thanks.
    Edited by: user10569290 on 20-Feb-2013 22:02

    Hi EJP,
    Please find the below code changes I have done to set the properties as part of System properties instead of Connection properties. I am still getting the same error.
    Code:
    Class.forName("oracle.jdbc.driver.OracleDriver");
              String url = "jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=localhost)(PORT=2484))(CONNECT_DATA=(SERVICE_NAME=ORCL11)))";
              Properties systemProps = System.getProperties();
              systemProps.put("javax.net.ssl.trustStore","E:\\misc\\Secure-jdbc\\Keys and Certificates\\keystore.truststore");
              systemProps.put("javax.net.ssl.trustStoreType","JKS");
              systemProps.put("javax.net.ssl.trustStorePassword","sudhir123#");
              System.setProperties(systemProps);
              Properties props = new Properties();
              props.setProperty("user", "system");
              props.setProperty("password", "oracle");
              /*props.setProperty("javax.net.ssl.trustStore","E:\\misc\\Secure-jdbc\\Keys and Certificates\\keystore.truststore");
              props.setProperty("javax.net.ssl.trustStoreType","JKS");
              props.setProperty("javax.net.ssl.trustStorePassword","sudhir123#");
              Connection conn=DriverManager.getConnection(url,props);
             System.out.println("conn:"+conn);
             conn.close();Please find the below output with the SSL debug enabled.
    adding as trusted cert:
    Subject: CN=Sudhir Reddy, OU=FCDMS, O=3i, L=Hyd, ST=AP, C=IN
    Issuer: CN=Sudhir Reddy, OU=FCDMS, O=3i, L=Hyd, ST=AP, C=IN
    Algorithm: RSA; Serial number: 0x511e1ebc
    Valid from Fri Feb 15 17:10:44 GMT+05:30 2013 until Mon Feb 10 17:10:44 GMT+05:30 2014
    trigger seeding of SecureRandom
    done seeding SecureRandom
    %% No cached client session
    *** ClientHello, TLSv1
    RandomCookie: GMT: 1361369602 bytes = { 14, 223, 155, 241, 143, 72, 188, 240, 205, 158, 201, 133, 217, 192, 95, 82, 61, 244, 93, 100, 12, 9, 232, 164, 116, 206, 30, 142 }
    Session ID: {}
    Cipher Suites: [SSL_RSA_WITH_RC4_128_MD5, SSL_RSA_WITH_RC4_128_SHA, TLS_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_RSA_WITH_AES_128_CBC_SHA, TLS_DHE_DSS_WITH_AES_128_CBC_SHA, SSL_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA, SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA, SSL_RSA_WITH_DES_CBC_SHA, SSL_DHE_RSA_WITH_DES_CBC_SHA, SSL_DHE_DSS_WITH_DES_CBC_SHA, SSL_RSA_EXPORT_WITH_RC4_40_MD5, SSL_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA, SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA]
    Compression Methods: { 0 }
    main, WRITE: TLSv1 Handshake, length = 73
    main, WRITE: SSLv2 client hello message, length = 98
    main, received EOFException: error
    main, handling exception: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
    main, SEND TLSv1 ALERT: fatal, description = handshake_failure
    main, WRITE: TLSv1 Alert, length = 2
    main, called closeSocket()
    main, called close()
    main, called closeInternal(true)
    java.sql.SQLRecoverableException: IO Error: Remote host closed connection during handshake
         at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:466)
         at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:535)
         at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:218)
         at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:29)
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:528)
         at java.sql.DriverManager.getConnection(DriverManager.java:582)
         at java.sql.DriverManager.getConnection(DriverManager.java:154)
         at SecureJDBC.getSecureConnection(SecureJDBC.java:52)
         at SecureJDBC.main(SecureJDBC.java:15)
    Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:808)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1096)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:623)
         at com.sun.net.ssl.internal.ssl.AppOutputStream.write(AppOutputStream.java:59)
         at oracle.net.ns.Packet.send(Packet.java:421)
         at oracle.net.ns.ConnectPacket.send(ConnectPacket.java:170)
         at oracle.net.ns.NSProtocol.connect(NSProtocol.java:302)
         at oracle.jdbc.driver.T4CConnection.connect(T4CConnection.java:1407)
         at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:328)
         ... 8 more
    Caused by: java.io.EOFException: SSL peer shut down incorrectly
         at com.sun.net.ssl.internal.ssl.InputRecord.read(InputRecord.java:333)
         at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:789)
         ... 16 more

  • Oracle database Connectivity issue

    We are using Oracle 11g database with java 1.6
    When i am deploying my application i am getting below error
    09:48:13,604 INFO [STDOUT] SQL Exception occured:
    09:48:13,605 ERROR [STDERR] java.sql.SQLException:
    09:48:13,607 ERROR [STDERR] at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
    09:48:13,607 ERROR [STDERR] at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:131)
    09:48:13,607 ERROR [STDERR] at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:204)
    09:48:13,608 ERROR [STDERR] at oracle.jdbc.driver.T2CConnection.checkError(T2CConnection.java:650)
    09:48:13,608 ERROR [STDERR] at oracle.jdbc.driver.T2CConnection.processOCIConnectionPooling(T2CConnection.java:997)
    09:48:13,608 ERROR [STDERR] at oracle.jdbc.driver.T2CConnection.logon(T2CConnection.java:239)
    09:48:13,609 ERROR [STDERR] at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:508)
    09:48:13,609 ERROR [STDERR] at oracle.jdbc.driver.T2CConnection.<init>(T2CConnection.java:133)
    09:48:13,609 ERROR [STDERR] at oracle.jdbc.driver.OracleOCIConnection.<init>(OracleOCIConnection.java:60)
    09:48:13,610 ERROR [STDERR] at oracle.jdbc.driver.OracleOCIConnection.<init>(OracleOCIConnection.java:44)
    09:48:13,610 ERROR [STDERR] at oracle.jdbc.oci.OracleOCIConnection.<init>(OracleOCIConnection.java:36)
    09:48:13,610 ERROR [STDERR] at oracle.jdbc.driver.T2CDriverExtension.getConnection(T2CDriverExtension.java:49)
    09:48:13,611 ERROR [STDERR] at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:510)
    09:48:13,611 ERROR [STDERR] at oracle.jdbc.pool.OracleOCIConnectionPool.createConnectionPool(OracleOCIConnectionPool.java:864)
    09:48:13,611 ERROR [STDERR] at oracle.jdbc.pool.OracleOCIConnectionPool.<init>(OracleOCIConnectionPool.java:149)
    09:48:13,614 ERROR [STDERR] at javax.servlet.GenericServlet.init(GenericServlet.java:242)
    09:48:13,615 ERROR [STDERR] at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1208)
    09:48:13,615 ERROR [STDERR] at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1108)
    09:48:13,615 ERROR [STDERR] at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3628)
    09:48:13,616 ERROR [STDERR] at org.apache.catalina.core.StandardContext.start(StandardContext.java:3851)
    09:48:13,616 ERROR [STDERR] at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:299)
    09:48:13,616 ERROR [STDERR] at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:138)
    09:48:13,617 ERROR [STDERR] at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:461)
    09:48:13,617 ERROR [STDERR] at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
    09:48:13,617 ERROR [STDERR] at org.jboss.web.deployers.WebModule.start(WebModule.java:95)
    09:48:13,617 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    09:48:13,618 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    09:48:13,618 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    09:48:13,618 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
    09:48:13,619 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
    09:48:13,619 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
    09:48:13,619 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    09:48:13,620 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:271)
    09:48:13,620 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:670)
    09:48:13,620 ERROR [STDERR] at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
    This error come when my application is trying to connect to data base
    try {
    proxyPool = new OracleOCIConnectionPool(strUserId ,strPassword, url,poolConfig); // error is coming at this line
    System.out.println("Connection pool created");
    } catch (SQLException sqle) {
    System.out.println("SQL Exception occured:");
    sqle.printStackTrace();
    if(proxyPool != null) {
    proxyPool.close();
    proxyPool = null;
    throw sqle;
    Please help me find resolution of this problem
    Thanks,
    Kumar
    Edited by: 906270 on Jan 9, 2012 3:01 AM

    906270 wrote:
    We are using Oracle 11g database with java 1.6Err...no that is not all you are doing. Looks like a whole bunch of stuff is in there.
    Please help me find resolution of this problemWrite a command line application in java. That means it does NOT run in jboss.
    It should do nothing but connect to oracle with the OCI connection string and report the results.
    Run it on the same box as jboss.
    Run it as the same user as jboss.
    If it succeeds then your problem is jboss or the user.
    If it doesn't then report the exception that that throws. And post the code (using code tags.)

  • Tomcat 5 con pool, Oracle, servlet error on Connection ocon = ds.getConnect

    Hello,
    I am trying to create a connection pool to my Oracle db using the documentation provided for
    Tomcat 5. In the servlet shown below, the servlet fails at this line:
    Connection ocon = ds.getConnection();
    The servlet stops with no error message. Also, I'm not sure what is supposed to go in
    this line:
    Context envContext = (Context)initContext.lookup("java:/comp/env");
    which may be where the real problem begins. Any suggestions are greatly appreciated.
    Here is the servlet:
    package CraigsClasses;
    import javax.servlet.*;
    import javax.servlet.jsp.*;
    import java.net.*;
    import java.util.*;
    import java.io.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.util.Date;
    import java.text.*;
    import javax.naming.*;
    import javax.sql.DataSource;
    public class CraigsMain extends HttpServlet {
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    // Process the http Get request
    public void doGet(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException {
    try {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    Context initContext = new InitialContext();
    Context envContext = (Context)initContext.lookup("java:/comp/env");
    DataSource ds = (DataSource)envContext.lookup("jdbc/CraigsList");
    Connection ocon = ds.getConnection();
    String sql = "select formtitle from checkboxforms where cbformid = 157";
    PreparedStatement pStmt = ocon.prepareStatement(sql);
    ResultSet rs1 = pStmt.executeQuery();
    rs1.next();
    out.println("<br><br><br>" + rs1.getString(1) + "<br>");
    } catch(SQLException sqle) {
    System.err.println("sql exception error: " + sqle);
    } catch(NamingException sqln) {
    System.err.println("naming exception error: " + sqln);
    // A post request calls the get request because they do the same thing
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    doGet(request, response);
    Thank you,
    Logan

    Hello,
    I am trying to create a connection pool to my Oracle db using the documentation provided for
    Tomcat 5. In the servlet shown below, the servlet fails at this line:
    Connection ocon = ds.getConnection();
    The servlet stops with no error message. Also, I'm not sure what is supposed to go in
    this line:
    Context envContext = (Context)initContext.lookup("java:/comp/env");
    which may be where the real problem begins. Any suggestions are greatly appreciated.
    Here is the servlet:
    package CraigsClasses;
    import javax.servlet.*;
    import javax.servlet.jsp.*;
    import java.net.*;
    import java.util.*;
    import java.io.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import java.util.Date;
    import java.text.*;
    import javax.naming.*;
    import javax.sql.DataSource;
    public class CraigsMain extends HttpServlet {
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    // Process the http Get request
    public void doGet(HttpServletRequest request, HttpServletResponse response)
         throws ServletException, IOException {
    try {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    Context initContext = new InitialContext();
    Context envContext = (Context)initContext.lookup("java:/comp/env");
    DataSource ds = (DataSource)envContext.lookup("jdbc/CraigsList");
    Connection ocon = ds.getConnection();
    String sql = "select formtitle from checkboxforms where cbformid = 157";
    PreparedStatement pStmt = ocon.prepareStatement(sql);
    ResultSet rs1 = pStmt.executeQuery();
    rs1.next();
    out.println("<br><br><br>" + rs1.getString(1) + "<br>");
    } catch(SQLException sqle) {
    System.err.println("sql exception error: " + sqle);
    } catch(NamingException sqln) {
    System.err.println("naming exception error: " + sqln);
    // A post request calls the get request because they do the same thing
    public void doPost(HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException {
    doGet(request, response);
    Thank you,
    Logan

  • Couldnot connect JBuilder 6 to ORACLE 8i , JDBC driver problem

    Hi guys
    I am trying to connect to the oracle 8i database from jbuilder 6 using a simple select statement , but it gives the following error
    Root cause:
    java.lang.NoClassDefFoundError: oracle/jdbc/driver/OracleDriver
         at _0002ftestEmployee_0002ejsptestEmployee_jsp_1._jspService(_0002ftestEmployee_0002ejsptestEmployee_jsp_1.java:83)
         at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServlet$JspCountedServlet.service(JspServlet.java:130)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:282)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:429)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:500)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:405)
         at org.apache.tomcat.core.Handler.service(Handler.java:287)
         at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
         at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:812)
         at org.apache.tomcat.core.ContextManager.service(ContextManager.java:758)
         at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:213)
         at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
         at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:501)
         at java.lang.Thread.run(Thread.java:484)
    plse help me how to connect jbuilder to oracle to access the data. I followed jbuilder doc like from the menu (Tools �� enterprise setup �� database driver ��)
    but could not select the driver since it is marked as red (uninstalled). How can I made jdbc driver to available to jbuilder.?. I am using oracle 8i. Will oracle 8i supports jdk 1.3 b��cos I have noticed the jbuilder supports from jdk 1.3 onwards. So plse correct me if I am wrong
    waiting for reply
    sumesh

    thanks for u'r reply.
    you mean to say i need to install the new JDBC driver (Classes12.zip and nls_charset12) to the oracle/ora8i/jdbc/lib folder.currently this folder contains only classes102 and classes11.zip files and the corresponding charset only.After instaling the new classes12.zip file do i need to set the classpath?.

Maybe you are looking for

  • Schedule backround jobs

    Hi,              If the backround job is failed where can i see the status and how can i run again?

  • How do I set font default in aperture?

    how do I set font default in aperture?

  • Is there a property for record count?

    I want to navigate to another block if the current record is the LAST record. I can get the value of the current record but can't figure out how to get the value of # of records returned. Surely there's a block property for this, but I can't find it!

  • IBooks "Couldn't communicate with a helper application"

    Hi, I just did a clean install of Mavericks on my iMac and am trying to use iBooks.  I was able to do an initial open of the application.  However, once I tried to import any PDFs and EPUBS, iBooks quit and I've haven't been able to restart the progr

  • Deleting Equipment Usage List - Table EQUZ, Field DATAB

    Hi Gurus, An equipment was inadvertently uninstalled from a location and then resinstalled again. This resulted in a new Valaidity Date being created. We have a third part tool, that uses the Validity From date for its calculation. It seems unlikely