JDBC Connectivity problem - Netbeans using Struts

I am a beginner - trying to learn java on my own. I am trying to access an Oracle database from my Action class- I think I have the proper struts-config (it used to give errors there, but now it doesn't) the application gets stuck at dataSource = getDataSource(request); statement in my java class. I know this is not the proper programming practice for business logic, but I haven't started with EJBs yet... The IDE has access to my database, I can run SQL commands successfully...
Any help in this regard will be appreciated!
Here is my struts-config.. <data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property property ="autoCommit" value="false"/>
<set-property property ="driverClass" value="oracle.jdbc.driver.OracleDriver" />
<set-property property="url" value="jdbc:oracle:thin:@hostname:port:XE" />
<set-property property="user" value="user" />
<set-property property="password" value="pass" />
</data-source>
The relevant code in my java class is:
dataSource = getDataSource(request);
myConnection = dataSource.getConnection();
stmt=myConnection.createStatement();
// my code to do whatever....
} catch (SQLException sqle) {
getServlet().log("Connection.process", sqle);
Thanks all.

Hi
please change your code in 2 areas
1)Loading driver class
Class.forName("oracle.jdbc.driver.OracleDriver");
2)getting connection
Connection conn = DriverManager.getConnection
("jdbc:oracle:thin:@localhost:1521:orcl", "scott", "tiger");
i hope it will help you
before executing please verify that classes12.jar or ojdbc14.jar is placed in classpath
for classes12.jar or ojdbc14.jar please goto the following location in your system
C:\oracle92\ora92\jdbc\lib
where oracle92 is oracle installation directory ....
regards
Dharma

Similar Messages

  • JDBC Connection Reset when using many processes on 64 bit system

    Hi,
    we've a annoying JDBC connection problem since we migrated our Java server to a 64 bit operating system. Here our environment.
    Database Machine:
    Oracle 10g
    Linux 32 Bit (but same problem on 64 Bit)
    Application Servers Machine:
    JDBC driver 11.1.0.6
    SUN Java 1.6.0_06 64bit
    Linux 64 bit (SLES 10 SP2)
    We have 6 different Java server processes (but with the same code) which all create some connections to the same database (running on a different Hardware). All 6 Java server processes starting at the same time (via scripts).
    Everything was fine, until we migrated the application server machine from 32 bit Linux to 64 bit Linux. From this day on, the half (or one more or less) of our application server processes can't longer connect to the database. The application server processes which have the problem product the following stack trace:
    java.sql.SQLRecoverableException: I/O Exception: Connection reset
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:281)
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:118)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:224)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:296)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:611)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:455)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:494)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:199)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:30)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
    at java.sql.DriverManager.getConnection(DriverManager.java:582)
    at java.sql.DriverManager.getConnection(DriverManager.java:154)
    at com.aaaa.utils.db.DbConnectionPool.<init>(DbConnectionPool.java:130)
    It looks like a network problem with the system but all other network stuff works without problems, between the two machines.
    - We use the thin JDBC driver (no OCI)
    - No firewalls are active on both systems
    - Both systems are in the same subnet connected to the same switch
    - The DNS configuration on both systems are ok (forward and reverse)
    - We've found the same problem on different application-server/database-server pairs with 64 bit application server hardware - but not all of our 64 bit server systems have this problem.
    - When running application server process and database on the same system (connecting via localhost) the problem does not longer appear.
    - The same database machine connected from a 32 bit application server (with 6 different java processes starting at the same time) works without a problem.
    We've tried a lot of things to isolate the problem - but with no success.
    - Same problem with SUN Java 1.6.0_06 32 bit (on 64 bit Linux)
    - Same problem with SUN Java 1.6.0_15 (32 and 64 bit)
    - Played with some JDBC connection properties (oracle.jdbc.TcpNoDelay, oracle.jdbc.ReadTimeout, oracle.net.CONNECT_TIMEOUT, oracle.net.disableOob, oracle.jdbc.RetainV9LongBindBehavior, oracle.jdbc.StreamChunkSize) without a positive result.
    - We've updated Linux network driver
    - We've changed to an completeky other NIC
    - We've tried an other Linux 64 distribution
    - We've increased the PROCESSES parameter in the init.ora
    - We've tried the JDBC driver 11.1.0.6
    - We've tried the _g version of the JDBC driver, but the debugging output simply tell us "Connection Reset" without a hint why.
    - We've tried a more complex JDBC connect string (
    "jdbc:oracle:thin:@(DESCRIPTION=" +
    "(ADDRESS_LIST=" +
    "(ADDRESS=(PROTOCOL=TCP)" +
    "(HOST=host)" + =
    "(PORT=port)" +
    ")" +
    ")" +
    "(CONNECT_DATA=" +
    "(SERVICE_NAME=sid)" +
    "(SERVER=DEDICATED)" +
    ")" +
    Nothing of this things helped us to isolate the problem.
    When we start our application server processes with a long pause (>1 min) between every process start. The problem does not occure. When we start only one application server with the same number of connections as the 6 different application server processes, everything works fine.
    We have absolute no idea why
    - this only occures on 64 bit Linux
    - independent if it's a 32 bit or 64 bit JVM
    - does not occure on all 64 bit application server machines / database machine pairs
    - never occure on the same 64 bit app server hardware when using a 32 bit Linux
    - using the Oracle JDBC 10g driver (10.xxx) there is no problem (but because of other issues, we need to use the JDBC 11g driver)
    Does anybody has an idea what our problem is?
    Thanks in advance,
    greetings

    I was recently struggling with this exact same problem. I opened a ticket with Oracle and this is what they told me.
    java.security.SecureRandom is a standard API provided by sun. Among various methods offered by this class void
    nextBytes(byte[])
    is one. This method is used for generating random bytes. Oracle 11g JDBC drivers use this API to generate random number during
    login. Users using Linux have been encountering SQLException("Io exception: Connection
    reset").
    The problem is two fold
    1. The JVM tries to list all the files in the /tmp (or alternate tmp directory set by -Djava.io.tmpdir) when
    SecureRandom.nextBytes(byte[]) is invoked. If the number of files is large the
    method takes a long time
    to respond and hence cause the server to timeout
    2. The method void nextBytes(byte[]) uses /dev/random on Linux and on some machines which lack the random
    number generating hardware the operation slows down to the extent of bringing the whole login process to
    a halt. Ultimately the the user encounters SQLException("Io exception:
    Connection reset")
    Users upgrading to 11g can encounter this issue if the underlying OS is Linux which is running on a faulty hardware.
    Cause
    The cause of this has not yet been determined exactly. It could either be a problem in
    your hardware or the fact
    that for some reason the software cannot read from dev/random
    Solution
    Change the setup for your application, so you add the next parameter to the java command:
    -Djava.security.egd=file:/dev/../dev/urandom
    We made this change in our java.security file and it has gotten rid of the error.

  • MSSQLServer jdbc connect problem on ODI 11G R2

    I have a MS SQL Server jdbc connect problem on ODI 11G R2 / Windows server 2008 64 bits.
    Tried, one by one, all versions of Microsoft drivers.
    Sqljdbc4.jar copied to : %appdata%\odi\oracledi\userlib\
    The Topology connect syntax is :
    driver: com.microsoft.sqlserver.jdbc.SQLServerDriver
    URL : jdbc:sqlserver://<host>:1433
    => All the topology tests end with time-outs.
    Installed 10G ODI.
    Works with 1.4 java and sqljdbc.jar version 2 jdbc driver.
    Times out with version 3 and/or Sqljdbc4.jar + JAVA_HOME & ODI_JAVA_HOME set to 1.6 path.
    also tried, with no success (time-outs) on either 10g or 11g :
    com.inet.tds.TdsDriver
    jdbc:inetdae7://<host>:1433?database=<DB>
    same results for :
    net.sourceforge.jtds.jdbc.Driver
    jdbc:jtds:sqlserver://<host>:1433
    Any suggestions for a fix?
    Many thanks in advance.

    Hello,
    ODI (11g) Studio is certified on Windows 32 bit only, not on 64bit.
    However you may still install it and configure ODI Studio to run with a 32 bit java.
    Details pls see Master Note For ODI 11g Install Issues And Questions (Doc ID 1214428.1).
    To connect to SQL Server:
    # Check and make sure the authentication mode of your Microsoft SQL Server Server is set to "SQL Server and Windows" or "Mixed", otherwise Oracle Data Integrator (ODI) is unable to connect to the database.
    # Before you create the Oracle Data Integrator (ODI) Dataserver in Topology Manager > Physical Architecture, stop all ODI processes, and place the JDBC Driver file in the ODI's userlib and "/drivers" folder.
    For ODI Studio (Local No Agent)
    %APPDATA%\odi\oracledi\userlib
    %APPDATA% is the Windows Application Data directory for the user (usually C:\Documents and Settings\<user>\Application Data).
    Standalone Agent
    ODI_HOME\oracledi\agent\drivers
    Note: If you decide to use the DataDirect driver that comes with ODI 11g install/ embedded in ODI 11g
    weblogic.jdbc.sqlserver.SQLServerDriver
    Then you don't need to worry about this step.
    # Make sure that the database is the default database of the user account employed by ODI for connection, and that the password is correct.
    # Verify (in your Microsoft SQL Server Server network configuration) that TCP/IP has been enabled on port 1433.
    For more details see How To Set Up JDBC Driver Connections For The Microsoft SQL Server For ODI (Doc ID 423914.1)
    If you try sqljdbc.jar, you need to configure ODI_JAVA_HOME to jdk1.5
    sqljdbc4.jar, jdk1.6 (since ODI 11g requires jdk1.6, I'd suggest sqljdbc4.jar)
    More see Compatibility Matrix For Java Machines And JDBC Drivers Used With ODI (Doc ID 807235.1)
    Hope that helps other people who run into this,
    Edited by: user742480 on Apr 4, 2011 12:06 PM

  • Problem while using struts 1.3.8

    Hi All,
    I have some problem while using struts 1.3.8 in my application.
    I am using OC4J 10.1.2.0.2, my simple coding is follows:
    <%@ page contentType="text/html;charset=utf-8"%>
    <%@ taglib uri="/WEB-INF/tlds/struts-tiles.tld" prefix="tiles"%>
    <%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean"%>
    <%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html"%>
    <%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic"%>
    <html:xhtml />
    <html:form action="<action page>" method="POST" enctype="multipart/form-data" >
    <p>
         <label for="Subject" ><span class="Mandatory">*</span> Subject:</label>
         <html:text size="40" property="subject" />
    </p>
    <p>
         <label for="upload" >Attachment:</label>
         <html:file size="40" property="attachmentFile" />
    </p>
    <p>
             <html:submit />
    </p>after clicking my the submit button in the server console i m getting
    JAAS-OC4J: JAZNFilter.doFilter - unable to find the current servlet
    javax.servlet.ServletException: JAAS-OC4J: JAZNFilter.doFilter - unable to find the current servlet
    at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:663)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
    at com.evermind.server.http.ServletRequestDispatcher.forward(ServletRequestDispatcher.java:222)
    at org.apache.struts.tiles.commands.TilesPreProcessor.doForward(TilesPreProcessor.java:260)
    at org.apache.struts.tiles.commands.TilesPreProcessor.execute(TilesPreProcessor.java:217)
    at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
    at org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:305)
    at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
    at org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequestProcessor.java:283)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
    at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at com.evermind.server.http.ResourceFilterChain.doFilter(ResourceFilterChain.java:65)
    at oracle.security.jazn.oc4j.JAZNFilter$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.security.auth.Subject.doAsPrivileged(Subject.java:500)
    at oracle.security.jazn.oc4j.JAZNFilter.doFilter(Unknown Source)
    at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:16)
    at com.ed.ecomm.edcore.web.filters.SecurityFilter.doFilter(SecurityFilter.java:196)
    at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:20)
    at com.ed.ecomm.edcore.web.filters.MonitoringFilter.doFilter(MonitoringFilter.java:138)
    at com.evermind.server.http.EvermindFilterChain.doFilter(EvermindFilterChain.java:20)
    at com.ed.ecomm.edcore.web.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:92)
    at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:659)
    at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:330)
    at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:830)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:285)
    at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.java:126)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
    at java.lang.Thread.run(Thread.java:534)
    further i investigate and i removed the "enctype=multipart/form-data" from the form attribute its working fine..
    but without using this attribute struts doesn't support the "upload" i.e, form file... its throwing another exeception..
    could you anyone please let me know whether i can change my OC4J server version of anything need to do..
    many thanks in advance

    I'm having the same exact problem. Any ideas?
    Schema sfactory;
    Schema schema;
    sfactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
    ErrorHandler eHandler = new MyErrorHandler();
    sfactory.setErrorHandler(eHandler);        
    LSResourceResolver lsrResolver = new MyLSResourceResolver();
    sfactory.setResourceResolver(lsrResolver);
    schema = sfactory.newSchema(new File(argv[1]));The last line gives me NullPointerException. I know the file (argv[1]) exists and can be read because I can print it with a BufferedReader.

  • XE connection problem after using Cisco AnyConnect Client

    Hello
    I have a rather annoying problem connecting to an XE instance AFTER I have disconnected from a VPN via a Cisco AnyConnect VPN Agent.
    Sequence of operations:
    - start Oracle XE and work normally
    - connect to client's vpn
    - do other stuff
    - DISCONNECT from Client's VPN
    -> unable to connect to XE service any more, unless I reboot
    The problem does not happen with other vpn clients like Cisco VPN Service, Juniper, Checkpoint.
    Details:
    - sqlplus connection WITH service name (eg sqlplus user/pwd@XE): FAILURE with ORA-12170
    - but...sqlplus connection WITHOUT service name (eg sqlplus user/pwd): SUCCESS (weird !)
    - tnsping XE: TNS-12535 error
    - lsnrctl status output (sorry, italian localized)
    LSNRCTL for 32-bit Windows: Version 10.2.0.1.0 - Production on 22-GIU-2011 14:19
    :38
    Copyright (c) 1991, 2005, Oracle. All rights reserved.
    Connessione a (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
    STATO del LISTENER
    Alias LISTENER
    Versione TNSLSNR for 32-bit Windows: Version 10.2.0.1.0 - Produ
    ction
    Data di inizio 22-GIU-2011 12:26:15
    Tempo di attivitÓ 0 giorni 1 ore 53 min. 22 sec.
    Livello trace off
    Sicurezza ON: Local OS Authentication
    SNMP OFF
    Servizio predefinito XE
    File di parametri listenerC:\programs\oraclexe\app\oracle\product\10.2.0\server\
    network\admin\listener.ora
    File di log listener C:\programs\oraclexe\app\oracle\product\10.2.0\server\
    network\log\listener.log
    Summary table degli endpoint di ascolto...
    (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC_FOR_XEipc)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
    (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=MyPCName)(PORT=8080))(Presentation=HTTP)(Session=RAW))
    Summary table dei servizi...
    Il servizio "CLRExtProc" ha 1 istanze.
    L'istanza "CLRExtProc", stato UNKNOWN, ha 1 handler per questo servizio...
    Il servizio "PLSExtProc" ha 1 istanze.
    L'istanza "PLSExtProc", stato UNKNOWN, ha 1 handler per questo servizio...
    Il servizio "XEXDB" ha 1 istanze.
    L'istanza "xe", stato READY, ha 1 handler per questo servizio...
    Il servizio "XE_XPT" ha 1 istanze.
    L'istanza "xe", stato READY, ha 1 handler per questo servizio...
    Il servizio "xe" ha 1 istanze.
    L'istanza "xe", stato READY, ha 1 handler per questo servizio...
    Environment:
    Win7 Pro SP1
    Oracle XE 10.2.0
    I have stopped the Win firewall and the problem is still there, so it is not a firewall problem
    listener.ora configuration
    SID_LIST_LISTENER =
    (SID_LIST =
    (SID_DESC =
    (SID_NAME = PLSExtProc)
    (ORACLE_HOME = C:\programs\oraclexe\app\oracle\product\10.2.0\server)
    (PROGRAM = extproc)
    (SID_DESC =
    (SID_NAME = CLRExtProc)
    (ORACLE_HOME = C:\programs\oraclexe\app\oracle\product\10.2.0\server)
    (PROGRAM = extproc)
    LISTENER =
    (DESCRIPTION_LIST =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
    (ADDRESS = (PROTOCOL = TCP)(HOST = MyPCName)(PORT = 1521))
    DEFAULT_SERVICE_LISTENER = (XE)
    tnsnames.ora
    XE =
    (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = MyPCName)(PORT = 1521))
    (CONNECT_DATA =
    (SERVER = DEDICATED)
    (SERVICE_NAME = XE)
    EXTPROC_CONNECTION_DATA =
    (DESCRIPTION =
    (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
    (CONNECT_DATA =
    (SID = PLSExtProc)
    (PRESENTATION = RO)
    Any help ?

    Hi;
    Pelase close this tread as answered and keep update issue at:
    Re: XE connection problem after using Cisco AnyConnect Client
    Regard
    Helios

  • STRUTS - JDBC connection problem

    im using tomcat 5.5.9, jdk 1.5, oracle database...
    � have a project in struts...
    my project works with my compiler with no problem...
    *i setup tomcat on C:\jakarta-tomcat-5.5.9
    and � made these setting for tomcat:
    � added these strings to my CLASSPATH
    --C:\jakarta-tomcat-5.5.9\common\lib\servlet-api.jar
    --C:\jakarta-tomcat-5.5.9\common\lib\jsp-api.jar
    after � deployed my project under tomcat there was a "classes12.zip" file under this path:
    C:\jakarta-tomcat-5.5.9\webapps\BILGISU\WEB-INF\lib
    � changed it to class.jar
    also � have other .jars under the same path above.
    these jars are:
    classes12.jar
    commons-beanutils.jar
    commons-collections.jar
    commons-dbcp.jar
    commons-digester.jar
    commons-fileupload.jar
    commons-lang.jar
    commons-logging.jar
    commons-pool.jar
    commons-validator.jar
    jakarta-oro.jar
    jdbc2_0-stdext.jar
    struts.jar
    struts-legacy.jar
    THE PROBLEM IS:
    my index page is a "login" page..
    i can open the login page under tomcat.
    but when � enter the username and password, page says it is wrong username or password although these are true parameters...
    i think i still have a connection problem but � dont know how to solve...
    MY SEARCHES SAYS:
    you have to reconfigure "C:\jakarta-tomcat-5.5.9\conf\server.xml" like that:
    <Resource name="jdbc/myoracle"
    auth="Container"
    type="javax.sql.DataSource"
    driverClassName="oracle.jdbc.driver.OracleDriver"
    url="jdbc:oracle:thin:[email protected]:1521:mysid"
    username="scott"
    password="tiger"
    maxActive="20"
    maxIdle="10"
    maxWait="-1"/>
    Resource name="jdbc/myoracle" ->HERE WHAT IS "myoracle"??? DOES IT BELONG TO MY PROJECT?
    you have to reconfigure "C:\jakarta-tomcat-5.5.9\conf\web.xml" like that:
    <resource-ref>
    <description>Oracle Datasource example</description>
    <res-ref-name>jdbc/myoracle</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    will i write this to my web.xml
    and what is "auth=Container" here???????
    thanks in advance
    yasin

    ONE MORE QUESTION
    Im defining the datasource in my "struts-config.xml"
    do i have to define them again in "tomcat/conf/server.xml" ...

  • App Server 8.1 JDBC Connection problem

    Dear Expert,
    Cu are using Sun Java System Application Server Enterprise Edition 8.1. Cu created one jdbc connection pool and datasource. They are called
    jdbc/RM
    From the App Server Admin Console -> Connection Pool, cu can "Ping" the database via the connection pool.
    Cu did the configuration on web.xml and sun-web.xml
    web.xml
    <resource-ref>
    <description>Oracle Database Connection - Rawmart</description>
    <res-ref-name>jdbc/RM</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
    </resource-ref>
    sun-web.xml
    <resource-ref>
    <res-ref-name>jdbc/RM</res-ref-name>
    <jndi-name>jdbc/RM</jndi-name>
    </resource-ref>
    In customer class,
    220: protected void initDataSource() throws NamingException {
    221: initContext = new InitialContext();
    222: envContext = (Context) initContext.lookup("java:comp/env");
    223: String dataSource = rConfigObject.getConfigValue("DATASOURCE");
    224: rDataSource = (DataSource) envContext.lookup(dataSource);
    225: }Exception occurs on line no. 222 already.
    From server.log, we get
    ================
    #|2005-06-03T11:36:11.562+0800|WARNING|sun-appserver-ee8.1|javax.enterprise.system.stream.err|_ThreadID=10;|
    javax.naming.NameNotFoundException: No object bound for java:comp/env [Root exception is java.lang.NullPointerException]
    at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:161)
    at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:288)
    at javax.naming.InitialContext.lookup(InitialContext.java:351)
    at com.ns.DBObject.initDataSource(DBObject.java:222)
    at com.ns.DBObject.connectPool(DBObject.java:213)
    at com.ns.DBObject.<init>(DBObject.java:91)
    at com.ns.DBObject.getInstance(DBObject.java:122)
    at com.ncharter.NCContextListener.contextInitialized(NCContextListener.java:28)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4010)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4525)
    ===============
    Do you have any ideas on this problem? Thanks.
    Regards,
    Angus

    Try asking the Customer to fire up the JNDI browser in the admin console and try to browse the JNDI tree.
    What class is the InitialContext.lookup() happening in? Is that getting executed in the servlet class or a standalone client?
    thanks.

  • 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:

  • Test JDBC connection problem

    Hi all,
    I got a very weird problem when I click Test Connection Button.
    I installed xml publisher Enterprise 5.6.2 in the server, I attempt to configure Jdbc connection in this server. once I click the Test Connection Button after I input all information, all information will be cleaned in this server, i can not get any message if the connection works well.But if i use url like http://serverIP:15101/xmlpserver/ to login xml publisher on other machine, I will get successful or error message.
    who has same experience in JDBC configuration?how to solve it ,thanks in advance.

    Apologies ... not really sure what the issue is. I assume you are talking about setting up the JDBC connection for a data source?
    In that case the entries would be something like:
    connection string: jdbc:oracle:thin:@host.company.com:1525:ora10g
    un: oe
    pw oe
    driver class: oracle.jdbc.driver.OracleDriver

  • Filemaker JDBC connection problem

    I wonder if anyone with a lot of initiative and intelligence can help me with a connection problem.
    An ordinary copy of the Filemaker Pro database only accepts local JDBC connections - i.e. from the same machine.
    That's Ok because I also have a very expensive Filemaker Server license and Filemaker Server accepts connections from anywhere.
    However this causes me rather boring testing problems. My portable computer, where I write all my code, is a dual-boot machine (Windows and Linux), and for testing purposes I want to use an ordinary copy of Filemaker Pro on the Windows part, and throw queries at it from the Linux part. With the old version of Filemaker Pro, this was possible, with the new version, it is not (only connections from the same machine are accepted).
    Question: is there any way of writing a programme in the middle, hosted on the Windows part, that accepts connections from the Linux part, and then passes them on to the Filemaker Pro copy - which will then think that the query came from the local machine - and will then take the answer and relay it to the Linux part?
    Any help gratefully received.

    Question: is there any way of writing a programme in
    the middle, hosted on the Windows part, that accepts
    connections from the Linux part, and then passes them
    on to the Filemaker Pro copy - which will then think
    that the query came from the local machine - and
    will then take the answer and relay it to the Linux
    part?Just a small question. To my understanding dual boot means at a given time your computer will be running only one OS (either windows or linux) right?. Or are you running a VM with linux inside your windows?

  • Having bluetooth connection problem after using Yosemite for a week

    After installing and using Yosemite for a week, I experienced bluetooth connection problems with my magic mouse and headphone, my model is macbook pro retina early 2013, hope to fix this soon

    Hello there Oranger84,
    If I understand correctly you are having some sort of Bluetooth issue between your computer and Magic Mouse and Headphones after installing Yosemite. Depending on the particular symptoms you are seeing, I would recommend the following article to help you get that resolved:
    Troubleshooting wireless mouse and keyboard issues
    Thank you for using Apple Support Communities.
    All the best,
    Sterling

  • 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 connection problems using JDeveloper

    I am using the "Connection Manager" in JDeveloper 2.0 to create
    a connection with the "Oracle JDBC OCI-7" driver. After filling
    in all of the fields and pressing the "Test Connection" button I
    get the following error: "Invalid Oracle URL specified:
    OracleDriver.connect". I have the CLASSPATH set to point
    to "C:\Program Files\Oracle\JDeveloper 2.0\jdbc\lib\oracle7.3.4
    \classes111.zip" and PATH includes "C:\ORANT\bin". Any ideas?
    null

    Rick Wright (guest) wrote:
    : I am using the "Connection Manager" in JDeveloper 2.0 to
    create
    : a connection with the "Oracle JDBC OCI-7" driver. After
    filling
    : in all of the fields and pressing the "Test Connection" button
    I
    : get the following error: "Invalid Oracle URL specified:
    : OracleDriver.connect". I have the CLASSPATH set to point
    : to "C:\Program Files\Oracle\JDeveloper 2.0
    \jdbc\lib\oracle7.3.4
    : \classes111.zip" and PATH includes "C:\ORANT\bin". Any ideas?
    In order for OCI to work JDBC drivers have to be installed on
    your client machine i.e. the computer where Jdev is installed.
    In you installation pack there should be a CD with Oracle 8i
    client installation. Run the installer from that CD and choose
    JDBC drivers. That should help.
    Good luck,
    Michael
    null

  • MS SQL Server 2K JDBC Connection Problem

    Hi,
    I have installed Sql Server 2000 with mixed mode authentication. I am able to connect to connect through ODBC with both Windows and server authentication.
    The same when i try with JDBC, i am not able to connect. I have added the driver jars to the classpath also.
    Heres the Code :
    try{
    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
    con = java.sql.DriverManager.getConnection("jdbc:microsoft:sqlserver://localhost:1433;databaseName=pubs","sa","");
    if(con!=null) System.out.println("Connection Successful!");
    }catch(Exception e){
    e.printStackTrace();
    System.out.println("Error Trace in getConnection() : " + e.getMessage());
    Here is the error :
    java.lang.ClassNotFoundException: com.microsoft.jdbc.sqlserver.SQLServerDriver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:183)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:294)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:281)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:250)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:310)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:115)
    at Connect.main(Connect.java:31)
    Error Trace in getConnection() : com.microsoft.jdbc.sqlserver.SQLServerDriver
    Kindly help.
    Thanks in Advance

    Thanks for the reply.
    I am not using any IDE, but the problem exists if i
    add the jar files into my classpath. I extracted the
    required files as suggested and tried, this time it
    works fine.
    If anyone could let me know why this problem is
    occuring it would be helpful.
    Thanks once againIt occured because MS didn't package their jar properly. You could try to re-jar the files or use a driver from another vendor.

  • Jdbc connection problem

    Hi All,
    I have problem with connection to Oracle database using both 'oci8' and 'thin' types for java application run within j2ee version 1.2.1 Error messages below.
    If I use oci8 with stand-alone java application the connection and data access work fine.
    I use:oracle 8i (817); jdk 1.2.2; j2ee 1.2.1 on window 2000
    Please help - thanks
    binam
    The Errors: with oci8:
    connection ERROR...access denied (java.lang.RuntimePermission loadLibrary.ocijdbc8 )
    The Error with: "thin":
    oracle.net.TNSAddress.SOException
    at oracle.net.TNSAddress.ServiceAlias.initFromNVPair(Unknown Source)
    at oracle.net.TNSAddress.ServiceAlias.initFromString(Unknown Source)
    at oracle.net.resolver.AddrResolution.resolveAddrTree(Unknown Source)
    at oracle.net.resolver.AddrResolution.resolveAndExecute(Unknown Source)
    at oracle.net.ns.NSProtocol.establishConnection(Unknown Source)
    at oracle.net.ns.NSProtocol.connect(Unknown Source)
    at oracle.jdbc.ttc7.TTC7Protocol.connect(TTC7Protocol.java:1213)
    at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:209)
    at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:249)
    at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:365)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:260)
    at java.sql.DriverManager.getConnection(DriverManager.java:457)
    at java.sql.DriverManager.getConnection(DriverManager.java:137)
    at Employee.main(Employee.java:23)

    Hello!
    I had this same problem using thin. Then I changed tnsname in getConnection by address:port:sid. Like below.
    conn = DriverManager.getConnection ("jdbc:oracle:thin:@XXX.XXX.XXX.XXX:1521:SIDNAME","LOGIN","PASSWORD");
    It worked very well.
    null

Maybe you are looking for

  • I want to show console output in my cmd prompt in C# winform application

    Hi, I'm launching the some process in C# .net Winform appliaction. But i couldn't able to see console output on the screen. The process is getting launched but inside cmd prompt window, it is showing nothing. I would like to show something on cmd pro

  • Solution Manager Service Desk - Segregation and Customization of HR Tickets

    All - The Solution Manager Service Desk is a great tool for incident management in a system landscape that includes SAP, as well as other technologies. I wanted to find out whether tickets that contain sensitive information (HR-related) can be segreg

  • Help needed in EJB

    Hi friends , I need your help in EJB I have to perform these operations 1) Calling an Appl Service from a EJB module. 2) Calling an EJB module from an Appl Service. 3) Basics of JNDI. for the second part I am exposing the EJB module as an Web Service

  • Internet modem hangups

    My internet modem continually hangs up. After a year and 3 times in the shop, plus modem being replaced, as well as MLB and Ram, and software reinstalled, it is still doing this. A new phone line was put in. An Apple Consultant said it could be cause

  • Download freezes in iTunes on iPhone and won't finish downloading album

    I purchased a full album on my iPhone today for the first time. Normally I purchase all music through my MacBook and transfer it to the iPhone as necessary. But today I got the whim to download a new album from my iPhone and it downloaded the first s