JDBC and LDAP Connect to database

I am testing a little bit with jdbc thin client and how it should be setup with a ldap naming service (tnsManager). What I heard is that I need a special lib so JDBC can use the LDAP naming service but i have no clue. I have been looking around the internet but haven't really found anything. What do I need on the DB side to make it work?

Not very sure .. may JNDI be used for connection using LDAP. cause JNDI is have a support for LDAP urls.
http://download.oracle.com/javase/1.4.2/docs/guide/jndi/

Similar Messages

  • JDBC and MySQL connectivity problem

    The code i hav attached generates Connectivity exception.. the prob is with the part in bold.. can anyone help
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    public class testconn {
      public static void main(String args[]) {
        Connection con = null;
                String serverName = "localhost:8080";
            String mydatabase = "imagedb";
            String url = "jdbc:mysql://" + serverName +  "/" + mydatabase; // a JDBC url
            String username = "am";
            String password = "ta";
        try {
          Class.forName("com.mysql.jdbc.Driver");
         con= DriverManager.getConnection(url, username, password);
          if(!con.isClosed())
            System.out.println("Successfully connected to " +
              "MySQL server using TCP/IP...");
        } catch(Exception e) {
          System.err.println("Exception: " + e);
        } finally {
          try {
            if(con != null)
              con.close();
          } catch(SQLException e) {}
    }

    I had such issue too, and I fixed it by adding in the environment variables the CLASSPATH entry that pointed to all the directories containing the .jar needed for the applications.
    for example I used jodbc folder to connect mysql database (I installed last version and I got same issue than yours and it seems to be a 'connector' issue, exactly the same issue than yours) I got something like
    CLASSPATH=my root dir/the java dir/the lib dir/jodbc;my root dir/the java dir/other important libs containing .jar files;
    This is what I got for the issue, still working around (at the level of mysql all is ok, ...)
    Microsoft Windows XP [version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.
    C:\Documents and Settings\Hurukan>java ConnectJODBC brol
    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at ConnectJODBC.main(ConnectJODBC.java:108)
    [exception] -- la valeur de 'con' est nulle (DriverManager � retourn� une valeur
    nulle)
    C:\Documents and Settings\Hurukan>set
    APPDATA=C:\Documents and Settings\Hurukan\Application Data
    CLASSPATH=c:\Program Files\Java\jdk1.5.0_06\lib;c:\Program Files\Java\jdk1.5.0_06\dev;\c:\Program Files\Java\jdk1.5.0_06\lib\jodbc;
    Here is the code that generated this exception
    String dburl="jdbc:mysql://127.0.0.1/nosdisques"; // should be next passed by command line
    String password="**scrambled**";
    String username="**scrambled**";
    Connection con=null;
    Statement stmt=null;
    ResultSet res=null;
    String requete="";
    String strToWrite="";
    // Connexion � la base de donn�e
    // Won't work with mysql 5.0.18, mysql connector 3.51.12 is installed [???]
    // Previous tests with 5.0.18 were running good, that has started with the last os restoration (and the connector was different of course...)
    // tried to retreive older version of the mysql connector
    try
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    con=DriverManager.getConnection(dburl,username,password);
    System.out.println("Nous sommes connect\u201as \u2026 la base " + con.getCatalog());
    catch(SQLException sqlex)
    System.out.println("[sqlexception]\n");
    System.exit(3);
    catch(Exception ex)
    ex.printStackTrace();
    if(con == null)
    System.out.println("[exception] -- la valeur de 'con' est nulle (DriverManager \u2026 retourn\u201a une valeur nulle)\n");
    System.exit(4);
    System.out.println("Impossible to join database, access denied\n");
    System.out.println("Verify settings (mysqld or firewall)\n"); System.exit(2);
    Maybe the drivers used (last one: connector/j 3.1.12). The .jar file is in the %classpath% directory c:\Program Files\Java\jdk1.5.0_06\lib.
    Can't really understand why this code won't run anymore, ...
    I took a look on the other computer where the same code is running ok.
    These are the differences:
    mysql server is 5.0.18 on the other computer the version is 3.23.41
    mysql connector is 3.51.12 on the other computer the version is 3.0.10
    access rights are the same because the database is the dumped one from 3.23.41 to 5.0.18, and I'm quite good with the dbms management (I'm IT developper in fact, trying to take over java technology ;) )
    in this case this is not a sql error but java error.
    the jar file is set to the %classpath% folder on both computers
    I copied the jar from the other computer, removing the new .jar file and... it failed, exactly the same issue
    Still working around, ...
    Dimitri

  • How to make JDBC and SAP connectivity with VC 6.0

    can anyone help me.....how to make JDBC system and SAP system visible in the System drop-down list in Data Task Panel of Visual Composer 6......i mean how to make connectivity with JDBC and SAP system......so that i can use any table in the back-end database as well as any BAPI in the R/3 system.........
    Thank you very much.....

    Hi Deep,
    There is a how-to posted on SDN regarding how to connect and configure the BI JDBC Connector.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/6209b52e-0401-0010-6a9f-d40ec3a09424
    This document describes the jdbc driver to use etc.
    Hope this helps,
    Cheers,
    Scott

  • Domino Notes and LDAP Connection using wls 6.1

    We would like to use Domino LDAP for authentication/authorization in Webogic, but
    we are not able to configure it. Has someone else already done this? Below is
    a list of steps to take that we got from a BEA consultent. The problem is step
    10, rebooting the server. When I try to do this, I get a Fatal initialization
    exception error and cannot start the server.
    1. Open the WebLogic Server Administration Console http://localhost:7001/console
    in a browser.
    2. In the right pane of the Administration Console, click the mydomain->Security->Realms->Create
    a new Custom Realm.
    3. Enter MyLotusLDAPRealm in the Name field.
    4. Click Create.
    5. In the right pane of the Administration Console, click the mydomain->Security->Caching
    Realms->Create a new Caching Realm.
    6. Enter MyLotusCachingRealm in the Name field.
    7. Click Create.
    8. In the right pane of the Administration Console, click the mydomain-Security.
    9. Select the MyLotusLDAPRealm from the drop-down box for the Caching Realm.
    10. Reboot the WebLogic Server.
    11. Copy the ldaprealm.properties to bea/wlserver6.1
    12. Modify the web.xml
    13. Modify the weblogic.xml
    If anyone has done this before please let me know how you did it. Thanks!

    That works. Thanks!
    "Romuald RICHARD" <[email protected]> wrote:
    Try to use the type 4 driver from Oracle 9i.
    Be sure to put the classes12.zip from the /jdbc/lib/ of Oracle file in
    the
    begining of the classpath of Weblogic.
    Romuald RICHARD
    Developer Relations Engineer
    BEA Support
    "mike" <[email protected]> wrote in message
    news:3ca93930$[email protected]..
    I'm trying to create connection pool to Oracle 9i database under Linux.Oracle
    installation is fine, and I can use Oracle examples to connect to mydatabase.
    But when I try to create pool from within WLS I get:
    - Trying oracle.jdbc.OracleDriver: <Cannot startup connection pool"oraclePool"
    No suitable driver>
    - Trying weblogic.jdbc.oci.Driver: java.lang.UnsatisfiedLinkError:/home/usr/local/bea/wlserver6.1/lib/linux/i686/oci816_8/libweblogicoci37.so:
    libclntsh.so.8.0: cannot open shared object file: No such file ordirectory
    The latter is not a surprise, since the file does not exist. InsteadI
    have libclntsh.so.9.0
    and vanilla so, which is a soft link to 9.0. Creating link with desiredname (libclntsh.8.0)
    to 9.0 does not help as it throws on unsatisfied symbol.
    Can you advise me on the reason and remedy?

  • SQL Developer Blocked and is not allowed to connect to database ORA-200001

    SQL Developer Blocked and is not allowed to connect to database gives ORA-200001.
    i found on net that DBA can write triggers which can deny connection to database from certain appplication.
    so i want a way to change application name so that when it connects to database
    the V$SESSION will have different value (other than SQL Developer) in column PROGRAM and/or MODULE (which i think is used by dba to restrict the connection).
    one more way is
    i am using jdbc url to connect to database
    in java we can change properties of connection to change the PROGRAM in V$SESSION.
    but i am not java expert so dont know how and where to make the changes
    either way my aim is to connect to database such that V$SESSION will have different value (other than "SQL Developer") in column PROGRAM and/or MODULE

    This is not system configration or credential issue.
    This is a check which is put DBA using logon trigger
    to check certain user loging in using certain application.
    only some users using particular username are getting this error when they try to logon using oracle sql developer
    the same users when uses different username(some generic user names created to access database) to access the same database then they are able to login.
    similarly if they login using SQL navigator they are able to login with both their own and the generic user name
    more over of all the database instances this is only happening on some of the instances and all of them are development instances.
    following will help you understand
    USER | DBUSERNAME | DATABASE | APPLICATION | ACTION
    X | X | DB1 | Oracle Sql Developer | Blocked
    X | G(Genric) | DB1 | Oracle Sql Developer | Login Success
    X | X | DB1 | Sql Navigator/SqlPLus | Login Success
    X | G(Genric) | DB1 | Sql Navigator/SqlPLus | Login Success
    X | X | DB2 | Oracle Sql Developer | Login Success
    X | G(Genric) | DB2 | Oracle Sql Developer | Login Success
    X | X | DB2 | Sql Navigator/SqlPLus | Login Success
    X | G(Genric) | DB2 | Sql Navigator/SqlPLus | Login Success
    I just want to bypass this check which i think uses V$SESSION and columns PROGRAM and/or MODULE to check the application used by particular user.
    if i can override these values some where in oracle sql developer before loging in the DB then i can clearly pass this check and login to database.
    Edited by: user13430736 on Jun 21, 2011 4:05 AM
    Edited by: user13430736 on Jun 21, 2011 4:12 AM

  • IDoc to JDBC  and JDBC to IDoc Scenario

    Dear All,
    I am working on IDoc to JDBC and JDBC to IDoc Scenario.
    I have to send Idoc from SAP to Non SAP system(.NET application) i almost configured in XI but still i don't know when my INTEGRATION will INVOKE how my data will proceed from IDOC to Oracle database(Through JDBC) and in case of revese how and when Data flow will start.
    Does anyone have completed STEP by STEP scenario document for this?
    How my Idoc will sent to XI?
    How XI will pick up data from IDoc?
    How XI will Convert data to JDBC and UPDATE in Oracle Database?
    And i reverse case(JDBC to IDoc) when my INTEGRATION will INVOKE?
    Where and When i can watch my process and data?
    How can i test the whole integration?
    I AM GETTING ERROR WHILE TESTING CONFIGURATION IN Integration Directory "Error while refreshing the XI runtime cache" and when i check this in SXI_CACHE  it gives me error
    "Unable to refresh cache "NO_BUSINESS_SYSTEM"
    "Error during last refresh to cache"LCR_GET_OWN_BUSINESS_SYSTEM - NO_BUSINESS_SYSTEM"
    Please solve all the above problems i will reward u points
    thanks,
    RP

    Hi,
    While we working on IDOC to JDBC interface..
    We have to deploy JDBC Drivers?
    Go through this links,
    /people/varadharajan.krishnasamy/blog/2007/02/27/configuring-jdbc-connector-service-to-perform-database-lookups
    http://searchsap.techtarget.com/tip/0,289483,sid21_gci1246926,00.html
    To install JDBC driver follow the how to guide.
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/xi/xi-how-to-guides/how%20to%20install%20and%20configure%20external%20drivers%20for%20jdbc%20and%20jms%20adapters.pdf
    Configuration of JDBC Adapter for SQL Server
    JDBC Driver = com.microsoft.jdbc.sqlserver.SQLServerDriver
    Connection = jdbc:microsoft:sqlserver://hostname:<port>;DatabaseName=<DBName>
    UserID and Password.
    If the connection is not working find the correct port number.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/40b92770-db81-2a10-8e91-f747188d8033
    JDBC- X I -  R/3 Scenario
    /people/bhavesh.kantilal/blog/2006/07/03/jdbc-receiver-adapter--synchronous-select-150-step-by-step
    /people/sap.user72/blog/2005/06/01/file-to-jdbc-adapter-using-sap-xi-30
    Please check the driver path as mentioned below.
    JDBC Driver : sun.jdbc.odbc.JdbcOdbcDriver
    Connection:jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=//location of DB table.mdb;
    No JDBC driver required.
    Receiver JDBC scenario MS access - /people/sameer.shadab/blog/2005/10/24/connecting-to-ms-access-using-receiver-jdbc-adapter-without-dsn
    follow this thread
    Re: Problem when connecting to MS Access through JDBC Adapter.
    SAP Note 850116 has details
    /people/michal.krawczyk2/blog/2005/12/04/xi-idoc-bundling--the-trick-with-the-occurance-change
    Configuring the Sender JDBC Adapter
    http://help.sap.com/saphelp_nw04/helpdata/en/1d/756b3c0d592c7fe10000000a11405a/content.htm
    Configuring the Receiver JDBC Adapter
    http://help.sap.com/saphelp_nw2004s/helpdata/en/b0/676b3c255b1475e10000000a114084/content.htm
    Idoc Reveiver adapter..
    http://help.sap.com/saphelp_erp2004/helpdata/en/b9/c5b13bbeb0cb37e10000000a11402f/content.htm
    Thanks,
    Satya Kumar
    /people/michal.krawczyk2/blog/2005/12/04/xi-idoc-bundling--the-trick-with-the-occurance-change
    Edited by: SATYA KUMAR AKKARABOYANA on May 8, 2008 5:51 PM

  • Error Connecting to database URL jdbc:oracle:oci:@rmsdbtst as user rms13 java.lang.Exception:UnsatisfiedLinkError encountered when using the Oracle driver

    Trying to Install RMS application 13.2.2 and I get past the pre-installation checks and when I get to the Data Source details and enter the data source details with the check box checked to validate the schema/Test Data Source I get the following error:
    Error Connecting to database URL jdbc:oracle:oci:@rmsdbtst as user rms13 java.lang.Exception:UnsatisfiedLinkError encountered when using the Oracle driver. Please check that the library path is set up properly or switch to the JDBC thin client oracle/jdbc/driver/T2CConnection.getLibraryVersioNumber()
    Checks performed:
    RMS Application code location and directory contents:
    [oracle@test-rms-app application]$ pwd
    /binary_files/STAGING_DIR/rms/application
    [oracle@test-rms-app application]$ ls -ltr
    total 144
    -rw-r--r-- 1 oracle oinstall   272 Dec 7  2010 version.properties
    -rw-r--r-- 1 oracle oinstall   405 Jan 16 2011 expected-object-counts.properties
    -rw-r--r-- 1 oracle oinstall   892 May 13 2011 ant.install.properties.sample
    -rw-r--r-- 1 oracle oinstall 64004 Jun  6  2011 build.xml
    drwxr-xr-x 9 oracle oinstall  4096 Jun 16 2011 rms13
    drwxr-xr-x 3 oracle oinstall  4096 Jun 16 2011 installer-resources
    drwxr-xr-x 3 oracle oinstall  4096 Jun 16 2011 antinstall
    drwxr-xr-x 2 oracle oinstall  4096 Jun 16 2011 ant-ext
    drwxr-xr-x 5 oracle oinstall  4096 Jun 16 2011 ant
    -rw-r--r-- 1 oracle oinstall 11324 Dec 18 09:18 antinstall-config.xml.ORIG
    -rwxr-xr-x 1 oracle oinstall  4249 Dec 18 10:01 install.sh
    drwxr-xr-x 4 oracle oinstall  4096 Dec 18 10:06 common
    -rw-r--r-- 1 oracle oinstall 16244 Dec 19 10:37 antinstall-config.xml
    -rw-r--r-- 1 oracle oinstall   689 Dec 19 10:37 ant.install.log
    [oracle@test-rms-app application]$
    Application installation:
    [oracle@test-rms-app application]$ ./install.sh
    THIS IS the driver directory
    Verified $ORACLE_SID.
    Verified SQL*Plus exists.
    Verified write permissions.
    Verified formsweb.cfg read permissions.
    Verified Registry.dat read permissions.
    Verified Java version 1.4.2.x or greater. Java version - 1.6.0
    Verified Tk2Motif.rgb settings.
    Verified frmcmp_batch.sh status.
    WARNING: Oracle Enterprise Linux not detected.  Some components may not install properly.
    Verified $DISPLAY - 172.16.129.82:0.0.
    This installer will ask for your "My Oracle Support" credentials.
    Preparing installer. This may take a few moments.
    Your internet connection type is: NONE
    Integrating My Oracle Support into the product installer workflow...
         [move] Moving 1 file to /binary_files/STAGING_DIR/rms/application
    Installer preparation complete.
    MW_HOME=/u01/app/oracle/Middleware/NewMiddleware1034
    ORACLE_HOME=/u01/app/oracle/Middleware/NewMiddleware1034/as_1
    ORACLE_INSTANCE=/u01/app/oracle/Middleware/NewMiddleware1034/asinst_1
    DOMAIN_HOME=/u01/app/oracle/Middleware/NewMiddleware1034/user_projects/domains/rmsClassDomain
    WLS_INSTANCE=WLS_FORMS
    ORACLE_SID=rmsdbtst
    JAVA_HOME=/u01/app/oracle/jrockit-jdk1.6.0_45-R28.2.7-4.1.0
    Launching installer...
    To make sure I have connectivity from the app server to the database (on a database server) here are the steps followed:
    [oracle@test-rms-app application]$ tnsping rmsdbtst
    TNS Ping Utility for Linux: Version 11.1.0.7.0 - Production on 19-DEC-2013 10:41:40
    Copyright (c) 1997, 2008, Oracle.  All rights reserved.
    Used parameter files:
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = test-rms-db.vonmaur.vmc)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = rmsdbtst)))
    OK (0 msec)
    [oracle@test-rms-app application]$
    [oracle@test-rms-app application]$ sqlplus rms13@rmsdbtst
    SQL*Plus: Release 11.1.0.7.0 - Production on Thu Dec 19 10:46:18 2013
    Copyright (c) 1982, 2008, Oracle.  All rights reserved.
    Enter password:
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    SQL> exit
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    [oracle@test-rms-app application]$
    [oracle@test-rms-app application]$ ping test-rms-db
    PING test-rms-db.vonmaur.vmc (192.168.1.140) 56(84) bytes of data.
    64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=1 ttl=64 time=0.599 ms
    64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=2 ttl=64 time=0.168 ms
    64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=3 ttl=64 time=0.132 ms
    64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=4 ttl=64 time=0.158 ms
    64 bytes from test-rms-db.vonmaur.vmc (192.168.1.140): icmp_seq=5 ttl=64 time=0.135 ms
    --- test-rms-db.vonmaur.vmc ping statistics ---
    5 packets transmitted, 5 received, 0% packet loss, time 4001ms
    rtt min/avg/max/mdev = 0.132/0.238/0.599/0.181 ms
    [oracle@test-rms-app application]$
    [oracle@test-rms-app application]$ uname -a
    Linux test-rms-app.vonmaur.vmc 2.6.18-128.el5 #1 SMP Wed Jan 21 08:45:05 EST 2009 x86_64 x86_64 x86_64 GNU/Linux
    [oracle@test-rms-app application]$
    [oracle@test-rms-app application]$ cat /etc/*-release
    Enterprise Linux Enterprise Linux Server release 5.3 (Carthage)
    Red Hat Enterprise Linux Server release 5.3 (Tikanga)
    [oracle@test-rms-app application]$
    The database is created and all the batch file scripts have been successfully deployed.  Now working on the application server.  The  Weblogic server is installed and 11g forms and reports are installed successfully.
    Any help would be helpful.
    Thanks,
    Ram.

    Please check MOS Notes:
    FAQ: RWMS 13.2 Installation and Configuration (Doc ID 1307639.1)

  • Problem in JDBC connection to database

    Hi,
    I m new to JDBC. I want to retrive some data from the database in my JSP page. How do i do it ??? I written a following code,
    String custid = null;
    String custname = null;
    String custref = null;
    try {
    Class.forName("oracle.jdbc.driver.OracleDriver");
    Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@<server>:1521:yoda","scott","tiger");
    Statement stmt = conn.createStatement();
    String strCustomer = "select customer_id from fmm_user_access where login_id = '" + username + "';";
    ResultSet rset = stmt.executeQuery(strCustomer);
    while (rset.next())
    custid = rset.getString(1);
    custref = "1."+custid;
    strCustomer = "select full_name from fmm_ofin_customers where customer_ref ='"+ custref + "'";
    ResultSet rset1 = stmt.executeQuery(strCustomer);
    while (rset1.next())
    custname = rset1.getString(1);
    conn.close();
    } //try
    catch (Exception e) {e.getMessage();}
    Are there any setup issues which i m missing, like setting some paths. Please advise.
    Thanks in advance
    Unmesh

    Hi Unmesh,
    I did not see any code in your JSP page which is printing the output of your query.
    You may want to modify your JSP to display the results like this
    <%@ page import="java.sql.*" %>
    <HTML><BODY>
    <%
    strCustomer = "select full_name from fmm_ofin_customers where customer_ref ='"+ custref + "'";
    ResultSet rset1 = stmt.executeQuery(strCustomer);
    while (rset1.next())
    custname = rset1.getString(1); %>
    Customer Name is <%=custname%>
    <BR>
    <% }
    conn.close();
    ........... %>
    </BODY></HTML>
    And you will need to ensure that the JDBC drivers( classes12.jar or ojdbc14.jar) are in your classpath.
    A couple of other observations I have about your code is
    1. You must explicitly close the ResultSet and Statement objects after you finish using them: rset.close();stmt.close()
    2. Try using PreparedStatements for your insert statements which allows you to define bind parameters. In your case -
    PreparedStatement pstmt =
    conn.prepareStatement ("select customer_id from fmm_user_access where login_id = ?");
    pstmt.setString (1, userName);
    You can refer to JDBC samples on OTN for more information : http://otn.oracle.com/sample_code/tech/java/sqlj_jdbc/content.html
    Hope this helps.
    Sujatha.

  • When and How to close database connection in JSP?

    Hi there,
    I am using MySQL and JDBC 3.0, in my system, When and How to close database connection in JSP?
    Thanks in advance.
    Lonely Wolf
    <%@ page session="true" language="java" %>
    <jsp:include page="checkauthorization.jsp" />
    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
    <%--
    Execute query, with wildcard characters added to the
    parameter values used in the search criteria
    --%>
    <sql:query var="availablecomputerList" dataSource="jdbc/Bookingcomputer" scope="request">
    SELECT * FROM computer where status=0
    order by s_code
    </sql:query>
    <html>
    <head>
    <title>Search Result</title>
    </head>
    <body bgcolor="white">
    <center>
    <form action="checkin.jsp" method="post">
    <input type="submit" value="Back to Check-in Page">
    </form>
    <c:choose>
    <c:when test="${availablecomputerList.rowCount == 0}">
    Sorry, no available computer found.
    </c:when>
    <c:otherwise>
    The following available computers were found:
    <table border="1">
    <th>Computer</th>
    <th>Description</th>
    <th>Status</th>
    <c:forEach items="${availablecomputerList.rows}" var="row">
    <tr>
    <td><c:out value="${row.s_code}" /></td>
    <td><c:out value="${row.description}" /></td>
    <td><c:out value="${row.status}" /></td>
    </tr>
    </c:forEach>
    </table>
    </c:otherwise>
    </c:choose>
    </center>
    </body>
    </html>

    when should you close the connection? when you're done with it.
    how should you close the connection? like this: conn.close();
    that said, doing this in a JSP page is bad form and not recommended
    JSP's typically don't contain ANY business or data logic

  • Connection sharing for embedded JDBC and DatabaseController

    <p> </p><p>I would like to share an existing JDBC connection with the DatabaseController (i.e. same session in database).  Basically I need to call a stored proc in the JSP page then use the same (already established and open) connection for the DatabaseController to run the report.</p><p>Is that possible?  If so, can you give me a brief example.  I&#39;m well versed in Java, but not at all in CR.  I&#39;m trying to help evaluate the effort to merge existing web application code with CR reports.  The company has many existing CR files that I would like to "take to the web", but the underlying database uses session information and VPD for security.</p><p>For reference I&#39;m using an Oracle 10g database.  I would also welcome an answer that uses connection pooling and I could simply hand out pooled connections to the DatabaseController.</p><p>Thanks! <br /></p><p> </p><p> </p>

    <p>Hi, </p><p>      Unfortunately there currently is no way to pass a JDBC connection to the report at runtime (this would be a great idea to track under the enhancement requests forum section). That being said there are other options you can do to get connection pooling functionality within your application. Probably the easiest way is to use JNDI. This will allow the application server to handle the Connection Pool. There is an optional property of the database connection of a report which allows the report designer to specify a JNDI lookup name. At runtime the report will look for this lookup name first prior to attempting to make the JDBC connection.</p><p>You can look at this comment on another question for instructions on how to set the JNDI optional name:</p><p><u><strong><a href="/node/483#comment-79">http://diamond.businessobjects.com/node/483#comment-79</a></strong></u>  </p><p>Another option is for you to pass in a java.sql.ResultSet at runtime to the report. It sounds like you are already making a JDBC connection at runtime so it shouldn&#39;t be too difficult for you to add the SQL query statement to populate a ResultSet. Once you have the ResultSet populated you can pass it into the report. In fact the wizard which is outlined on the comment listed above has a screenshot of the wizard which will generate the code at runtime to view a report. If you select the option in the wizard to "<strong>Populate the report with a java.sql.ResultSet"</strong> it will generate the necessary code stub to demonstrate how this will work.</p><p>The only downside to passing in the resultset at runtime is that it requires the entire dataset to be populated prior to passing it to the report. If the dataset is relatively small the performance impact will likely be acceptable, however if you start getting in to the tens of thousands of records then you may start seeing some performance implications. </p><p>Hope this helps. Let me know if you have any follow-up questions. </p><p>Regards,<br />Sean Johnson (CR4E Product Manager) </p>

  • How to connect the database (JDBC) using service name rather than SID

    How should we make the connection to the database using service name. Initially, we are using the SID to make the database connection, with following setting in the data-source.xml in OC4J using ABCDB as the SID.
    <data-sources>
         <data-source
              class="com.evermind.sql.DriverManagerDataSource"
              name="jdbc/ABCDB"
              location="jdbc/ABCDB"
              pooled-location="jdbc/OracleDSPooled"
              xa-location="jdbc/xa/OracleDSXA"
              connection-driver="oracle.jdbc.driver.OracleDriver"
              username="ABC"
              password="ABC"
              url="jdbc:oracle:thin:@191.1.4.126:1521:ABCDB"
         />
    </data-sources>
    It work, but now we need to make the connection using this service name ABCSERVICE, but it doesn't work in the OC4J (JDBC). May I know how should we handle this connection?
    Thanks and Regards,
    Pang

    Finally, I got the solution to make the database connection using service name, with putting the tnsname setting in URL portion.
    url="jdbc:oracle:thin:@(description=(address=(host=191.1.4.126)(protocol=tcp)(port=1521))(connect_data=(SERVICE_NAME = ABCSERVICE)))"
    And now, it is working fine.
    Regards,
    Pang

  • How to use JDBC to connect informix database

    Dear all,
    I want my client application to connect informix database by using JDBC. The JDBC driver has been installed successfully in the client computer (Win2000). The informix 5.0 resides the a Unix server named "dbserver". The following is my java program.
    ========================
    import java.sql.*;
    import java.awt.event.*;
    public class Application1 {
    public static void main(String[] args) {
    Connection conn;
    try
    Class.forName("com.informix.jdbc.IfxDriver");
    catch (Exception e)
    System.out.println("Error "+e.getmessage());
    e.printStackTrace();
    return;
    System.out.println("It is ok");
    try
    conn = DriverManager.getConnection("jdbc:informix-sqli://dbserver:1526:INFORMIXSERVER=dbserver;username=test;password=******");
    catch (SQLException e)
    System.out.println("ERROR ."+e.getMessage());
    e.printStackTrace();
    return;
    System.out.println("All is fine");
    ===========================
    However, the error appears mentioning "Attempt to connect to database server (dbserver) failed." I don't know what the problem is because my informix database server is exactly "dbserver".
    Kindly need help from you guys. Thanks in advance.
    Kevin

    Hi,
    Plz try this (instead of 'username' use 'user') ...
    DriverManager.getConnection("jdbc:informix-sqli://dbserer:1526:INFORMIXSERVER=dbserver;user=test;password=*****");
    or this (pass the username and password as params)....
    DriverManager.getConnection( "jdbc:informix-sqli://dbserer:1526:INFORMIXSERVER=dbserver" , "test" , "*****" );
    Hope this helps
    ssa.
    >
    I want my client application to connect informix
    database by using JDBC. The JDBC driver has been
    installed successfully in the client computer
    (Win2000). The informix 5.0 resides the a Unix server
    named "dbserver". The following is my java program.
    ========================
    import java.sql.*;
    import java.awt.event.*;
    public class Application1 {
    public static void main(String[] args) {
    Connection conn;
    try
    Class.forName("com.informix.jdbc.IfxDriver");
    catch (Exception e)
    System.out.println("Error "+e.getmessage());
    e.printStackTrace();
    return;
    System.out.println("It is ok");
    try
    conn =
    onn =
    DriverManager.getConnection("jdbc:informix-sqli://dbser
    er:1526:INFORMIXSERVER=dbserver;username=test;password=
    catch (SQLException e)
    System.out.println("ERROR ."+e.getMessage());
    e.printStackTrace();
    return;
    System.out.println("All is fine");
    ===========================
    However, the error appears mentioning "Attempt to
    connect to database server (dbserver) failed." I don't
    know what the problem is because my informix database
    server is exactly "dbserver".
    Kindly need help from you guys. Thanks in advance.
    Kevin

  • How to connect mySQL database with jdbc

    Who can tell me how to connect mySQL database with jdbc? Thanks

    http://onesearch.sun.com/search/developers/index.jsp?and=connect+mysql&nh=10&phr=&qt=&not=&field=title&since=&col=devforums&rf=0&Search.x=24&Search.y=16

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

  • Installing JDBC driver to connect to Oracle 8i Database from Weblogic 10.3

    I want to connect to Oracle 8i database from weblogic 10.3 application server. I found a classes12. zip file on Oracle.com to use as driver for the same.
    I am also connecting Oracle 9i database from the app server. Now if i replace the classes12. jar from the lib folder won't it disallow me to connect to the Oracle 9i database.
    2ndly the claases12.zip file i found from the site is for jdk 1.2 will it create any problems. Please let me know
    Kindly let me know what is the standard procedure to install a new driver in Weblogic 10.3.

    I tried to install weblogic 10.3 using jdk 1.5.07 but. it is not supported. Moreover from the sites also i found that it's only the application wars and ears compiled in jdk 1.5 need not be recompiled in 1.6. But no reference of jdk 1.5 is there.
    I tried to use thin client from the code and connect to Oracle 7i
    i got the following exception.
    java.lang.ArrayIndexOutOfBoundsException: 4
    at oracle.jdbc.driver.T4C8TTIdty.marshal(T4C8TTIdty.java:465)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:329)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:
    490)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:202)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtensio
    n.java:33)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:474)
    at java.sql.DriverManager.getConnection(DriverManager.java:582)
    at java.sql.DriverManager.getConnection(DriverManager.java:185)
    at com.omantel.finacc.DAO.DatabaseConnection.getUBCCConnection(DatabaseC
    onnection.java:372)
    at com.omantel.finacc.java.DMADAO.getUBCLAmount(DMADAO.java:411)
    at jsp_servlet.__receiptentry._jspService(__receiptentry.java:1198)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run
    (StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecuri
    tyHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
    a:292)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
    a:175)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
    n.run(WebAppServletContext.java:3498)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
    dSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(Unknown Source)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppS
    ervletContext.java:2180)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletC
    ontext.java:2086)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.j
    ava:1406)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    <Apr 22, 2009 3:36:47 PM GMT+04:00> <Error> <HTTP> <BEA-101017> <[weblogic.servl
    et.internal.WebAppServletContext@553afb - appName: 'DMA', name: '/DMA', context-
    path: '/DMA', spec-version: 'null'] Root cause of ServletException.
    com.omantel.finacc.exception.AppException: 4
    at com.omantel.finacc.exception.ExceptionHandler.handleException(Excepti
    onHandler.java:43)
    at com.omantel.finacc.java.DMADAO.getUBCLAmount(DMADAO.java:428)
    at jsp_servlet.__receiptentry._jspService(__receiptentry.java:1198)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run
    (StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecuri
    tyHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
    a:292)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
    a:175)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
    n.run(WebAppServletContext.java:3498)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
    dSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(Unknown Source)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppS
    ervletContext.java:2180)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletC
    ontext.java:2086)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.j
    ava:1406)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    java.lang.ArrayIndexOutOfBoundsException: 4
    at oracle.jdbc.driver.T4C8TTIdty.marshal(T4C8TTIdty.java:465)
    at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:329)
    at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:
    490)
    at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:202)
    at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtensio
    n.java:33)
    at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:474)
    at java.sql.DriverManager.getConnection(DriverManager.java:582)
    at java.sql.DriverManager.getConnection(DriverManager.java:185)
    at com.omantel.finacc.DAO.DatabaseConnection.getUBCCConnection(DatabaseC
    onnection.java:372)
    at com.omantel.finacc.java.DMADAO.getUBCLAmount(DMADAO.java:411)
    at jsp_servlet.__receiptentry._jspService(__receiptentry.java:1198)
    at weblogic.servlet.jsp.JspBase.service(JspBase.java:34)
    at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run
    (StubSecurityHelper.java:227)
    at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecuri
    tyHelper.java:125)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
    a:292)
    at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.jav
    a:175)
    at weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
    n.run(WebAppServletContext.java:3498)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
    dSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(Unknown Source)
    at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppS
    ervletContext.java:2180)
    at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletC
    ontext.java:2086)
    at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.j
    ava:1406)
    at weblogic.work.ExecuteThread.execute(ExecuteThread.java:201)
    at weblogic.work.ExecuteThread.run(ExecuteThread.java:173)
    >

Maybe you are looking for