Error in getting Database connection

I have got a separate class for obtaining connection(returns a connection object) and releasing connection.I had written a new class in which the connection object is returned as null after calling the getConnection() method on that dataaccessbean class.For other previous existing classes it is working.....but for this new class a null pointer exception is coming for that connection object.
Please help me out

Please help me outi wish i could see your code

Similar Messages

  • Error in Getting Database Connection from datasource

    Hi,
    I am getting the following error when I tried to get the connection from the datasource object.
    The call is made by the client proxy and the code is getting executed on the server side.
       InitialContext ic = new InitialContext();
       DataSource ods = (DataSource)ic.lookup(dataSourceJndiName);
                conn = ods.getConnection();
    ods.getConnection() is giving the following error
    Caused by: com.sap.engine.services.dbpool.exceptions.BaseSQLException: ResourceException occured in method ConnectionFactoryImpl.getConnection(): com.sap.engine.services.connector.exceptions.BaseResourceException: Not allowed to open connection!
         at com.sap.engine.services.dbpool.cci.ConnectionFactoryImpl.getConnection(ConnectionFactoryImpl.java:59)
         at com.delos.cmx.server.datalayer.DataSourceConnectionData.getDatabaseConnection(DataSourceConnectionData.java:132)
         ... 37 more
    Caused by: com.sap.engine.services.connector.exceptions.BaseResourceException: Not allowed to open connection!
         at com.sap.engine.services.connector.resource.impl.RestrictedResourceSetImpl.getSharedEventHandler(RestrictedResourceSetImpl.java:64)
         at com.sap.engine.services.connector.jca.ConnectionManagerImpl.allocateConnection(ConnectionManagerImpl.java:172)
         at com.sap.engine.services.dbpool.cci.ConnectionFactoryImpl.getConnection(ConnectionFactoryImpl.java:51)
         ... 38 more
         at com.sap.engine.services.ejb.exceptions.BaseRuntimeException.writeReplace(BaseRuntimeException.java:273)
         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 java.io.ObjectStreamClass.invokeWriteReplace(ObjectStreamClass.java:896)
         at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1011)
         at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
         at com.sap.engine.services.rmi_p4.DispatchImpl.throwException(DispatchImpl.java:120)
         at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java:270)
         at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java:165)
         at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java:102)
         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:140)
    I am unable to proceed because of this error.
    I would appreciate any help on this.
    Thanks
    Kavitha

    Hi Kavitha,
    If u have not gone through the link given below then
    plz visit it, it may help u.
    http://help.sap.com/saphelp_nw04/helpdata/en/5c/2f2c4142aef623e10000000a155106/content.htm
    Regards,
    Narinder

  • Workspace Error 8001: The Database Connection could not be found

    We had to reboot all our windows servers recently and since then all the database connections in the database base manager in workspace are gone.
    I can see all the existing reports but cannot use any of them as I dont have any connections.
    Also I cannot create any new connections
    I get the error 8001: The Database Connection could not be found: 13cbd63_12b5e2a8b73_-7f8f when I try to create a new connection.
    Not sure what the problem is.
    Any suggestions?

    Hi Pat,
    It loks like your Biplus relational DB is corrupted, try with those steps:
    1. De-register BI+ from Shared Services (Config Utility->Hyperion Reporting and Analysis > Deregister from Shared Services)
    2. Configure against the backup database (Drop and recreate tables option).
    3. Re-register BI+ with Shared Services.
    4. Re-deploy BI+.
    5. Test Workspace and add new connections.
    Regards.

  • SUN JES 8.1 Q2UR2: Long time taken in getting database connection.

    Application server registered intermittent slowness in getting database connection from javax.sql.DataSource. Based on the following JMX value, the application servers still haven�t reached the threshold. Its identified the slowness was due to application server performing validation (select count(*) from dual).
    Sample code:
    ds.getConnection(username, password); // where DS is the javax.sql.DataSource
    Network
    It is observed that the bi-directional ping stats showed that the response time < 1.19 ms. Network Switch port utilisation was <30% and there were no errors and collision detected.
    Database
    Based on oracle database statspack, it showed that the database is healthy. On top of that, the following query was scheduled to be executed every second to monitor Select count(*) from dual elapsed time.
    select sess.sid, sess.serial#, sess.client_info, sess.program, sql.sql_text, sql.elapsed_time from V$SESSION sess, V$SQL sql where sess.sql_hash_value=sql.hash_value and upper(sql.sql_text) like 'SELECT COUNT(*) FROM DUAL' order by sess.sid
    Basically this query will capture the cumulative elapsed time per session id. This query is able to caption �Select count(*) from dual� that ran more than 2 seconds.
    Example 1 � how the cumulative elapsed time registered in the log:
    2006_11_02_16_53_55,Connection 1, SID 1 perform a select count(*) from dual. Oracle registered elapsed time 10 ms.
    2006_11_02_16_53_55,Connection 2, SID 2 perform a select count(*) from dual. Oracle registered elapsed time 10 ms.
    2006_11_02_16_54_57,Connection 1, SID 1 perform a select count(*) from dual. Oracle registered elapsed time 20 ms.
    2006_11_02_16_54_58,Connection 1, SID 1 perform a select count(*) from dual. Oracle registered elapsed time 30 ms.
    2006_11_02_16_54_58,Connection 2, SID 2 perform a select count(*) from dual. Oracle registered elapsed time 20 ms.
    Example 2 � If query ran more than 2 sec:
    2006_11_02_16_53_55,Connection 1, SID 1 perform a select count(*) from dual. Oracle registered elapsed time 10 ms.
    2006_11_02_16_53_57,Connection 1, SID 1 perform a select count(*) from dual. Oracle registered elapsed time 20 ms.
    2006_11_02_16_54_57,Connection 1, SID 1 perform a select count(*) from dual. Oracle registered elapsed time 2030 ms. << if query that ran more than 2 secs, there will be a sudden jump of 2 secs in the subsequent cumulative elapsed time.
    Previously based on jmx log, it do registered 10k connections was acquired in 1 second and only 6 active connections was used. If same connection was used and on the same second, the cumulative elapsed time will registered in the log. The longest elapsed time that registered in 2 Nov 2006 01:00 pm to 05:00 pm logs was 800 ms but long get database connection still registered 5 to 7 seconds.
    Questions:
    1) Is it possible that I can use dtrace to capture the bottleneck?
    System information:
    Oracle:
    DriverVersion: [10.2.0.1.0]
    DriverMajorVersion: [10]
    DriverMinorVersion: [2]
    DriverName: [Oracle JDBC driver]
    URL: [jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST= (ADDRESS=(PROTOCOL = TCP) (HOST = XXXXXX) (PORT = 1524)) (ADDRESS=(PROTOCOL = TCP) (HOST = XXXXXX) (PORT = 1524))) (CONNECT_DATA = (SID = CP_P)) (source_route=yes))]
    UserName: [CP_P1]
    Database Product Name: [Oracle]
    Database Product Version: [Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.6.0 - Production]
    Database Product Major: [9]
    Database Product Minor: [2]
    Drivers: Type 4
    JDK
    JDBC Major: [10]
    JDBC Minor: [2]
    The JDK version is 1.5.0_02
    SUN JES Application Server
    Sun Java System Application Server Enterprise Edition 8.1_02 running under solaris 10

    Massive Crossposting:
    http://forum.java.sun.com/thread.jspa?threadID=790473&messageID=4491822#4491822
    http://forum.java.sun.com/thread.jspa?threadID=790472&messageID=4491819#4491819
    http://forum.java.sun.com/thread.jspa?threadID=790471&messageID=4491817#4491817
    http://forum.java.sun.com/thread.jspa?threadID=790470&messageID=4491816#4491816
    http://forum.java.sun.com/thread.jspa?threadID=790469&messageID=4491815#4491815
    http://forum.java.sun.com/thread.jspa?threadID=790468&messageID=4491814#4491814
    http://forum.java.sun.com/thread.jspa?threadID=790466&messageID=4491812#4491812

  • How to get database connection in applet

    Hi,
    I am trying to prepare database connection in applet. After preparing connection with database it'll read same values from table.
    At the time of development it works fine. I have used esclipse IDE for coding and testing.
    But when I try to call that applet from browser. It is giving ClassNotFound exception.
    Does anybody know How to get database connection in applet ?
    Please help me if anybody know solution for this.
    Thanks,
    Rajesh

    As per my knowledge is conserned
    1 u can get the database connection in a jsp page and u send the result set as param to the applet and u can use retrieved values as if they were of the same applet if u r interested i can send the db connetion coding for jsp my id [email protected]

  • Why is the data source not getting database connection without  exception?

    experts,
    I am trying to config server.xml to get database connection. i am now getting no exception duing the connection, but the returned connection is NULL, why? thanks/ this is my codes:
    public synchronized Connection getConnection()
    try{
    Context ctx = new InitialContext();
    if (ctx == null)
    throw new Exception("Context is null");
    Context initContext = new InitialContext();
    Context envContext = (Context)initContext.lookup("java:/comp/env");
    DataSource ds = (DataSource)envContext.lookup("test");
    Connection conn = ds.getConnection();
    }catch(Exception ex)
    ex.printStackTrace();
    return conn;
    }

    Remove the first slash after "java:".
    Context envContext =(Context)initContext.lookup("java:comp/env");

  • Getting 'unidentified error occured' while database connecting on local computer

    I have downloaded CS5 Dreamweaver trial version on my c
    omputer, with windows 7.
    I have also downloaded easy php as php-mysql-apache server on the same computer.
    While creating a databse connection, I get following message
    'Undefined error ocurred'.
    and the connection does not take place.
    If I close the connection wizard, with giving database name, connection is shown on the applications pane, but when tables icon is clicked, no tables are show.
    Also when I try to create a recordset, it shows that there are no tables in the databse.
    I have insertd screen shots of the connection wizard.
    Kindly help.

    I'm not familiar with EasyPHP, but it should work the same as any other local testing environment.
    In the Servers panel, deselect the Remote checkbox. Leave only the Testing checkbox selected.
    Something unusual about the Local Info panel is that the Web URL, although grayed out, is accessing http://127.0.0.1:8888. Localhost is an alias for 127.0.0.1, so that's not a problem, but the colon followed by 8888 is a non-standard port. Does EasyPHP run Apache on port 8888? If so, you need to change the Web URL in the Server Basic panel to http://localhost:8888/InventaEnqFrm/.
    Also, if Apache is running on port 8888, it's very likely that MySQL is running on port 8889, so you would need to use localhost:8889 in the MySQL Connection dialog box.
    The other obvious thing to check is that both Apache and MySQL are running.
    By the way, it's normal practice to put the local files in the same location as the testing server.

  • "Error establishing a database connection" after scale database

    Hello, i have a wordpress website hosted at my azure account (www.timothy-k.com). I was trying to scale my sql database and i have changed it from standard to basic. Then, I cant connect to my site, because i have this error.
    I scale the database again from basic to standard but the issue persists.
    In the website dashboard I can see an another mysql db as a linked resource.I check the credentials for wp-config and they are ok.
    Can you help me?

    Hi DigitalJo,
    Are you moving between the service tiers using the Azure Management Portal? Can we have the error which you get?
    Connections to the database may be temporarily dropped when a performance level change or upgrade/downgrade completes, and a few seconds may elapse before connections can be re-established. SQL Database applications should be coded to be resilient to dropped
    connections as this can occur anytime in SQL Database when a computer fails in the data center and the SQL Database service fails over the database.
    Reference :
    https://msdn.microsoft.com/en-us/library/azure/dn369872.aspx
    Regards,
    Mekh.

  • Error in Remote Database Connection

    I am trying to establish a connection for other database through remote database connection whenever i click the test connection i am getting the error like
    Bad Connection
    GetConnection failed: Caught Exception from getUrlAndDriver
    In trace file it shows like
    PSAPPSRV.5794 (42)      1-26493 14.30.43 19.832981 Cur#1.5794.LN290401 RC=0 Dur=0.000098 COM Stmt=SELECT VERSION FROM PSVERSION WHERE OBJECTTYPENAME = 'SYS'
    PSAPPSRV.5794 (42)      1-26494 14.30.43 0.020306 Cur#1.5794.LN290401 RC=0 Dur=0.000064 COM Stmt=SELECT VERSION FROM PSVERSION WHERE OBJECTTYPENAME = 'SYS'
    PSAPPSRV.5794 (42)      1-26495 14.30.43 0.016844 >>> start Nest=00 MISCTOOLS_WRK.TEST_CONNECT.FieldChange
    PSAPPSRV.5794 (42)      1-26496 14.30.43 0.000013 >>>>> Begin MISCTOOLS_WRK.TEST_CONNECT.FieldChange level 0 row 0
    PSAPPSRV.5794 (42)      1-26497 14.30.43 0.000019 1: DoSaveNow();
    PSAPPSRV.5794 (42)      1-26498 14.30.43 0.022858 <<< end Nest=00 MISCTOOLS_WRK.TEST_CONNECT.FieldChange Dur=0.022891 CPU=0.000000 Cycles=3
    PSAPPSRV.5794 (42)      1-26499 14.30.43 0.003037 >>> resume Nest=00 . MISCTOOLS_WRK.TEST_CONNECT.FieldChange
    PSAPPSRV.5794 (42)      1-26500 14.30.43 0.000028 1: DoSaveNow();
    PSAPPSRV.5794 (42)      1-26501 14.30.43 0.000004 2: &oRd = CreateJavaObject("com.peoplesoft.pt.remotedb.PSJDataSource");
    PSAPPSRV.5794 (42)      1-26502 14.30.43 0.781008 3: &b = &oRd.TestConnection(PSREMOTEDBDEFN.REMOTEDB_ID.Value);
    PSAPPSRV.5794 (42)      1-26503 14.30.43 0.000041 Fetch Field: PSREMOTEDBDEFN.REMOTEDB_ID Value=HCM91PRD
    PSAPPSRV.5794 (42)      1-26504 14.30.43 0.019209 Cur#2.5794.LN290401 RC=0 Dur=0.000097 COM Stmt=SELECT REMOTEDB_ID,DBTYPE,DESCR,LOCAL_CONNECT_FLAG,REMOTEDBCONNTYPE,REMOTEDBNAME,DBSERVER,DB_PORT,INFORMIXSERVERNAME,USERID,PASSWORD FROM PSREMOTEDBDEFN WHERE REMOTEDB_ID = :1
    PSAPPSRV.5794 (42)       1-26505  14.30.43    0.004232 Database Options: override_connection_reset: 0
    PSAPPSRV.5794 (42)      1-26506 14.30.43 0.048569 4: If &b Then
    PSAPPSRV.5794 (42)      1-26507 14.30.43 0.000003 7: WinMessage("Bad connection", %MsgStyle_OK);
    PSAPPSRV.5794 (42)      1-26508 14.30.43 0.000055 8: If &oRd.success() = False Then
    PSAPPSRV.5794 (42)      1-26509 14.30.43 0.000013 9: WinMessage(&oRd.getErrStr(), %MsgStyle_OK);
    PSAPPSRV.5794 (42)      1-26510 14.30.43 0.000014 10: End-If
    PSAPPSRV.5794 (42)      1-26511 14.30.43 0.000062 >>> reend Nest=00 . MISCTOOLS_WRK.TEST_CONNECT.FieldChange
    PSAPPSRV.5794 (42)      1-26512 14.30.43 0.009340 Cur#1.5794.LN290401 RC=0 Dur=0.000075 COM Stmt=SELECT PTTAPAGECUST FROM PSUSRTAPAGECUST WHERE MENUNAME = :1 AND PNLGRPNAME = :2 AND PNLNAME = :3 AND OPRID = :4
    PSAPPSRV.5794 (42)      1-26513 14.30.43 0.000009 Cur#1.5794.LN290401 RC=0 Dur=0.000000 Bind-1 type=2 length=9 value=UTILITIES
    PSAPPSRV.5794 (42)      1-26514 14.30.43 0.000003 Cur#1.5794.LN290401 RC=0 Dur=0.000000 Bind-2 type=2 length=14 value=REMOTEDB_TABLE
    PSAPPSRV.5794 (42)      1-26515 14.30.43 0.000003 Cur#1.5794.LN290401 RC=0 Dur=0.000000 Bind-3 type=2 length=8 value=REMOTEDB
    PSAPPSRV.5794 (42)      1-26516 14.30.43 0.000003 Cur#1.5794.LN290401 RC=0 Dur=0.000000 Bind-4 type=2 length=9 value=CAPIADMIN
    Edited by: abdul43 on Apr 11, 2013 12:19 AM

    Thank you for your help, RK.
    The problem was that sidadm was not the owner of ORA_NLS.
    Now I have another problem: when running startsap not boot disp + work.

  • MSI error while installing database connectivity toolkit

    Hi!
    We are facing problems while trying to install the database connectivity toolkit (comes as subpart of the enterprise connectivity toolkit).
    The behaviour is odd. Some months back it used to install OK. Now, it fails during installation. Pls see attached .zip file that shows image of the error messages.
    Pointers:
    1) The MSI error message has increasing numbering. First attempt to install gives mesages MSI4, next might be MSI8 and so on.
    2) It used to install perfectly until few months back
    3) We have tried to inatll it on freshly formatted computers having LV 6.1 and LV 7.1 runtimes.
    4) OS is Win2000 with SP4
    5) Few days ago it installed fine on a PC on which it had not installed for many months!
    6) We have tried for all the CDs/backups where we had this software. It still fails.
    7) All our other toolkits - Internet, SPC, Sound&Vibration, SMT continue to install flawlessly.
    We are unable to see any pattern or reason for this installation failure and would appreciate any help.
    Thanks,
    Gurdas
    Gurdas Singh
    PhD. Candidate | Civil Engineering | NCSU.edu
    Attachments:
    error messages.zip ‏76 KB

    Hello Kileen,
    1. If you’re installing from the CD, sometimes the installer has a hard time grabbing the files from the CD. Try copying the installation CD contents over to a temporary folder on the computer and run the installer again.
    > We tried this. Problem continues.
    2. Try changing permission settings in your registry:
    KB 38TFAUZH: Why Do I Get Error 1722 When Installing the Driver CD with Windows XP?
    > My system is Win2000 and I am unable to reach the settings mentioned in above link (which is for WinXP)
    3. Turn off all virus scanners. Rerun the installation.
    >We tried this. Problem continues.
    Hope to see a way out.
    - Gurdas
    Gurdas Singh
    PhD. Candidate | Civil Engineering | NCSU.edu

  • Error in odbc database connection

    Hi All,
    I have created database connection from SAP system to another no sap system (Radar) using the tcode DBCO and maintained the following parameters
    DB connection: RADAR_DEV
    DBMS            : MSS
    user Name : RADAR_DVLP
    Db password : **********
    conn info : msql_server=hostname of SQL server msql_dbname=DB name object_source=DB name
    It is gives a below short dump when this db connection (DB connection name) is used in a program by ABAPer
    error message
                                                                                    The error occurred in the current database connection "RADAR_DEV".                                                                               
    What can you do?                                                                               
    Print out the error message (using the "Print" function)                          
    and make a note of the actions and input that caused the                          
    error.                                                                               
    To resolve the problem, contact your SAP system administrator.                    
    You can use transaction ST22 (ABAP Dump Analysis) to view and administer          
    termination messages, especially those beyond their normal deletion              
    date.                                                                               
    Error analysis                                                                               
    An exception occurred. This exception will be dealt with in more detail           
    below. The exception, assigned to the class 'CX_SY_NATIVE_SQL_ERROR', was not     
    caught, which                                                                    
    led to a runtime error. The reason for this exception is:                                                                               
    How to correct the error                                                                               
    Database error text........: "Line 1: Incorrect syntax near '.'."         
    Triggering SQL statement...: "FETCH NEXT "                                
    Internal call code.........: "[DBDS/NEW DSQL]"                            
    Please check the entries in the system log (Transaction SM21).                                                                               
    You may able to find an interim solution to the problem                   
    in the SAP note system. If you have access to the note system yourself,   
    use the following search criteria:                                                                               
    "DBIF_DSQL2_SQL_ERROR" CX_SY_NATIVE_SQL_ERRORC                            
    "ZRADAR_EXTRACT" or "ZRADAR_EXTRACT"                                      
    "START-OF-SELECTION"                                                      
    Can you please help me on resolving this issue
    Thanks,
    Vadi

    Hello Vadivambal,
    Could you please provide the syntax of line, on which the dump occurs.
    Is user RADAR_DVLP able to fetch same data without an ABAP program?
    Regards,
    Ammey Kesarkar

  • How to get database connection in common java class

    hi friendz,
    plz help me...
    I am using JDEV 11.1.2.2.0 version.
    my problem is I'm writing common java class which can reuse any application.
    in this case when im create database connection like this,
    String username = "a";
    String password = "b";
    String thinConn = "jdbc:oracle:thin:@IP:1521:database";
    DriverManager.registerDriver(new OracleDriver());
    Connection conn =
    DriverManager.getConnection(thinConn, username, password);
    conn.setAutoCommit(false);
    return conn;
    but this statement not working in java class.its working only backing bean.
    import oracle.jdbc.OracleDriver;
    DriverManager.registerDriver(new OracleDriver());
    how can i do that??
    hope your help
    -Harsh-

    What is the error message in Java class?
    With JDBC 4.0 driver the DriverManager class has added support for the Java SE Service Provider mechanism to the getConnection() and getDrivers() methods using which JDBC drivers may be loaded automatically. The following Class.forName() method is not required to be invoked.
    Class.forName(“oracle.jdbc.OracleDriver”);
    Only the following is required to obtain a connection.
    String url="jdbc:oracle:thin:@localhost:1521:ORCL";
    Connection connection = DriverManager.getConnection(url,"oe", "pw");

  • Sybase Connection Error - cannot establish database connection

    BO Data Services Tool -> Creation of new Data Store -> Sybase ASE
    When I tried to create a sybase datastore(New connection), I've got this error message. But I am able to connect to sybase database with client application with same connection parameter. I appreciate if someone come across same issue.
    ERROR MESSAGE
    *WARNING: Cannot establish database connecton.
    u2018Sybase connecton error: <Sybase ASE Server message number <1640> State <2> Severity <16> From Server <tstlS03>: Message Text is:
    Adaptve Server requires encrypton of the login password on the network.
    Sybase ASE Server message number <4002> State <1> Severity <14> From Server <tstlSO3>: Message Text is: Login failed.
    Sybase CS Library message number <6717S468> Severity <4>: Message Text is: ct_connectO: protocol specific layer: external error: The attempt to connect to the server failed.>.u2019 lODI- 1111341)

    I tried to create repositories for sybase, it failed.  But it succeeded when created datastore.  The procedures's as follow:
    1. Create ODBC for this sybase connection, and it should display "Connection successful" when you click "Test connection".
       (you need to specify several parameters like user id & password, server,database name and file, etc.)
    2. Create datastore by using ODBC connection.

  • Error in Mysql database connectivity

    hello,
    there is problem in Mysql database connectivity.
    when i connect JSP program to Mysql database it gives error :
    Server configuration denied access to data source
    please help me asap
    kuldip jain
    [email protected]

    i m also working on Mysql Java but on Window 2000 platform
    here is the Java code which successfully runing on my machine
    import java.sql.*;
    public class TestMySql
         public static void main(String[] Args)
              try
    Class.forName("org.gjt.mm.mysql.Driver").newInstance();
    Connection C = DriverManager.getConnection(
    "jdbc:mysql://server2:3306/Db?user=root");
    Statement Stmt = C.createStatement();
    ResultSet RS = Stmt.executeQuery("SELECT * from T1");
    while (RS.next()) {
                             System.out.println(RS.getString(1));
    catch (Exception E)
    System.out.println("SQLException: " + E.getMessage());

  • Sybase jconnect and tomcat 5. Getting error:Cannot get a connection, pool

    Hi,
    I am not sure why i am getting this error.
    All the drivers are in the write location. Tomcat does find and load the driver correctly.
    But... when i try to connect, i get this error.
    org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool exhausted, cause:
    java.util.NoSuchElementException: Could not create a validated object
    at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:851)
    at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:140)
    at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:518)
    at com.aoltw.ic.ars.data.DAO.connect(DAO.java:233)
    at com.aoltw.ic.ars.data.authenticateDAO.getGroups(authenticateDAO.java:114)
    at com.aoltw.ic.ars.data.authenticateDAO.getUserInfo(authenticateDAO.java:97)
    at com.aoltw.ic.ars.helpcentral.presentation.action.loginAction.authenticate(loginAction.java:35)
    at com.aoltw.ic.ars.helpcentral.presentation.action.loginAction.execute(loginAction.java:86)
    at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:446)
    at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:266)
    at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1292)
    Thanks
    --Arun

    What is the "right" location? I'll assume you mean your app's WEB-INF/lib.
    Sounds like your Java code isn't closing statements and/or connections properly, or perhaps you need to increase the number of connections in the pool. I'm guessing it's the former.
    MOD

Maybe you are looking for