Connecting to database in a thread class

HI,
I am have a problem when trying to get a conneciton to a database. I am trying to create the connection in a class that extends Thread.
Everythign else is set up correctly, i have ran the same code from the main class of my project and it works fine, the problem occurs when I try to get the connection from the class spawned by the main class.
The exception thrown is an SQL exception: No suitable driver found, however the driver was loaded previously (no class not found exception was thrown when loading).
The only reason I can think of that coudl be causing a problem is the fact the class creating the connection extends thread and runs in the run method i.e. a different thread.
Does anybody know of any issues regarding threads and JDBC?
NOTE: I and using the COM.ibm.db2.jdbc.net.DB2Driver for connecting to DB2.
Cheers :)

Here is the output
Driver loaded
Authorising for: test - testpass
Protocol connecting to database
Exception in Protocol: java.sql.SQLException: No suitable driver
java.sql.SQLException: No suitable driver
     at java.sql.DriverManager.getConnection(DriverManager.java:532)
     at java.sql.DriverManager.getConnection(DriverManager.java:171)
     at baeauthserver.AuthProtocol.getPMConnection(AuthProtocol.java:66)
     at baeauthserver.AuthServerThread.run(AuthServerThread.java:38)The program is a server daemon or service that listens for connections from a client. On connection the server spawns a "work" thread to deal with authorising the user and creating a database connection. I can make a connection in the main server class (i.e. the main thread) but as soon as I move this to the "work" class it seems to lose the driver.
I've just done some more tests and I can't even grab the driver as a driver object on the work thread so it's not just the getConnection method.
I'm initialising the driver in a static block in the main server program. I've moved it around to various constructors on both the main class and the work class to no avail.
It has me stumped so far :p
Thanks for the input though :)

Similar Messages

  • Getting connection toa database in a thread

    Hi
    I need guidance on how to get connection to a database inside a thread.Let me explain in detail.
    I am developing a chat application. As normal my chat server assigns each user an instance of a chathandler class which runs as a thread.The problem is that i need to connect to database inside this thread to implement some group wise logic in the broadcast method of chathandler thread.
    Now for this can i create a connection object each time in the thread or can i use a common connection object ? If i go for the second method will it cause any concurrency issue ?
    Thanks in advance

    Hi
    I need guidance on how to get connection to a
    database inside a thread.What other way is there? You always get access to a database inside a thread.
    Let me explain in detail.
    I am developing a chat application. As normal my
    chat server assigns each user an instance of a
    chathandler class which runs as a thread.The
    problem is that i need to connect to database inside
    this thread to implement some group wise logic in
    the broadcast method of chathandler thread. No, database connections are for persistence. Group wise logic belongs somewhere else.
    Now for this can i create a connection object each
    time in the thread Yes, for each database access. Create it, use it, close it. Use a connection pool to amortize the cost of opening a connection.
    or can i use a common connection object ? If you're foolish you can. How scalable is an app with one connection?
    If i go for the second method will it cause
    any concurrency issue ?You'll have isolation and concurrency issues to worry about in any case.
    %

  • How to connect one database in two threads?

    Dear All,
    If anyone can tell me how to connect one database concurrently?
    I tried the following idea:
    1.create a Hashtable to keep database objects(those databases have been opened)
    2.Before openning(connecting) a database:first step is to check the hashtable.
    If the the database object is in the hashtable, this object will be returned.
    If the datatbase object is not in the hastable, open the database and store this opened database object into the hashtable.
    I failed the test of this implementation. My test is:Create two threads (extend java Thread class).In each of these two threads, try to open the same database.Just like the following:
    MyThread thread1 = new MyThread();
    MyThread thread2 = new MyThread();
    thread1.start();
    thread2.start();
    I guessed the database object in the hashtable would be returned in the second thread.Unfortunatly, I only got an exception which meant the database couldn't be opened twice.It looks like the second thread happened before the opened database object stored into the hashtable.
    I cannot figure out if my design is wrong or my test application is wrong.
    I really appriatiate your attentions!!!
    Lu

    um not sure i follow exactly but in your code add the word synchronise to it and this means only 1 tread can access it at any 1 time.
    So your could have a class which is a singleton so it only opens the dbase once and then all other access share your connection.
    so
    public class foo{
    foo INSTANCE = new foo();
    private foo(){} //private constructor
    then all your methods use foo's internal dbase connection. Am i making sense

  • Oracle database connectivity using oledb provider and atl classes in c++

    dear friend ,
    i m connecting oracle database in c++. i m using ATL classes and oledb provider for oracle. however i m facing some defficulties in stored procedure.
    Normally MYSQL and sql server database is resulting result set in stored procedure i.e. we can use " select * from tablename" query in c++ to returning result. but in oracle we can not use this approch as because it dosent support. so how can i execute below stored procedure in c++ code. i have to retuen result set in STP. i m using SYS_REFCURSER in oracle . but how do i execute it in c++ code.
    create PROCEDURE stp_getRecord ( p_curser SYS_REFCURSER) as
    begin
    open p_curser for select * from table_name;
    end;
    please help me asap.

    I tried it, commented out the reader.read and have the following connection string
    string connectionString = "provider=ORAOLEDB.ORACLE; data source=ORCL; password=****; user id=****; OLEDB.NET=True"
    Unfortunately the result is the same.
    Edited by: Dino2dy on Nov 24, 2011 12:53 AM

  • CC&B not able to connect the database

    I have Welogic with Oracle CC&B 2.3.1 Installed on my local laptop.
    I have local database also in my laptop (oracle 11g). While doing spl start I am able to access CC&B with weblogic using local database.
    But when in configureEnv.cmd I changed database configuration to other database which is located on Unix box
    My Laptop have 32-bit window 7.
    In ConfigureEnv i gave all credentials of other database to which I am trying to connect. But I am facing below issue.
    E:\BEA\jdk150_15
    JAVA Memory arguments: -Xms1024m -Xmx1024m -XX:PermSize=300m
    WLS Start Mode=Development
    CLASSPATH=E:\BEA\wlserver_10.0\samples\server\examples\build\serverclasses;E:\BEA\patch_wss110\profiles\default\sys_manifest_classpath\weblogic_patch.jar;E:\BEA\patch_wlw1021\profiles\default\sys_manifest_classpath\weblogic_patch.jar;E:\BEA\patch_wls1002\profiles\default\sys_manifest_classpath\weblogic_patch.jar;E:\BEA\patch_cie640\profiles\default\sys_manifest_classpath\weblogic_patch.jar;E:\BEA\jdk150_15\lib\tools.jar;E:\BEA\wlserver_10.0\server\lib\weblogic_sp.jar;E:\BEA\wlserver_10.0\server\lib\weblogic.jar;E:\BEA\modules\features\weblogic.server.modules_10.0.2.0.jar;E:\BEA\modules\features\com.bea.cie.common-plugin.launch_2.1.2.0.jar;E:\BEA\wlserver_10.0\server\lib\webservices.jar;E:\BEA\modules\org.apache.ant_1.6.5/lib/ant-all.jar;E:\BEA\modules\net.sf.antcontrib_1.0b2.0/lib/ant-contrib.jar;;E:\BEA\wlserver_10.0\common\eval\pointbase\lib\pbembedded51.jar;E:\BEA\wlserver_10.0\common\eval\pointbase\lib\pbupgrade51.jar;E:\BEA\wlserver_10.0\common\eval\pointbase\lib\pbclient51.jar;E
    :\BEA\wlserver_10.0\server\lib\xqrl.jar;;;E:\SPL\CCBDEV\splapp\standalone\lib\xalan-2.7.0.jar;E:\SPL\CCBDEV\splapp\standalone\lib\serializer-2.7.0.jar;E:\SPL\CCBDEV\splapp\standalone\lib\antlr-2.7.6.jar
    PATH=E:\BEA\patch_wss110\profiles\default\native;E:\BEA\patch_wlw1021\profiles\default\native;E:\BEA\patch_wls1002\profiles\default\native;E:\BEA\patch_cie640\profiles\default\native;E:\BEA\wlserver_10.0\server\native\win\32;E:\BEA\wlserver_10.0\server\bin;E:\BEA\modules\org.apache.ant_1.6.5\bin;E:\BEA\jdk150_15\jre\bin;E:\BEA\jdk150_15\bin;E:\SPL\MicroFocus\Server5.1\Bin;E:\SPL\CCBDEV\runtime;E:\SPL\CCBDEV\runtime;E:\SPL\CCBDEV\bin;E:\SPL\CCBDEV\product\apache-ant-1.7.0\bin;E:\BEA\jdk150_15\bin;E:\OracleDB11201\Administrator\product\11.2.0\dbhome_1\bin;E:\app\prashant\product\11.2.0\dbhome_1\bin;E:\SPL\javaHome\Java\jdk150_15;E:\BEA\jdk150_15\bin;E:\SPL\MicroFocusServer5.1\Bin;E:\SPL\NIEESDEVL\product\apache-ant-1.7.0\bin;C:\csvn\bin\;C:\csvn\Python25\;C:\product\11.1.0\client_1;c:\perl\site\bin;c:\perl\bin;C:\Program Files\PC Connectivity Solution\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Common Files\Reallu
    sion\CamSuite;C:\Program Files\Toshiba\Bluetooth Toshiba Stack\sys\;C:\Program Files\TortoiseSVN\bin;E:\app\prashant\client_1;E:\app\prashant\client_1\bin;;C:\PROGRA~1\QAS\QuickAddress Pro Web;E:\BEA;E:\BEA\wlserver_10.0;E:\SPL\hibernate-3.2;E:\SPL\NIEESDEV\bin;E:\BEA\wlserver_10.0\server\bin;E:\BEA\jrockit_150_15\bin;E:\BEA\wlserver_10.0\server\native\win\32\oci920_8
    * To start WebLogic Server, use a username and *
    * password assigned to an admin-level user. For *
    * server administration, use the WebLogic Server *
    * console at http:\\hostname:port\console *
    starting weblogic with Java version:
    java version "1.5.0_15"
    Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_15-b04)
    Java HotSpot(TM) Client VM (build 1.5.0_15-b04, mixed mode)
    "Starting Weblogic with the following arguments"
    E:\BEA\jdk150_15\bin\java -hotspot -Xms1024m -Xmx1024m -XX:PermSize=300m -da -Dplatform.home=E:\BEA\wlserver_10.0 -Dwls.home=E:\BEA\wlserver_10.0\myserver -Dwli.home=E:\BEA\wlserver_10.0\integration -Dweblogic.management.discover=true -Dwlw.iterativeDev= -Dwlw.testConsole= -Dwlw.logErrorsToConsole= -Dweblogic.ext.dirs=E:\BEA\patch_wss110\profiles\default\sysext_manifest_classpath;E:\BEA\patch_wlw1021\profiles\default\sysext_manifest_classpath;E:\BEA\patch_wls1002\profiles\default\sysext_manifest_classpath;E:\BEA\patch_cie640\profiles\default\sysext_manifest_classpath -Dweblogic.management.username=system -Dweblogic.Name=myserver -Djava.security.policy=E:\BEA\wlserver_10.0\server\lib\weblogic.policy weblogic.Server
    <Oct 12, 2011 10:23:51 AM BST> <Notice> <WebLogicServer> <BEA-000395> <Following extensions directory contents added to the end of the classpath:
    E:\BEA\wlserver_10.0\platform\lib\p13n\p13n-schemas.jar;E:\BEA\wlserver_10.0\platform\lib\p13n\p13n_common.jar;E:\BEA\wlserver_10.0\platform\lib\p13n\p13n_system.jar;E:\BEA\wlserver_10.0\platform\lib\p13n\wlp_services.jar;E:\BEA\wlserver_10.0\platform\lib\wlp\netuix_common.jar;E:\BEA\wlserver_10.0\platform\lib\wlp\netuix_schemas.jar;E:\BEA\wlserver_10.0\platform\lib\wlp\netuix_system.jar;E:\BEA\wlserver_10.0\platform\lib\wlp\wsrp-client.jar;E:\BEA\wlserver_10.0\platform\lib\wlp\wsrp-common.jar>
    <Oct 12, 2011 10:23:54 AM BST> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) Client VM Version 1.5.0_15-b04 from Sun Microsystems Inc.>
    <Oct 12, 2011 10:23:57 AM BST> <Info> <Management> <BEA-141107> <Version: WebLogic Server 10.0 MP2 Sat Apr 25 01:45:38 EDT 2009 1213942 >
    <Oct 12, 2011 10:24:03 AM BST> <Info> <WebLogicServer> <BEA-000215> <Loaded License : E:\BEA\license.bea>
    <Oct 12, 2011 10:24:03 AM BST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING>
    <Oct 12, 2011 10:24:04 AM BST> <Info> <WorkManager> <BEA-002900> <Initializing self-tuning thread pool>
    <Oct 12, 2011 10:24:05 AM BST> <Notice> <Log Management> <BEA-170019> <The server log file E:\SPL\CCBDEV\logs\system\myserver.log is opened. All server side log events will be written to this file.>
    <Oct 12, 2011 10:24:15 AM BST> <Notice> <Security> <BEA-090082> <Security initializing using security realm myrealm.>
    <Oct 12, 2011 10:24:30 AM BST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STANDBY>
    <Oct 12, 2011 10:24:30 AM BST> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING>
    <Oct 12, 2011 10:26:42 AM BST> <Warning> <HTTP> <BEA-101304> <Webapp: weblogic.servlet.internal.WebAppServletContext@d90727 - appName: 'SPLWeb', name: '/spl', context-path: '/spl', the role: cisusers defined in web.xml has not been mapped to principals in security-role-assignment in weblogic.xml. Will use the rolename itself as the principal-name.>
    <Oct 12, 2011 10:27:11 AM BST> <Warning> <HTTP> <BEA-101304> <Webapp: weblogic.servlet.internal.WebAppServletContext@10a59d2 - appName: 'SPLWeb', name: '/spl/XAIApp', context-path: '/spl/XAIApp', the role: cisusers defined in web.xml has not been mapped to principals in security-role-assignment in weblogic.xml. Will use the rolename itself as the principal-name.>
    Failed to load servlet Class: org.openspml.v2.transport.RPCRouterServletIgnoring: unable to load class:java.lang.ClassNotFoundException: org.openspml.v2.transport.RPCRouterServlet at: weblogic.xml.schema.binding.util.ClassUtil.loadClass(ClassUtil.java:76)Failed to load servlet Class: org.openspml.v2.transport.RPCRouterServletIgnoring: unable to load class:java.lang.ClassNotFoundException: org.openspml.v2.transport.RPCRouterServlet at: weblogic.xml.schema.binding.util.ClassUtil.loadClass(ClassUtil.java:76)INFO: Loaded log4j.properties from external file E:\SPL\CCBDEV\etc\conf\root\WEB-INF\classes\log4j.properties
    INFO: Loaded spl.properties from external file E:\SPL\CCBDEV\etc\conf\root\WEB-INF\classes\spl.properties: {spl.ejbContainer.url=t3://L-156018395:6500, spl.runtime.options.isDevelopmentMode=false, spl.ejbContainer.password=spladmin, spl.runtime.service.extraInstallationServices=CILTINCP, spl.tools.loaded.applications=base,ccb,cm, spl.runtime.socket.file.dir=E:/SPL/CCBDEV/runtime, spl.runtime.cobol.sql.fetchSize=150, spl.runtime.cobol.cobrcall=false, spl.serviceBean.jndi.name=spl/servicebean, spl.ejbContainer.contextFactory=weblogic.jndi.WLInitialContextFactory, spl.runtime.cobol.encoding=UTF8, spl.runtime.cobol.sql.disableQueryCache=false, spl.ejbContainer.user=system, spl.runtime.utf8Database=true, spl.runtime.fusionlook=true, spl.runtime.environ.init.dir=E:/SPL/CCBDEV/etc, spl.runtime.cobol.sql.cache.maxTotalEntries=1000, spl.runtime.oracle.statementCacheSize=300, spl.runtime.cobol.sql.cursoredCache.maxRows=10, spl.runtime.cobol.remote.jvm=false, spl.runtime.sql.highValue=?}
    - 2011-10-12 10:27:16,367 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO (shared.context.ApplicationMode) Application set to production mode
    - 2011-10-12 10:27:16,422 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO (web.startup.SPLWebStartup) Initializing SPL web application
    - 2011-10-12 10:27:16,694 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO (web.dynamicui.TransformServletHelper) Disable UIPage Compression set to false
    - 2011-10-12 10:27:16,908 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO (support.context.ContextFactory) Creating lightweight context. This context cannot access Java business objects.
    - 2011-10-12 10:27:16,964 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO (support.context.ApplicationContext) Building hibernate configuration
    - 2011-10-12 10:27:17,802 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO (support.context.ApplicationContext) Loaded hibernate.properties from external file E:\SPL\CCBDEV\etc\conf\root\WEB-INF\classes\hibernate.properties
    - 2011-10-12 10:27:17,847 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO (support.context.ApplicationContext) Adding 0 hibernate mappings
    - 2011-10-12 10:27:18,404 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO (support.context.ApplicationContext) Done building hibernate configuration, time 1,440.181 ms
    - 2011-10-12 10:27:18,405 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO (support.context.ApplicationContext) Building hibernate session factory
    - 2011-10-12 10:27:18,409 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO (hibernate.connection.ConnectionProviderFactory) Initializing connection provider: org.hibernate.connection.C3P0ConnectionProvider
    - 2011-10-12 10:27:18,418 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO (hibernate.connection.C3P0ConnectionProvider) C3P0 using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@172.19.84.33:1521:niesdev
    - 2011-10-12 10:27:18,418 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO (hibernate.connection.C3P0ConnectionProvider) Connection properties: {user=cisadm, password=****}
    - 2011-10-12 10:27:18,418 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO (hibernate.connection.C3P0ConnectionProvider) autocommit mode: false
    - 2011-10-12 10:27:20,856 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO (v2.log.MLog) MLog clients using log4j logging.
    - 2011-10-12 10:27:21,437 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO (v2.c3p0.C3P0Registry) Initializing c3p0-0.9.1.2 [built 21-May-2007 15:04:56; debug? true; trace: 10]
    - 2011-10-12 10:27:21,567 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO (c3p0.impl.AbstractPoolBackedDataSource) Initializing c3p0 pool... com.mchange.v2.c3p0.PoolBackedDataSource@2217200b [ connectionPoolDataSource -> com.mchange.v2.c3p0.WrapperConnectionPoolDataSource@d691d4fd [ acquireIncrement -> 1, acquireRetryAttempts -> 30, acquireRetryDelay -> 1000, autoCommitOnClose -> false, automaticTestTable -> null, breakAfterAcquireFailure -> false, checkoutTimeout -> 0, connectionCustomizerClassName -> null, connectionTesterClassName -> com.mchange.v2.c3p0.impl.DefaultConnectionTester, debugUnreturnedConnectionStackTraces -> false, factoryClassLocation -> null, forceIgnoreUnresolvedTransactions -> false, identityToken -> 1br00b48i1wns8gho21ebz|1c95553, idleConnectionTestPeriod -> 0, initialPoolSize -> 1, maxAdministrativeTaskTime -> 0, maxConnectionAge -> 0, maxIdleTime -> 300, maxIdleTimeExcessConnections -> 0, maxPoolSize -> 150, maxStatement
    s -> 0, maxStatementsPerConnection -> 0, minPoolSize -> 1, nestedDataSource -> com.mchange.v2.c3p0.DriverManagerDataSource@d869ae3f [ description -> null, driverClass -> null, factoryClassLocation -> null, identityToken -> 1br00b48i1wns8gho21ebz|1b5d53a, jdbcUrl -> jdbc:oracle:thin:@172.19.84.33:1521:niesdev, properties -> {user=******, password=******} ], preferredTestQuery -> null, propertyCycle -> 0, testConnectionOnCheckin -> false, testConnectionOnCheckout -> false, unreturnedConnectionTimeout -> 0, usesTraditionalReflectiveProxies -> false; userOverrides: {} ], dataSourceName -> null, factoryClassLocation -> null, identityToken -> 1br00b48i1wns8gho21ebz|1715c20, numHelperThreads -> 3 ]
    - 2011-10-12 10:37:26,348 [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#0] WARN (v2.resourcepool.BasicResourcePool) com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@1b1dd12 -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
    java.sql.SQLException: Io exception: Software caused connection abort: recv failed
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:74)
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:131)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:197)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:261)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:566)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:418)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:508)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:203)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:510)
    at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
    at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
    at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
    at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
    at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
    at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
    Caused by: java.net.SocketException: Software caused connection abort: recv failed
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:129)
    at oracle.net.ns.Packet.receive(Packet.java:240)
    at oracle.net.ns.DataPacket.receive(DataPacket.java:92)
    at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:172)
    at oracle.net.ns.NetInputStream.read(NetInputStream.java:117)
    at oracle.net.ns.NetInputStream.read(NetInputStream.java:92)
    at oracle.net.ns.NetInputStream.read(NetInputStream.java:77)
    at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1034)
    at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1010)
    at oracle.jdbc.driver.T4C8TTIdty.receive(T4C8TTIdty.java:516)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:332)
    ... 12 more
    - 2011-10-12 10:37:26,348 [com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread-#1] WARN (v2.resourcepool.BasicResourcePool) com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask@6dbcef -- Acquisition Attempt Failed!!! Clearing pending acquires. While trying to acquire a needed new resource, we failed to succeed more than the maximum number of allowed acquisition attempts (30). Last acquisition attempt exception:
    java.sql.SQLException: Io exception: Software caused connection abort: recv failed
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:74)
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:131)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:197)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:261)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:566)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:418)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:508)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:203)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:510)
    at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:134)
    at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
    at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
    at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
    at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
    at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
    at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
    Caused by: java.net.SocketException: Software caused connection abort: recv failed
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:129)
    at oracle.net.ns.Packet.receive(Packet.java:240)
    at oracle.net.ns.DataPacket.receive(DataPacket.java:92)
    at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:172)
    at oracle.net.ns.NetInputStream.read(NetInputStream.java:117)
    at oracle.net.ns.NetInputStream.read(NetInputStream.java:92)
    at oracle.net.ns.NetInputStream.read(NetInputStream.java:77)
    at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1034)
    at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1010)
    at oracle.jdbc.driver.T4C8TTIdty.receive(T4C8TTIdty.java:516)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:332)
    ... 12 more
    - 2011-10-12 10:37:26,425 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] WARN (hibernate.cfg.SettingsFactory) Could not obtain connection metadata
    java.sql.SQLException: Connections could not be acquired from the underlying database!
    at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:529)
    at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128)
    at org.hibernate.connection.C3P0ConnectionProvider.getConnection(C3P0ConnectionProvider.java:56)
    at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:84)
    at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2090)
    at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2086)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1311)
    at com.splwg.base.support.context.ApplicationContext.buildSessionFactory(ApplicationContext.java:188)
    at com.splwg.base.support.context.ContextFactory.buildContext(ContextFactory.java:113)
    at com.splwg.base.support.context.ContextFactory.createLightweightContext(ContextFactory.java:749)
    at com.splwg.base.web.startup.SPLWebStartup.initializeApplicationContext(SPLWebStartup.java:180)
    at com.splwg.base.web.startup.SPLWebStartup.contextInitialized(SPLWebStartup.java:63)
    at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:458)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(Unknown Source)
    at weblogic.servlet.internal.EventsManager.notifyContextCreatedEvent(EventsManager.java:168)
    at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1744)
    at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:2918)
    at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:973)
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:361)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
    at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:117)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:204)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:60)
    at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
    at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:635)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:26)
    at weblogic.application.internal.BaseDeployment.activate(BaseDeployment.java:212)
    at weblogic.application.internal.DeploymentStateChecker.activate(DeploymentStateChecker.java:154)
    at weblogic.deploy.internal.targetserver.AppContainerInvoker.activate(AppContainerInvoker.java:80)
    at weblogic.deploy.internal.targetserver.BasicDeployment.activate(BasicDeployment.java:182)
    at weblogic.deploy.internal.targetserver.BasicDeployment.activateFromServerLifecycle(BasicDeployment.java:359)
    at weblogic.management.deploy.internal.DeploymentAdapter$1.doActivate(DeploymentAdapter.java:51)
    at weblogic.management.deploy.internal.DeploymentAdapter.activate(DeploymentAdapter.java:196)
    at weblogic.management.deploy.internal.AppTransition$2.transitionApp(AppTransition.java:30)
    at weblogic.management.deploy.internal.ConfiguredDeployments.transitionApps(ConfiguredDeployments.java:233)
    at weblogic.management.deploy.internal.ConfiguredDeployments.activate(ConfiguredDeployments.java:169)
    at weblogic.management.deploy.internal.ConfiguredDeployments.deploy(ConfiguredDeployments.java:123)
    at weblogic.management.deploy.internal.DeploymentServerService.resume(DeploymentServerService.java:173)
    at weblogic.management.deploy.internal.DeploymentServerService.start(DeploymentServerService.java:89)
    at weblogic.t3.srvr.SubsystemRequest.run(SubsystemRequest.java:64)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:200)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:172)
    Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source.
    at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1319)
    at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557)
    at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477)
    at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525)
    ... 46 more
    - 2011-10-12 10:37:26,548 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO (hibernate.dialect.Dialect) Using dialect: org.hibernate.dialect.Oracle10gDialect
    - 2011-10-12 10:37:26,736 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO (hibernate.transaction.TransactionFactoryFactory) Transaction strategy: org.hibernate.transaction.JDBCTransactionFactory
    - 2011-10-12 10:37:26,751 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO (hibernate.transaction.TransactionManagerLookupFactory) No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
    - 2011-10-12 10:37:27,067 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO (hibernate.impl.SessionFactoryImpl) building session factory
    - 2011-10-12 10:37:27,129 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO (hibernate.impl.SessionFactoryObjectFactory) Not binding factory to JNDI, no JNDI name configured
    - 2011-10-12 10:37:27,193 [[ACTIVE] ExecuteThread: '0' for queue: 'weblogic.kernel.Default (self-tuning)'] INFO (support.context.ApplicationContext) Done building hibernate session factory, time 608,776.565 ms(10 min 8.777 sec)
    Please help me out here.
    Any advice please.
    Regards,
    Techie
    Edited by: 815302 on Oct 12, 2011 2:54 AM

    I tried same with tomcat...
    CC&B 2.3.1 with apache tomcat trying to connect with other database.... getting below error
    java.sql.SQLException: Io exception: Software caused connection abort: recv failed
    Oct 17, 2011 4:44:05 PM org.apache.catalina.core.AprLifecycleListener init
    INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: E:\SPL\javaHome\Java\jdk1.5.0_21\bin;.;C:\Windows\system32;C:\Windows;E:\SPL\MicroFocus\Server5.1\Bin;E:\SPL\NIEESDEVL\runtime;E:\SPL\javaHome\Java\jdk1.5.0_21\bin;E:\SPL\NIEESDEVL\runtime;E:\SPL\NIEESDEVL\bin;E:\SPL\NIEESDEVL\product\apache-ant-1.7.0\bin;E:\SPL\javaHome\Java\jdk1.5.0_21\bin;E:\DEMODB\product\11.2.0\dbhome_1\bin;E:\SPL\MicroFocusServer5.1\Bin;E:\SPL\NIEESDEVL\product\apache-ant-1.7.0\bin;C:\csvn\bin\;C:\csvn\Python25\;c:\perl\site\bin;c:\perl\bin;C:\Program Files\PC Connectivity Solution\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Common Files\Reallusion\CamSuite;C:\Program Files\Toshiba\Bluetooth Toshiba Stack\sys\;C:\Program Files\TortoiseSVN\bin;E:\app\prashant\client_1\bin;;C:\PROGRA~1\QAS\QuickAddress Pro Web;E:\BEA;E:\BEA\wlserver_10.0;E:\SPL\hibernate-3.2;E:\SPL\NIEESDEV\bin;E:\BEA\wlserver_10.0\server\bin;C:\Program Files\Microsoft SQL Server\90\Tools\binn\
    Oct 17, 2011 4:44:05 PM org.apache.coyote.http11.Http11Protocol init
    INFO: Initializing Coyote HTTP/1.1 on http-6500
    Oct 17, 2011 4:44:05 PM org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 2005 ms
    Oct 17, 2011 4:44:06 PM org.apache.catalina.core.StandardService start
    INFO: Starting service Catalina
    Oct 17, 2011 4:44:06 PM org.apache.catalina.core.StandardEngine start
    INFO: Starting Servlet Engine: Apache Tomcat/6.0.13
    INFO: Loaded log4j.properties from external file E:\SPL\NIEESDEVL\etc\conf\XAIApp\WEB-INF\classes\log4j.properties
    INFO: Loaded spl.properties from external file E:\SPL\NIEESDEVL\etc\conf\XAIApp\WEB-INF\classes\spl.properties: {spl.runtime.options.isDevelopmentMode=true, spl.runtime.service.extraInstallationServices=CILTINCP, spl.runtime.cobol.remote.jvmcommand=E:/SPL/javaHome/Java/jdk1.5.0_21/bin/java.exe, spl.tools.loaded.applications=base,ccb,cm, spl.runtime.cobol.remote.jvmcount=2, spl.runtime.socket.file.dir=E:/SPL/NIEESDEVL/runtime, spl.runtime.cobol.sql.fetchSize=150, spl.runtime.cobol.cobrcall=false, spl.runtime.initialize.waittime=90, spl.runtime.cobol.encoding=UTF8, spl.runtime.cobol.sql.disableQueryCache=false, spl.runtime.utf8Database=true, spl.runtime.fusionlook=true, spl.runtime.cobol.remote.jvmoptions=-Xmx1024m -server -Dfile.encoding=ISO8859_1 -cp E:/SPL/NIEESDEVL/splapp/standalone/config;E:/SPL/NIEESDEVL/splapp/standalone/lib/activation_api-1.1.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/cm.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/coherence-3.5.2.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/coherence-work-3.5.2.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/commonj-3.5.2.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/commons-beanutils-core-1.7.0.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/commons-cli-1.1.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/commons-codec-1.3.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/commons-collections-2.1.1.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/commons-fileupload-1.2.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/commons-httpclient-2.0.2.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/commons-io-1.3.2.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/commons-lang-2.2.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/commons-logging-1.0.4.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/concurrent-1.3.4.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/dom4j-1.6.1.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/e2Vault.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/hibernate-3.2.7.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/icu4j-3.6.1.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/jaxen-1.1.1.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/jcip-annotations.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/jstl-api-1.2.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/jta.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/jtds-1.2.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/log4j-1.2.15.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/mail_api-1.4.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/mfcobol.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/ojdbc5-11.1.0.7.0.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/orai18n-collation.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/orai18n-mapping.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/orai18n-utility.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/orai18n.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/serializer-2.7.0.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/spl-base-2.2.0.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/spl-ccb-2.3.1.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/spl-servicebeaninterface-2.2.0.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/spl-serviceclient-2.2.0.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/spl-shared-2.2.0.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/spl-spml-2.2.0.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/spl-web-2.2.0.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/spl-xai-2.2.0.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/stax-api-1.0.1.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/stax2.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/staxmate-0.9.1.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/wstx-asl-3.2.1.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/xalan-2.7.0.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/xmlparserv2.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/xquery.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/xstream-1.2.1.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/yjp-controller-api-redist.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/geronimo-spec-j2ee-1.4-rc4.jar, spl.runtime.environ.init.dir=E:/SPL/NIEESDEVL/etc, spl.runtime.cobol.sql.cache.maxTotalEntries=1000, spl.runtime.oracle.statementCacheSize=300, spl.runtime.cobol.remote.rmiStartPort=6503, spl.runtime.cobol.sql.cursoredCache.maxRows=10, spl.runtime.cobol.remote.jvm=true, spl.runtime.cobol.remote.lib.prefix=xaiapp, spl.runtime.sql.highValue=?}
    - 2011-10-17 16:44:12,312 [main] INFO (shared.context.ApplicationMode) Application set to development mode
    - 2011-10-17 16:44:12,325 [main] INFO (web.dynamicui.TransformServletHelper) Disable UIPage Compression set to false
    - 2011-10-17 16:44:12,349 [main] WARN (web.common.ServletHelper) Web app env variable maxAge not defined; defaulting to 1 sec
    - 2011-10-17 16:44:12,356 [main] INFO (web.startup.DeferredXAIStartup) Starting thread for deferred XAI application context initialization
    - 2011-10-17 16:44:12,371 [Thread-1] INFO (web.startup.DeferredXAIStartup) Waiting 90 seconds before starting XAI application context initialization
    INFO: Loaded log4j.properties from external file E:\SPL\NIEESDEVL\etc\conf\root\WEB-INF\classes\log4j.properties
    INFO: Loaded spl.properties from external file E:\SPL\NIEESDEVL\etc\conf\root\WEB-INF\classes\spl.properties: {spl.runtime.options.isDevelopmentMode=true, spl.runtime.service.extraInstallationServices=CILTINCP, spl.runtime.cobol.remote.jvmcommand=E:/SPL/javaHome/Java/jdk1.5.0_21/bin/java.exe, spl.tools.loaded.applications=base,ccb,cm, spl.runtime.cobol.remote.jvmcount=2, spl.runtime.socket.file.dir=E:/SPL/NIEESDEVL/runtime, spl.runtime.cobol.sql.fetchSize=150, spl.runtime.cobol.cobrcall=false, spl.runtime.cobol.encoding=UTF8, spl.runtime.cobol.sql.disableQueryCache=false, com.splwg.grid.online.enabled=false, spl.runtime.utf8Database=true, spl.runtime.fusionlook=true, spl.runtime.cobol.remote.jvmoptions=-Xmx1024m -server -Dfile.encoding=ISO8859_1 -cp E:/SPL/NIEESDEVL/splapp/standalone/config;E:/SPL/NIEESDEVL/splapp/standalone/lib/activation_api-1.1.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/cm.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/coherence-3.5.2.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/coherence-work-3.5.2.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/commonj-3.5.2.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/commons-beanutils-core-1.7.0.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/commons-cli-1.1.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/commons-codec-1.3.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/commons-collections-2.1.1.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/commons-fileupload-1.2.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/commons-httpclient-2.0.2.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/commons-io-1.3.2.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/commons-lang-2.2.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/commons-logging-1.0.4.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/concurrent-1.3.4.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/dom4j-1.6.1.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/e2Vault.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/hibernate-3.2.7.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/icu4j-3.6.1.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/jaxen-1.1.1.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/jcip-annotations.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/jstl-api-1.2.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/jta.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/jtds-1.2.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/log4j-1.2.15.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/mail_api-1.4.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/mfcobol.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/ojdbc5-11.1.0.7.0.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/orai18n-collation.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/orai18n-mapping.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/orai18n-utility.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/orai18n.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/serializer-2.7.0.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/spl-base-2.2.0.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/spl-ccb-2.3.1.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/spl-servicebeaninterface-2.2.0.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/spl-serviceclient-2.2.0.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/spl-shared-2.2.0.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/spl-spml-2.2.0.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/spl-web-2.2.0.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/spl-xai-2.2.0.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/stax-api-1.0.1.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/stax2.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/staxmate-0.9.1.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/wstx-asl-3.2.1.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/xalan-2.7.0.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/xmlparserv2.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/xquery.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/xstream-1.2.1.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/yjp-controller-api-redist.jar;E:/SPL/NIEESDEVL/splapp/standalone/lib/geronimo-spec-j2ee-1.4-rc4.jar, spl.runtime.environ.init.dir=E:/SPL/NIEESDEVL/etc, com.splwg.grid.distThreadPool.threads.DEFAULT=5, spl.runtime.cobol.sql.cache.maxTotalEntries=1000, spl.runtime.oracle.statementCacheSize=300, spl.runtime.cobol.remote.rmiStartPort=6503, spl.runtime.cobol.sql.cursoredCache.maxRows=10, spl.runtime.cobol.remote.jvm=true, com.splwg.batch.scheduler.daemon=false, spl.runtime.sql.highValue=?}
    - 2011-10-17 16:44:18,459 [main] INFO (shared.context.ApplicationMode) Application set to development mode
    - 2011-10-17 16:44:18,473 [main] INFO (web.startup.SPLWebStartup) Initializing SPL web application
    - 2011-10-17 16:44:18,477 [main] INFO (web.dynamicui.TransformServletHelper) Disable UIPage Compression set to false
    - 2011-10-17 16:44:18,522 [main] INFO (support.context.ContextFactory) Creating default context
    - 2011-10-17 16:44:39,053 [main] ERROR (support.context.ContextFactory) Error getting connection to database jdbc:oracle:thin:@172.19.84.33:1521:niesdev, with user cisadm and driver oracle.jdbc.driver.OracleDriver
    java.sql.SQLException: Io exception: Software caused connection abort: recv failed
    at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:74)
    at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:131)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:197)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:261)
    at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:566)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:418)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:508)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:203)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:33)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:510)
    at java.sql.DriverManager.getConnection(DriverManager.java:525)
    at java.sql.DriverManager.getConnection(DriverManager.java:171)
    at com.splwg.base.support.context.ContextFactory.getConnection(ContextFactory.java:134)
    at com.splwg.base.support.context.ContextFactory.getBaseLookupInterfaceNames(ContextFactory.java:143)
    at com.splwg.base.support.context.ContextFactory.buildContext(ContextFactory.java:102)
    at com.splwg.base.support.context.ContextFactory.buildContext(ContextFactory.java:90)
    at com.splwg.base.support.context.ContextFactory.createDefaultContext(ContextFactory.java:498)
    at com.splwg.base.web.startup.SPLWebStartup.initializeApplicationContext(SPLWebStartup.java:178)
    at com.splwg.base.web.startup.SPLWebStartup.contextInitialized(SPLWebStartup.java:63)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4334)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:516)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:592)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
    Caused by: java.net.SocketException: Software caused connection abort: recv failed
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:129)
    at oracle.net.ns.Packet.receive(Packet.java:240)
    at oracle.net.ns.DataPacket.receive(DataPacket.java:92)
    at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:172)
    at oracle.net.ns.NetInputStream.read(NetInputStream.java:117)
    at oracle.net.ns.NetInputStream.read(NetInputStream.java:92)
    at oracle.net.ns.NetInputStream.read(NetInputStream.java:77)
    at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1034)
    at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1010)
    at oracle.jdbc.driver.T4C8TTIdty.receive(T4C8TTIdty.java:516)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:332)
    ... 28 more
    Oct 17, 2011 4:44:39 PM org.apache.catalina.core.StandardContext start
    SEVERE: Error listenerStart
    Oct 17, 2011 4:44:39 PM org.apache.catalina.core.StandardContext start
    SEVERE: Context [] startup failed due to previous errors
    - 2011-10-17 16:44:39,143 [main] INFO (web.startup.SPLWebStartup) Shutting Down the JMX Connectors...
    - 2011-10-17 16:44:39,161 [main] INFO (web.startup.SPLWebStartup) JMX Connectors shutdown successfully
    - 2011-10-17 16:44:39,162 [main] INFO (web.startup.SPLWebStartup) Shutting Down the Application Context...
    - 2011-10-17 16:44:39,183 [main] INFO (web.startup.SPLWebStartup) Application Context shutdown successfully
    Oct 17, 2011 4:44:39 PM org.apache.coyote.http11.Http11Protocol start
    INFO: Starting Coyote HTTP/1.1 on http-6500
    Oct 17, 2011 4:44:39 PM org.apache.jk.common.ChannelSocket init
    INFO: JK: ajp13 listening on /0.0.0.0:8009
    Oct 17, 2011 4:44:39 PM org.apache.jk.server.JkMain start
    INFO: Jk running ID=0 time=0/29 config=null
    Oct 17, 2011 4:44:39 PM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 34150 ms

  • Help Please!! Not able to connect to database from servlets

    Hi all,
    I hava placed a servlet which connects to a database in examples\web-inf\classes dir. I have specified everything in web.xml. But when I run the servlet it says no suitable driver found even though I have placed the driver tomcat/common\lib\classes12.zip in my classpath . I have also trtied converting the file to jar and running the servlet but I am not able to get the connection to database.
    I get the following error.
    Starting service Tomcat-Standalone
    Apache Tomcat/4.0.6
    Starting service Tomcat-Apache
    Apache Tomcat/4.0.6
    Error in init:oracle.jdbc.driver.OracleDriver
    java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1406)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1254)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:313)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:120)
    at testConnectionServlet.init(testConnectionServlet.java:19)
    at javax.servlet.GenericServlet.init(GenericServlet.java:256)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:918)
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:655)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:475)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
    at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
    at java.lang.Thread.run(Thread.java:484)
    Error in init:No suitable driver
    java.sql.SQLException: No suitable driver
    at java.sql.DriverManager.getConnection(DriverManager.java:537)
    at java.sql.DriverManager.getConnection(DriverManager.java:177)
    at testConnectionServlet.init(testConnectionServlet.java:27)
    at javax.servlet.GenericServlet.init(GenericServlet.java:256)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:918)
    at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:655)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:475)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
    at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
    at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
    at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
    at java.lang.Thread.run(Thread.java:484)

    after inserting the line in the classpath for classes12.zip try the whole proc again. if it does not work then u should try putting it in the jdk lib dir and if ok can put it also in the \jdk1.3\jre\lib and \jdk1.3\jre\lib\ext dirs....
    it has worked perfectly for me and i dont c any reason that it should not do for u also.

  • Problem in accessing database using a java class

    Hy Folks,
    I have written a class to retrive data from data base and compiled it.when I said java QueryExample, I am getting the following error message.It is as below.
    E:\>java QueryExample
    Loading JDBC Driver -> oracle.jdbc.driver.OracleDriver
    java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:299)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:286)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:255)
    at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:315)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Class.java:120)
    at QueryExample.<init>(QueryExample.java:37)
    at QueryExample.main(QueryExample.java:129)
    Creating Statement...
    Exception in thread "main" java.lang.NullPointerException
    at QueryExample.performQuery(QueryExample.java:70)
    at QueryExample.main(QueryExample.java:130)
    Now my question is can I run a jdbc program with out using any application server or webserver.
    If I can , what are all the packeages I have to down load, and how to set their classpath.
    Regards,
    Olive.

    My basic doubght is can we write a class like this.Here I give the sample code that I am using,,,, and using Oracle9i for Windows release 2 (9.2) .
    // QueryExample.java
    import java.sql.DriverManager;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    * The following class provides an example of using JDBC to perform a simple
    * query from an Oracle database.
    public class QueryExample {
    final static String driverClass = "oracle.jdbc.driver.OracleDriver";
    final static String connectionURL = "jdbc:oracle:thin:@localhost:1521:O920NT";
    final static String userID = "scott";
    final static String userPassword = "tiger";
    Connection con = null;
    * Construct a QueryExample object. This constructor will create an Oracle
    * database connection.
    public QueryExample() {
    try {
    System.out.print(" Loading JDBC Driver -> " + driverClass + "\n");
    Class.forName(driverClass).newInstance();
    System.out.print(" Connecting to -> " + connectionURL + "\n");
    this.con = DriverManager.getConnection(connectionURL, userID, userPassword);
    System.out.print(" Connected as -> " + userID + "\n");
    } catch (ClassNotFoundException e) {
    e.printStackTrace();
    } catch (InstantiationException e) {
    e.printStackTrace();
    } catch (IllegalAccessException e) {
    e.printStackTrace();
    } catch (SQLException e) {
    e.printStackTrace();
    * Method to perform a simply query from the "emp" table.
    public void performQuery() {
    Statement stmt = null;
    ResultSet rset = null;
    String queryString = "SELECT name, date_of_hire, monthly_salary " +
    "FROM emp " +
    "ORDER BY name";
    try {
    System.out.print(" Creating Statement...\n");
    stmt = con.createStatement ();
    System.out.print(" Opening ResultsSet...\n");
    rset = stmt.executeQuery(queryString);
    int counter = 0;
    while (rset.next()) {
    System.out.println();
    System.out.println(" Row [" + ++counter + "]");
    System.out.println(" ---------------------");
    System.out.println(" Name -> " + rset.getString(1));
    System.out.println(" Date of Hire -> " + rset.getString(2));
    System.out.println(" Monthly Salary -> " + rset.getFloat(3));
    System.out.println();
    System.out.print(" Closing ResultSet...\n");
    rset.close();
    System.out.print(" Closing Statement...\n");
    stmt.close();
    } catch (SQLException e) {
    e.printStackTrace();
    * Close down Oracle connection.
    public void closeConnection() {
    try {
    System.out.print(" Closing Connection...\n");
    con.close();
    } catch (SQLException e) {
    e.printStackTrace();
    * Sole entry point to the class and application.
    * @param args Array of String arguments.
    * @exception java.lang.InterruptedException
    * Thrown from the Thread class.
    public static void main(String[] args)
    throws java.lang.InterruptedException {
    QueryExample qe = new QueryExample();
    qe.performQuery();
    qe.closeConnection();
    }

  • How to connect sql database with Flash

    Dear Friends,
    Iam working on a quessinarie (assesment) for elearning software. i want to connect sql database with flash and save my records in back end like add, delete, modification of student result and details.
    Kindly help me to connect the sql database. or dot net server. I know how to connect PHP and mysql. But my client dont want php. only sql database and do the add, del, modificaiton.
    Thanks in advance,
    Syed Abdul Rahim

    unfortunately no, i do not know ASP well enough to give any code advice, other than the basic concept:  make a request on a server-side script (such as ASP) via URLLoader - the script receives variable values (if required), runs the DB queries you wish to invoke, and 'returns' the results - pick them up in the URLVariables class via the event handler in Flash and assign them to local properties if needed, etc.
    there are quite a few threads that you could find more specific information on the ASP side, here and elsewhere around the net.

  • Need to Connect oracle database through EP

    Hi,
    my requirement is trying to connect oracle database and getting values from oracle database and displaying in portal (through EP)
    i created driver name called - sapdirect and import the jars like pOracle.jar in the driver and then i'll try to create datasource with the following configurations
    Name : sapdsn
    Aliases : sapalias
    Driver name: selected whatever i created before (ex: sapdirect)
    class : com.sap.portals.jdbc.oracle.OracleDriver
    url : jdbc:sap:oracle://10.145.4.171:1521;RAMS
    user name :scott
    password :tiger
    But the datasource can't create , the follwing error shown,
    Please gimme Solution for this.
    Even, all the services running oracle m/c.
    im wating for solution,
    Thanks in advance
    Bye for now
    Vasu
    Error:
    java.rmi.RemoteException: Error occurred while starting application in whole cluster and wait.; nested exception is:
    com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Clusterwide execption: server ID 3739150:Exception while preparing start of application sap.com/JDBCConnector_sapdsn.xml.
    at com.sap.engine.services.deploy.server.DeployCommunicatorImpl.startApplicationAndWait(DeployCommunicatorImpl.java:679) at com.sap.engine.services.deploy.server.DeployCommunicatorImpl.startApplicationAndWait(DeployCommunicatorImpl.java:661) at com.sap.engine.services.dbpool.deploy.DataSourceManagerImpl.startApplication(DataSourceManagerImpl.java:562) at com.sap.engine.services.dbpool.deploy.DataSourceManagerImpl.deploy(DataSourceManagerImpl.java:261) at com.sap.engine.services.dbpool.deploy.DataSourceManagerImpl.createDataSource(DataSourceManagerImpl.java:317) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.sap.pj.jmx.introspect.DefaultMBeanInvoker.invoke(DefaultMBeanInvoker.java:58) at com.sap.pj.jmx.mbeaninfo.AdditionalInfoProviderMBean.invoke(AdditionalInfoProviderMBean.java:289) at com.sap.pj.jmx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:944) at com.sap.pj.jmx.server.interceptor.MBeanServerWrapperInterceptor.invoke(MBeanServerWrapperInterceptor.java:288) at com.sap.engine.services.jmx.CompletionInterceptor.invoke(CompletionInterceptor.java:400) at com.sap.engine.services.jmx.RedirectInterceptor.invoke(RedirectInterceptor.java:340) at com.sap.pj.jmx.server.interceptor.MBeanServerInterceptorChain.invoke(MBeanServerInterceptorChain.java:330) at com.sap.engine.services.jmx.MBeanServerSecurityWrapper.invoke(MBeanServerSecurityWrapper.java:287) at com.sap.engine.services.jmx.MBeanServerInvoker.invokeMbs(MBeanServerInvoker.java:157) at com.sap.engine.services.jmx.ClusterInterceptor.invokeMbs(ClusterInterceptor.java:220) at com.sap.engine.services.jmx.ClusterInterceptor.invoke(ClusterInterceptor.java:803) at com.sap.engine.services.jmx.MBeanServerInterceptorInvoker.invokeMbs(MBeanServerInterceptorInvoker.java:102) at com.sap.engine.services.jmx.connector.p4.P4ConnectorServerImpl.invokeMbs(P4ConnectorServerImpl.java:61) at com.sap.engine.services.jmx.connector.p4.P4ConnectorServerImplp4_Skel.dispatch(P4ConnectorServerImplp4_Skel.java:64) at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:291) at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:183) at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:119) at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37) at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71) at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37) at java.security.AccessController.doPrivileged(Native Method) at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94) at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)Caused by: com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Clusterwide execption: server ID 3739150:Exception while preparing start of application sap.com/JDBCConnector_sapdsn.xml.
    at com.sap.engine.services.deploy.server.application.ParallelAdapter.sleepClientThread(ParallelAdapter.java:232) at com.sap.engine.services.deploy.server.application.ParallelAdapter.runInTheSameThread(ParallelAdapter.java:113) at com.sap.engine.services.deploy.server.application.ParallelAdapter.makeAllPhasesAndWait(ParallelAdapter.java:214) at com.sap.engine.services.deploy.server.DeployServiceImpl.startApplicationAndWait(DeployServiceImpl.java:4601) at com.sap.engine.services.deploy.server.DeployCommunicatorImpl.startApplicationAndWait(DeployCommunicatorImpl.java:677) ... 31 more

    Go to System Administration
    -> System Configuration
    -> System Landscape
    -> select a Folder where you want to store your system object
    -> right click -> New System
    -> in the wizard, select JDBC System
    -> enter values
    -> edit
    Then fill in the correct values as stated here:
    http://help.sap.com/saphelp_nw04/helpdata/en/84/d5df3df2ad685ae10000000a11405a/frameset.htm
    Then assign an Alias and enter some usermapping data for the system.
    You then can use the ConnectorService to get a native sql connection and fire statements. I'm sure you can find some examples here.
    Regards, Karsten

  • Not able to connect to database using jdbc

    Respected sir/madam,
    I am new to java and i am trying to connect to database which is necessary for me in project when i wrote the code using class.forName i am able to compile but when runnig i am getting two exceptionns one is oracle.jdbc.driver.oracledriver not found or excetion in thread main class not found please help me

    Subash,
    1) Please refrain from cross-posting (posting the same message into two or more forums). This question was better asked in the JDBC forum as you eventually put it but you already posted here so if that happens again next time just leave the original thread be.
    2) Your compilation classpath and your runtime classpath are not related. As a matter of fact with well written JDBC code and under most conditions you should not need your driver in your compilation classpath at all, only your runtime one.
    3) Your driver is not in your runtime classpath. That is the error that you need to resolve.

  • Connecting to database help

    First let me say sorry as i have already started this post in another thread, but know one seems to be replying to it any more. the other thread can be found out: http://forum.java.sun.com/thread.jspa?messageID=9413573
    package coreservlets;
    public class Catalog {
    private static CatalogItem[] items =
        {new CatalogItem
            ("hall002",
             "<I>Core Web Programming, 2nd Edition</I> " +
               "by Marty Hall and Larry Brown",
             "One stop shopping for the Web programmer. " +
               "Topics include \n" +
               "<UL><LI>Thorough coverage of Java 2; " +
               "including Threads, Networking, Swing, \n" +
               "Java 2D, RMI, JDBC, and Collections\n" +
               "<LI>A fast introduction to HTML 4.01, " +
               "including frames, style sheets, and layers.\n" +
               "<LI>A fast introduction to HTTP 1.1, " +
               "servlets, and JavaServer Pages.\n" +
               "<LI>A quick overview of JavaScript 1.2\n" +
               "</UL>",
             49.99),
          new CatalogItem
            ("lewis001",
             "<I>The Chronicles of Narnia</I> by C.S. Lewis",
               "The classic children's adventure pitting " +
               "Aslan the Great Lion and his followers\n" +
               "against the White Witch and the forces " +
               "of evil. Dragons, magicians, quests, \n" +
               "and talking animals wound around a deep " +
               "spiritual allegory. Series includes\n" +
               "<I>The Magician's Nephew</I>,\n" +
               "<I>The Lion, the Witch and the Wardrobe</I>,\n" +
               "<I>The Horse and His Boy</I>,\n" +
               "<I>Prince Caspian</I>,\n" +
               "<I>The Voyage of the Dawn Treader</I>,\n" +
               "<I>The Silver Chair</I>, and \n" +
               "<I>The Last Battle</I>.",
             19.95),
          new CatalogItem
            ("alexander001",
             "<I>The Prydain Series</I> by Lloyd Alexander",
               "Humble pig-keeper Taran joins mighty " +
               "Lord Gwydion in his battle against\n" +
               "Arawn the Lord of Annuvin. Joined by " +
               "his loyal friends the beautiful princess\n" +
               "Eilonwy, wannabe bard Fflewddur Fflam," +
               "and furry half-man Gurgi, Taran discovers " +
               "courage, nobility, and other values along\n" +
               "the way. Series includes\n" +
               "<I>The Book of Three</I>,\n" +
               "<I>The Black Cauldron</I>,\n" +
               "<I>The Castle of Llyr</I>,\n" +
               "<I>Taran Wanderer</I>, and\n" +
               "<I>The High King</I>.",
             19.95),
          new CatalogItem
            ("rowling001",
             "<I>The Harry Potter Series</I> by J.K. Rowling",
             "The first five of the popular stories " +
               "about wizard-in-training Harry Potter\n" +
               "topped both the adult and children's " +
               "best-seller lists. Series includes\n" +
               "<I>Harry Potter and the Sorcerer's Stone</I>,\n" +
               "<I>Harry Potter and the Chamber of Secrets</I>,\n" +
               "<I>Harry Potter and the " +
               "Prisoner of Azkaban</I>,\n" +
               "<I>Harry Potter and the Goblet of Fire</I>, and\n" +
               "<I>Harry Potter and the "+
               "Order of the Phoenix</I>.\n",
             59.95)
      public static CatalogItem getItem(String itemID) {
        CatalogItem item;
        if (itemID == null) {
          return(null);
        for(int i=0; i<items.length; i++) {
          item = items;
    if (itemID.equals(item.getItemID())) {
    return(item);
    return(null);
    Using the above servlet and this one:
    package coreservlets
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class browser extends HttpServlet {
      public void doGet(HttpServletRequest request,
                        HttpServletResponse response)
          throws ServletException, IOException {
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
         Connection conn = null;
         try{
             Class.forName("com.mysql.jdbc.Driver").newInstance();
         } catch(Exception e) {
             System.out.println(e);
         // connecting to database
         try{
             conn = DriverManager.getConnection
            ("jdbc:mysql://MY WEB ADDRESS FOR THE SQL TABLES GOES HERE");
              // System.out.println("Connection to database successful.");
           catch(SQLException se) {
             System.out.println(se);
         try{
              // Get the category from the input form
              String categoryString = request.getParameter("category");
              // check if no category
              if (categoryString == "") categoryString = "Action & Adventure";
             String selectSQL = "select title, director, rating, year_released, price, stock_count, image_name "+
                                "from video_recordings "+
                                "where category = '" + categoryString + "'";
             Statement stmt = conn.createStatement();
             ResultSet rs1 = stmt.executeQuery(selectSQL);
          // output html headers
          String title = "Films in the " + categoryString + " genre" ;
           out.println(ServletUtilities.headWithTitle(title) +
                    "><BODY BGCOLOR=\"#a00e0e\">\n" +
                  "<center><img src=\"http://localhost:8080/examples/pic.jpg\" width=350 height=200/></center>\n" +
                    "<H1 ALIGN=\"CENTER\">" + title + "</H1>\n");
           out.println("<TABLE BORDER=1 ALIGN=\"CENTER\">\n" +
                    "<TR BGCOLOR=\"#FFAD00\">\n" +
                    "  <TH>Title\n" +
                    "  <TH>Director\n" +
                  "  <TH>Rating\n" +
                  "  <TH>Year Released\n" +
                  "  <TH>Price\n" +
                  "  <TH>Number in stock\n" +
                    "  <TH>image name"
    // Retrieve the results
             while(rs1.next()){
                  out.println("<TR>" +
                              "<TD>" + rs1.getString("title") + "</TD>" +
                              "<TD>" + rs1.getString("director") + "</TD>" +
                            "<TD>" + rs1.getString("rating") + "</TD>" +
                            "<TD>" + rs1.getDouble("year_released") + "</TD>" +
                            "<TD>" + rs1.getString("price") + "</TD>" +
                               "<TD>" + rs1.getString("stock_count") + "</TD>" +
                              "<TD>" + rs1.getString("image_name")  +"</TD>\n");
                             "<TD> <IMG SRC=\"../images/music/" + image_name +"\">"
        // close the html
        out.println("</TABLE></BODY></HTML>");
    // Close the stament and database connection
             stmt.close();
             conn.close();
         } catch(SQLException se) {
             System.out.println(se);
      }How do i merge these two together so that a catalogItem is created by connecting to the database and uses the select statement?? If any one can help me here i would be really grateful as i am having real trouble with this.

    Below is what i have come up with (I cut out the code that just gets in the way for this post, eg the connect to database and import statements) My problem is this would only work once has i need to add the item to the array addedItem in the first for loop, can anybody help me with this has i have tried a number of ways but can't get it to compile.
    private static CatalogItem[] addedItem
    private static CatalogItem[] ItemsInCat;
    CatalogItem item;
    CatalogItem details;
            int recordingidDB;
         String directorDB;
         String titleDB;
         String categoryDB;
         String imageDB;
         int durationDB;
         String ratingDB;
         String yearDB;
         float priceDB;
         int StockDB;
    // Create select statement and execute it
         try{
             String selectSQL = "select title, director, rating, year_released, price, stock_count, image_name "+
                                "from video_recordings " + "'";
             Statement stmt = conn.createStatement();
             ResultSet rs1 = stmt.executeQuery(selectSQL);
             while(rs1.next()){
              recordingidDB = rs1.getInt("recording_id");
              directorDB = rs1.getString("director");
              titleDB = rs1.getString("title");
              categoryDB = rs1.getString("category");
              imageDB = rs1.getString("image_name");
              durationDB = rs1.getInt("duration");
              ratingDB = rs1.getString("rating");
              yearDB = rs1.getString("year_released");
              priceDB = rs1.getFloat("price");
              stockDB = rs1.getInt("stock_count");
               item =
               new CatalogItem
                  (recordingidDB, directorDB,titleDB, categoryDB, imageDB, durationDB, ratingDB, yearDB, priceDB, stockDB);
         String title = "Catalog Items";
    out.println(ServletUtilities.headWithTitle(title) +
                    "<BODY BGCOLOR=\"#a00e0e\">\n" +
                  "<center><img src=\"http://localhost:8080/examples/img.jpg\" width=350 height=200/></center>\n" +
                    "<H1 ALIGN=\"CENTER\">" + title + "</H1>\n");
         // loop to go over each item in the array of catalogItem
             for  (int i=0; i < ItemsInCat.length; i++) {
               out.println("__________________________");
               details = item;
         if (details == null) {
    out.println("SORRY THERE HAS BEEN AN ERROR ");
         } else {       
    addedItem[] // needd to store item in array here
         out.println(titleDB + "\n" + priceDB + "\n");
         out.println("</BODY></HTML>");
         public static CatalogItem getItem(int recordingidDB) {
         CatalogItem item;
    for(int i=0; i<itemsInCat.length; i++) {
    item = itemsInCat[i];
    if (recordingidDB.equals(item.getItemID())) {
    return(item);
    return(null);
    // Close the stament and database connection

  • Problem connecting to database

    When I run the belwo code, though it gives me the message "Connected", when later in the program I try to use db_conn for praparing a statement, it gives me null pointer exception.
    public Connection getConnection()
    try {
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    String url = "jdbc:mysql:///" + "UNIVERSITY";
    String user = "root";
    String pass = "welcome123";
    db_conn = DriverManager.getConnection(url,user,pass);
    if((db_conn != null)&&(!db_conn.isClosed())) {
    System.out.println("Connected..."); }
    return db_conn;
    catch(Exception e) {
    System.out.println("Error in connecting to database " + e);     
    System.exit(1); }
    return null;
    I've very little knowledge of JDBC and can't fiure out what's wrong in there. Any help is really appreciated.
    Thanks

    Don't crosspost:
    http://forum.java.sun.com/thread.jspa?threadID=790394&messageID=4491427#4491427

  • Database DAO - JDBC Query Class - Code review please

    I use the following class (Database.java) as a DAO for handling all database calls. The class works. You can use this if you're looking for a DAO solution (i.e. a way to query databases using connection pools / JNDI). I am looking for some suggestions on improving this class. Can you help? I.e. suggestions for improving SELECT speed, logic? The class is used by a moderately heavily used Web application (ca. 2000 - 3000 queries a day - so not too much) on a Sun Web Server system.
    This class had the following interfaces:
    getErrors() // for retrieving any errors that occurred during an query
    setSql() // one way to set the SQL that must be run
    setDbName() // one way to set the JNDI name of the database resource
    getInsertDelete() // run the INSERT/DELETE statement that was provided with setSql
    getInsertDelete(String givenSql, String givenDb) // run with provided sql and db
    getClobInsert(String givenSql, String givenDb, Hashtable clobHash, String identifierSql) // clobHash contains the column name and the value (which is a string over 4000 chars). Identifier SQL is the SQL for identifying the row, into which the Clob must be inserted. This interface is specific to Oracle.
    getSelect() // Query database with set SQL. Return as a vector of hashes so I can close connection.
    getSelect(String givenSql, String givenDb) // select with given sqlAnd here is the full class. I know, this is a weird post, but we don't really have a code review process here at work, and I don't have a specific problem. Just want some feedback concerning the way I query our databases. So, any tips or comments are welcome.
    package melib.network;
    import java.io.Writer;
    import java.io.StringReader;
    import java.io.IOException;
    import java.util.Vector;
    import java.util.Hashtable;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.ResultSetMetaData;
    import java.sql.Clob;
    import javax.sql.DataSource;
    import javax.naming.InitialContext;
    import melib.system.PropertiesReader; // This is just a simple class for pulling values from a .properties file
    * Manages database connections.
    * @author jetcat33
    * @version 2.0, 2006-07-09
    public class Database {
        protected String sql = "";
        protected String dbName = "";
        private StringBuffer errors = new StringBuffer();
        /** Creates a new instance of Database */
        public Database() {
         * Check completeness of data
         * for example to check if dbname given or
         * sql given or to make sure that yikes
         * used instead of sccweb in test conditions
        protected boolean checkData(){
            if(dbName.equals("") || sql.equals("")){
                Email.sendMail(PropertiesReader.getValue("statusEmail"),null,"MelibLibraryError","melib error: [Database]","No database selected for query (db: "+dbName+" or sql not included (sql: "+sql+")");
                setErrors("No database selected for query (db: "+dbName+" or sql not included (sql: "+sql+")");
                return false;
            }else{
                return true;
         * Sets and gets errors resulting from
         * exceptions - otherwise would have to
         * somehow include errors in the results
         * that are returned but that would include
         * other more complicated stuff.
        private void setErrors(String e){
            errors.append("\n"+e);
        public StringBuffer getErrors(){
           return errors;
         * Setter for the sql variable.
         * @param givenSql The sql required to process
        public void setSql(java.lang.String givenSql) {
            sql = givenSql;
         * Sets the dbName needed to commect
         * to the correct database.
         * @param givenDbName Name of the database - name and connections specified within this class
        public void setDbName(java.lang.String givenDbName) {
            dbName = givenDbName;
         * Processes Insert and Delete requests with given SQL and DB Name.
         * @param givenSql
         * @param givenDbName
         * @return String Number of rows affected
        public String getInsertDelete(String givenSql, String givenDbName){
            sql = givenSql;
            dbName = givenDbName;
            return getInsertDelete();
         * Takes care of insert, update and delete requests.
         * Must have set both dbName as well as the sql String.
         * Will return number of rows affected as String.
         * @return String Number of rows affected
         * @exception Exception
        public String getInsertDelete() {
            int returnValue = 0;
            if(checkData()){
                Connection conn = null;
                InitialContext initContext = null;
                DataSource source = null;
                Statement stmt = null;
                try{
                    // Get connection from configured pool
                    initContext = new InitialContext();
                    source = (DataSource) initContext.lookup("java:comp/env/jdbc/" + dbName);
                    conn = source.getConnection();
                    if(conn != null){
                        stmt = conn.createStatement();
                        returnValue = stmt.executeUpdate(sql);
                }catch (Exception e){
                    Email.sendMail(PropertiesReader.getValue("statusEmail"),null,"MelibLibraryError","melib error: [Database.getInsertDelete]","getInsertDelete Exception: "+e.toString()+"\nWith: "+sql);
                    setErrors(e.toString());
                }finally{
                    try{
                        stmt.close();
                    }catch(Exception e){
                        e.printStackTrace();
                    try{
                        conn.close();
                    }catch(Exception e){
                       e.printStackTrace();
                    try{
                        initContext.close();
                    }catch(Exception e){
                        e.printStackTrace();
            return returnValue+"";
         * Processes Insert requests for SQL containing CLOBS
         * @param givenSql
         * @param givenDbName
         * @param clobHash Contains column name of clob and clob text
         * @param identifierSql Contains SQL to identify the just entered SQL so the clobs can be filled in.
         * @return String Number of rows affected
        public String getClobInsert(String givenSql, String givenDbName, Hashtable clobHash, String identifierSql){
            sql = givenSql;
            dbName = givenDbName;
            String returnValue="";
            int rv = 0;
            if(checkData()){
                Connection conn = null;
                InitialContext initContext = null;
                DataSource source = null;
                Statement stmt = null;
                try{
                    // Get connection from configured pool
                    initContext = new InitialContext();
                    source = (DataSource) initContext.lookup("java:comp/env/jdbc/" + dbName);
                    conn = source.getConnection();
                    if(conn != null){
                        conn.setAutoCommit(false);
                        stmt = conn.createStatement();
                        rv = stmt.executeUpdate(sql); // write first time
                        // Now get and overwrite "EMPTY_CLOB()"
                        ResultSet lobDetails = stmt.executeQuery(identifierSql);
                        ResultSetMetaData rsmd = lobDetails.getMetaData();
                        if(lobDetails.next()){
                            for(int i = 1; i <= rsmd.getColumnCount(); i++){
                                if(clobHash.get(rsmd.getColumnName(i))!=null && !clobHash.get(rsmd.getColumnName(i)).equals("")){
                                    Clob theClob = lobDetails.getClob(i);
                                    Writer clobWriter = ((oracle.sql.CLOB)theClob).getCharacterOutputStream();
                                    StringReader clobReader = new StringReader((String) clobHash.get(rsmd.getColumnName(i)));
                                    char[] cbuffer = new char[30* 1024]; // Buffer to hold chunks of data to be written to Clob, the slob
                                    int nread = 0;
                                    try{
                                        while((nread=clobReader.read(cbuffer)) != -1){
                                            clobWriter.write(cbuffer,0,nread);
                                    }catch(IOException ioe){
                                       //System.out.println("E: clobWriter exception - " + ioe.toString());
                                    }finally{
                                        try{
                                            returnValue+=" Writing: "+rsmd.getColumnName(i);
                                            clobReader.close();
                                            clobWriter.close();
                                        }catch(IOException ioe2){
                                            //System.out.println("E: clobWriter close exception - " + ioe2.toString());
                        conn.commit();
                }catch (Exception e){
                    Email.sendMail(PropertiesReader.getValue("statusEmail"),null,"MelibLibraryError","melib error: [Database.getClobInsert]","getClobInsert Exception: "+e.toString()+"\nWith: "+sql+"\nAND\n"+identifierSql);
                    setErrors(e.toString());
                }finally{
                    try{
                        stmt.close();
                    }catch(Exception e){
                        e.printStackTrace();
                    try{
                        conn.close();
                    }catch(Exception e){
                       e.printStackTrace();
                    try{
                        initContext.close();
                    }catch(Exception e){
                        e.printStackTrace();
                returnValue=rv+" "+returnValue;
            return returnValue;
         * Takes care of Select statements.
         * Must have set both dbName as well as the sql String.
         * Will return a vector.
         * @return Vector of Hashes containing the Results of the query
         * @exception SQLException
         * @exception Exception
        public Vector getSelect(){
            Vector returnValue = new Vector();
            if(checkData()){
                Connection conn = null;
                InitialContext initContext = null;
                DataSource source = null;
                ResultSet result = null;
                ResultSetMetaData rsmd = null;
                Statement stmt = null;
                try{
                    // Get connection from configured pool
                    initContext = new InitialContext();
                    source = (DataSource) initContext.lookup("java:comp/env/jdbc/" + dbName);
                    conn = source.getConnection();
                    if(conn != null){
                        stmt = conn.createStatement();
                        result = stmt.executeQuery(sql);
                        rsmd = result.getMetaData();
                        while(result.next()){
                            Hashtable hash = new Hashtable();
                            for(int i = 1; i <= rsmd.getColumnCount(); i++){
                                if(result.getString(i) != null){
                                    hash.put(rsmd.getColumnName(i),result.getString(i));
                                }else{
                                    hash.put(rsmd.getColumnName(i),"");
                            returnValue.addElement(hash);
                }catch (Exception e){
                    Email.sendMail(PropertiesReader.getValue("statusEmail"),null,"MelibLibraryError","melib error: [Database.getSelect]","getSelect Exception: "+e.toString()+"\nWith: "+sql);
                    setErrors(e.toString());
                }finally{
                    try{
                        result.close();
                    }catch(Exception e){
                        e.printStackTrace();
                        setErrors(e.toString());
                    try{
                        stmt.close();
                    }catch(Exception e){
                        e.printStackTrace();
                        setErrors(e.toString());
                    try{
                        conn.close();
                    }catch(Exception e){
                       e.printStackTrace();
                       setErrors(e.toString());
                    try{
                        initContext.close();
                    }catch(Exception e){
                        e.printStackTrace();
                        setErrors(e.toString());
            return returnValue;
         * Takes care of Select statements with given SQL.
         * Must have set both dbName as well as the sql String.
         * Will return a vector.
         * @return Vector with Results of the query
         * @exception SQLException
         * @exception Exception
        public Vector getSelect(String givenSql, String givenDbName){
            sql = givenSql;
            dbName = givenDbName;
            return getSelect();
    }Thank you,
    dailysun

    too much code that's repeated. refactor all the code you have for closing resources into a utility class and simply call its methods.
    your dao creates the connection, so it can't participate in a transaction. if there are several daos that should be one unit of work, you can't manage it with this framework.
    transactions are under the control of a service layer. I think it's better to have the service object get the connection, pass it to all the DAOs needed for that unit of work, and then have the service close it.
    e-mailing errors? I don't like it. if you have 2-3K queries a day failing because the database you'll have 2-3K e-mails to delete. better to log messages. if you really want e-mail, you can have Log4J add an e-mail appender. at least that way it's configurable outside the code.
    CRUD operations without an UPDATE? You're missing something important.
    What if I don't want to get the database from a JNDI datasource? Now you can't use this DAO without an app server.
    Your error messages are less informative than a stack trace. Why not throw an exception with detailed info?
    have a look at Spring and how it handles persistence. if you insist on writing your own, might want to look at Spring. Rod Johnson has developed a much better, more general way to handle persistence.
    http://www.springframework.org
    You return a Vector of Hashtables for queries? Two old-school data structures. You understand the implication of choosing those, right? I'd recommend that you change that to a List of Maps. Let the concrete types be ArrayList and HashMap. Interfaces are preferred, because they let you change the implementation without affecting clients. Vector and Hashtable are synchronized by default; ArrayList and HashMap are not. Synchronization is thread safe but slower.
    I understand why you chose to return Vector, because you wanted something general that wouldn't force you to deal with object-relational mapping. This way you can just worry about ResultSetMetaData.
    A Vector of Hashtables is a row-based view of the ResultSet (one Hashtable per row). Sometimes a column based view can be more convenient. Then it's a Map of Lists.
    You gave it a good try, but I think there's a lot of room for improvement.
    %

  • Forms not connecting to database in browser

    Hi All
    I have got Oracle9i Personal Database and Oracle Developer installed on my Windows XP professional machine.
    I can connect to the database in SQL*Plus and I can connect to the databse to compile the form, but when the browser opens all I get is a big blank green square. The applet has initialised and the java icon has loaded into the task bar, but no information. I also noticed in the address bar that the name of my database is not there. i.e username/password@<database name>&buffer_record etc. If I add the name of the database in the address I then get login dialog box the TNS protocol adapter error message pops up.
    I have OC4J running and I can get to the main page if I don't add the form name which tells me the server is running, but nothing in the browser.
    Any help or hints would be appreciated

    Here is the output
    Driver loaded
    Authorising for: test - testpass
    Protocol connecting to database
    Exception in Protocol: java.sql.SQLException: No suitable driver
    java.sql.SQLException: No suitable driver
         at java.sql.DriverManager.getConnection(DriverManager.java:532)
         at java.sql.DriverManager.getConnection(DriverManager.java:171)
         at baeauthserver.AuthProtocol.getPMConnection(AuthProtocol.java:66)
         at baeauthserver.AuthServerThread.run(AuthServerThread.java:38)The program is a server daemon or service that listens for connections from a client. On connection the server spawns a "work" thread to deal with authorising the user and creating a database connection. I can make a connection in the main server class (i.e. the main thread) but as soon as I move this to the "work" class it seems to lose the driver.
    I've just done some more tests and I can't even grab the driver as a driver object on the work thread so it's not just the getConnection method.
    I'm initialising the driver in a static block in the main server program. I've moved it around to various constructors on both the main class and the work class to no avail.
    It has me stumped so far :p
    Thanks for the input though :)

  • Connecting to database through applet

    hi friends
    I am trying to connect to sql database through applet but I cant.
    in fact it can not connect to database.
    plz any body tell me how can i do this. Thanks

    // class depends on
    //     msbase.jar
    //     mssqlserver.jar
    //     msutil.jar
    // these api's are part of Microsoft SQL Server 2000 Driver for JDBC
    // allso need JNDI file system Service provider: found @ sun http://java.sun.com/products/jndi/#DOWNLOAD12 the JNDI 1.2.X class librarys and
    //          File system provider 1.2 beta 3
    //     fscontext.jar
    //     providerutil.jar
    //      (jndi.jar) provided in java > 1.3*
    // to compile:
    // javac -classpath "C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msbase.jar;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\mssqlserver.jar;C:\Program Files\Microsoft SQL Server 2000 Driver for JDBC\lib\msutil.jar;C:\j2sdk1.4.2_01\jndi\lib\fscontext.jar;C:\j2sdk1.4.2_01\jndi\lib\jndi.jar;C:\j2sdk1.4.2_01\jndi\lib\providerutil.jar" SQLTest.java
    import javax.sql.*;
    import java.sql.*;
    import javax.naming.*;
    import java.util.Properties;
    public class SQLTest extends Thread {
        String sqlServerUser = "sql login account";
        String sqlServerPWD = "sql password";
        String sqlServerName = "sql machine";
        String sqlServerPort = "1433";
        public SQLTest() {
        public static void main(String[] args) {
            (new SQLTest()).run();
        public void run(){
            Connection conn = null;
            try{
                Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
                conn = DriverManager.getConnection("jdbc:microsoft:sqlserver://" + sqlServerName + ":"+ sqlServerPort + ";User=" + sqlServerUser + ";Password=" + sqlServerPWD + ";ProgramName=JAVA-jdbc;DatabaseName=Northwind");
                Statement stmt = conn.createStatement();
                ResultSet result = stmt.executeQuery(
                    "SELECT * from [Shippers]"
                if(result.next()){
                    System.out.println(result.getString("CompanyName") + " " + result.getString("Phone"));
                    while(result.next()) {   // for each row of data
                        System.out.println(result.getString("CompanyName") + " " + result.getString("Phone"));
                System.out.println("Getting a connection with drivermanager works fine");
            } catch(Exception e){
                e.printStackTrace(System.out);
            } finally{
                try{
                    conn.close();
                } catch(Exception e){
                    e.printStackTrace(System.out);
            if(true){return;}
    // try it with a datasource
            try{
            // Setting the context:
                com.microsoft.jdbcx.sqlserver.SQLServerDataSource sds = new com.microsoft.jdbcx.sqlserver.SQLServerDataSource();
                sds.setServerName(sqlServerName);
                sds.setDatabaseName("Northwind");
                sds.setNetAddress(sqlServerPort);
                Properties p = new Properties();
                p.put(Context.INITIAL_CONTEXT_FACTORY,     "com.sun.jndi.fscontext.RefFSContextFactory");
                Context ctx = new InitialContext(p);
                try{
                    ctx.unbind("jdbc/EmployeeDB");
                }catch(Exception e){
                }finally{
                    ctx.bind("jdbc/EmployeeDB",sds);
                DataSource ds = (DataSource)ctx.lookup("jdbc/EmployeeDB");
                conn = null;
                conn = ds.getConnection(sqlServerUser,sqlServerPWD);
                Statement stmt = conn.createStatement();
                ResultSet result = stmt.executeQuery(
                    "SELECT * from [Shippers]"
                if(result.next()){
                    System.out.println(result.getString("CompanyName") + " " + result.getString("Phone"));
                    while(result.next()) {   // for each row of data
                        System.out.println(result.getString("CompanyName") + " " + result.getString("Phone"));
                System.out.println("works with datasource");
            } catch(Exception e){
                e.printStackTrace(System.out);
            } finally{
                try{
                    conn.close();
                } catch(Exception e){
                    e.printStackTrace(System.out);
    }To give an applet special privileges you can specify the prifs in the java.policy file or sign the applet and choose "yes I trust" or "yes I allways trust" when the applet is loaded.
    To give special prifs with the java.policy, it should look like this:
    grant {
    permission java.lang.RuntimePermission "usePolicy"; // prevents the popup from showing for signed applets
    grant codeBase "file:C:/-" {
      permission java.security.AllPermission;
    grant codeBase "http://localhost/-" {
      permission java.security.AllPermission;
    };

Maybe you are looking for

  • In iCal 8.0, how do I change a single event of a recurring event?

    I am using Yosemite. I have a recurring monthly event for Payroll on the 25th. But, when the 25th falls on a weekend, I change it to the previous Friday. To make this change, I drag the recurring event to that Friday. A popup says it will change all

  • Adding a PC to my wireless network

    I would like to find out how I can add a Windows laptop (as yet unpurchased, so assume your basic Dell, Lenovo, HP, etc. running Windows 7) to my wireless network. I currently have an iMac running 10.6.5 and an Airport Extreme Base Station. I would l

  • Airport and Linksys WEP do not play well with each other

    I have a MacBook Pro (15", 2.0ghz, 2gb RAM, 100gb HDD - OSX 10.4.8) connecting to Linksys AP's and/or Router with WEP. I can NOT connect to WEP locked Linksys stuff. I have read all over the internets that you just prefix the WEP key with a $, but wh

  • ROWS BETWEEN 12 PRECEDING AND CURRENT ROW

    I have a report with the last 12 months and for each month, I have to show the sales sum of the last 12 months. For example, for 01/2001, I have to show the sales sum from 01/2000 to 12/2000. I have tried this: SUM(sales) OVER (PARTITION BY product,

  • Yosemite: preview opens all pdf's in same window even after setting change

    After upgrading to Yosemite, Preview always opens new pdf's in prior window with sidebar including other documents. I have changed the setting "when opening new files" to "open each file in its own window" and restarted the program and the computer m