Database access via Jdbc  in JSP

Hey guys,
Need a help here..I want to compare a data to existing data in a table sequencially.
1)re is the example, if i have a user login prog,i want to compare the user already exists in that data table.
if so how can print the user id's to compare?
and 2)at if the user id is a wave file(binary data) in SQl? since its immposible to compare the binary data?
keep me posting,thanks

1. Well, perform a query.
2. Who says you can't compare "binary" data?

Similar Messages

  • Remote database access via JDBC?

    Hello,
    Can anyone give me info on accessing remote databases (i.e. Microsoft
    Access, etc) from Java programs (Servlets, JSP's, Classes) residing on the
    iSeries (AS400) or perhaps any platform?
    I currently have a couple of web applications set up on the Websphere App server that access DB2/400 database and I also have some Java Classes on PC's that access MS Access datafiles. I would like to begin writing the majority of my applications that run on the iSeries (or host system) that can remotely access other databases on our network.
    Any info would be of great help to me.
    Thank you
    Don

    I don't know of any existing Access JDBC drivers that support remote access, after all, the Access database itself is not remote access capable except via file sharing. One possibility is to look for a Type 3 JDBC driver that supports reuse of other Type 1 (ODBC bridge), Type 2 (Java/Native Mix) and Type 4 (pure Java)JDBC drivers on the server side.
    If you were using WebLogic Server, I suppose you could use its remote JDBC facilities, but that won't help you.
    One problem you will have to face is that Access JDBC drivers are not (if I recall) meant to be used in a multithreaded fashion. Good luck. By the way, it might be far simpler to port the Access database to DB2/400.
    Chuck

  • 10G Forms connect to MS Access via JDBC

    A new project requires a 10G Form to connect to MS Access database. I understand 10G no longer connects to Access using ODBC. Will JDBC work? If JDBC can be used does anyone have a "How To" document or examples on how to connect orms 10G to MS Access via JDBC
    Thanks
    Ralph

    I dont think it will work. In 10g forms is going to implement transparent gateways.
    Is there a possibility of getting the data from MS access directly to Oracle database and then connect to Oracle DB from forms ?
    Rajesh Alex

  • PJC and database access through JDBC

    Hello,
    I'm trying to access to the database through a PJC via JDBC.
    conn = DriverManager.getConnection ("jdbc:oracle:thin:@machine:1521:XE", "user", "pwd");It works fine on a XE database, but fails on another XE one:
    Oracle JInitiator: Version 1.3.1.22
    java.lang.NullPointerException
         at oracle.jdbc.ttc7.O3log.marshal(O3log.java:606)
         at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:255)
         at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:377)
         at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:515)
         at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:345)
         at java.sql.DriverManager.getConnection(Unknown Source)
         at java.sql.DriverManager.getConnection(Unknown Source)
         at oracle.forms.fd.AsyncJob.connect(AsyncJob.java:68)
         at oracle.forms.fd.AsyncJob.run(AsyncJob.java:121)
         at java.lang.Thread.run(Unknown Source)It also fails on a remote Unix database:
    java.security.AccessControlException: access denied (java.net.SocketPermission monadev resolve)
         at java.security.AccessControlContext.checkPermission(Unknown Source)
    ...so I edit the java.policy file of the Jinitiator directory:
    permission java.net.SocketPermission "machine:port-", "accept,connect,listen,resolve";     and then get the same execption:
    java.lang.NullPointerException
         at oracle.jdbc.ttc7.O3log.marshal(O3log.java:606)
         at oracle.jdbc.ttc7.TTC7Protocol.logon(TTC7Protocol.java:255)
    ...Finally, it work on only one machine and only a local database.
    I'm probably missing something somewhere.
    Is anyone could give me some light on this ?
    Thanks in advance,
    Francois

    I'm just learning to work with PJC's, so I'm unsure whether I can help, but here goes. I found the following archived on Google Groups (http://groups.google.com):
    Hi. The basic applet security model is that it can only make connections
    back to the machine from which it was downloaded. If you want to do
    JDBC from an applet to a DBMS not on the applet-server machine,
    you need a type-3 JDBC driver. A type-3 JDBC driver has an all-Java
    client driver piece which an applet can download and use. This driver
    piece connects to a proxy piece which is running on the webserver
    machine. This proxy piece then connects to any DBMS anywhere on the
    net, and is the middleman between the JDBC client and DBMS.
       For security, management and performance reasons it's usually better to
    constrain JDBC to a middle tier such as in a servlet, and use HTML to and
    from the client, rather than the space and time involved in downloading a
    full general query engine (a JDBC driver) to a client which typically uses
    .1% of the capability or classes of the JDBC driver.
    Joe Weinstein at BEA HTH,
    Eric Adamson
    Lansing, Michigan

  • Abap-table access via JDBC

    Hello,
    we have a java-program, that accesses data via jdbc to a mysql-database.
    Now we want to migrate the mysql-table to abap-table.
    How can we access from the  java-program to theese migrated abap-tables via jdbc?
    Regards Oliver

    Oliver,
    If you want to access those tables from SAP, then you have to use the Java Connectors (
    JCO).
    Please write the more details abount the java IDE and OS, which you are using I will send you appropriate help.
    Thanks

  • Database Access via ODBC

    Hi,
    Since recent (LMS3.2) Cisco released the Open Database Schema support. In the guidelines I find info/procedures to access the database remotely via ODBC. However only Solaris/Solaris Windows/Windows is described. Is there any info how I can access the Database (LMS installed on Sol10) remotely via a Windows system ?
    Jan

    The instructions for Windows/Windows apply, but you'll need to first get the necessary DLLs to allow for database access. The easiest way to do this would be to install Common Services from the LMS 3.2 DVD on a Windows 2003 or 2008 machine. Then extract the DLLs, and uninstall Common Services.
    It may also be possible to start the installer, have it extract the install bits to the TEMP location, then you can pull the DLLS from there. However, I have not tried this for obtaining database DLLs (only device packages).

  • Palm Database access via Midlet application

    Hi.
    I'm trying to access a Palm database from within a Midlet application for the Palm.
    Is there a Java API that I can upload onto my Palm which will give me access to the Palm database ?
    Regards,
    Matt
    P.S. Here's what I've tried already.
    I cannot get hold of the KVMUtil.prc, nor it's associated SDK. It seems like it has been replaced by the MIDP SDK.
    RMS is the only database access provided in the MIDP suite, described in the following article :
    http://developer.java.sun.com/developer/technicalArticles/wireless/midpdatabase/
    This is too generic for me - as it should be - midlets are supposed to run on more than just Palm devices.

    Hi Matt:
    I'll address your 5 major areas 1 at a time. This is only my opinion, only you can decide what will work best for you.
    Sun may have stated the Kjava API is not officially supported. However, Sun has enhanced the Kjava API since its initial release.
    1. I'm trying to access a Palm database from within a Midlet application for the Palm.
    What I'm doing is treating the com.sum.kjava classes as an add on package, using the JAR tool to include these classes prior to building the .PRC.
    2. Is there a Java API that I can upload onto my Palm which will give me access to the Palm database ?
    Yes, it is part of the j2me_cldc installation, see below. It will allow you access to any PDB on the Palm. Like Palm address, memo etc.
    3. I cannot get hold of the KVMUtil.prc, nor it's associated SDK. It seems like it has been replaced by the MIDP SDK.
    When a developer downloads and unZips the most recent versions of the two j2me files:
    j2me_cldc-1_0_2-fcs-winunix.zip
    j2me_cldc-1_0_2-fcs-kjava_overlay.zip
    the following directory structure is created
    c:\j2me_cldc\bin\common\api\classes;
    -- j2me_cldc
    -- bin
    -- common
    -- api
    -- classes
    -- com
    -- java
    -- util
    -- javax
    -- microedition
    -- io
    etc.
    As of 05/01/2001 the KVM.prc and KVMUtil.prc existed here: c:\j2me_cldc\bin\kjava\palm\
    When a developer downloads and unZips the most recent version the file:
    j2me_cldc-1_0-fcs-bin-b10-win-15_sep_2000.zip
    the following directory structure is created
    c:\midp-fcs
    -- classes
    -- java
    -- util
    -- javax
    -- microedition
    -- io
    -- lcdui
    etc.
    When a developer downloads and installs the most recent version the file:
    j2me_wireless_toolkit-1_0_2-ea-win.exe
    the following directory structure is created:
    c:\J2MEWTK
    --bin
    midpapi.zip
    etc.
    Three places to get the MIDlet classes each class has a different creation date too. I've installed the classes oldest to newest in my development environment.
    Check you classpath. I've created a setup.bat to configure the classpath.
    4. RMS is the only database access provided in the MIDP suite, described in the following article:
    No. It is one of two options, RMS and Kjava Database. However, it may not be a option for a Palm if the RMS Database cannot be created on a server and then HotSync'ed to a Palm. A Palm app would be pretty useless if we cannot instantiate its databases with data.
    5. This is too generic for me - as it should be - midlets are supposed to run on more than just Palm devices.
    I agree, that is why I have not stopped using the Kjava Database objects. I've written a server-side Palm Database API the will convert data from any source into Palm PDB's. These PDBs are then HotSync'ed to the Palm. A Palm app would be pretty useless if we cannot instantiate its databases with data.
    Matt, let me know if this helps.

  • Command Window Database Access via a DataSource (Pt 2)

    Hi.
    For those of you (especially duffymo) who were good enough to make suggestions concerning my problems when attempting to access an Oracle 10g database via a DataSource from a servlet the week before last, I'm pleased to say that I got that working on my return from holiday!
    Now to return to an earlier problem...
    I'd like to access the same database from a standalone, command window program and have tried setting the INITIAL_CONTEXT_FACTORY and PROVIDER_URL properties as shown below.
    Hashtable envt = new Hashtable();
    envt.put(Context.INITIAL_CONTEXT_FACTORY,
    "org.apache.commons.dbcp.BasicDataSourceFactory");
    envt.put(Context.PROVIDER_URL, "http://localhost:8080");
    Context initialContext = new InitialContext(envt);
    Context context =(Context)initialContext.lookup("java:comp/env");
    DataSource dataSource =(DataSource)context.lookup("jdbc/Oracle_Finances");
    connection = dataSource.getConnection();
    However, this generates error messages with root exception "java.lang.ClassNotFoundException: org.apache.comons.dbcp.BasicDataSourceFactory".
    If I copy the JAR file containing BasicDataSourceFactory (viz. commons-dbcp-1.2.1.jar) from Tomcat's common\lib folder into Java's jre\lib\ext folder, then I get a similar set of error messages, but the root exception changes from ClassNotFoundException to "java.lang.ClassCastException: org.apache.comons.dbcp.BasicDataSourceFactory".
    Does anybody know where the problem lies??
    Any help most appreciated.
    Cheers.
    Jan

    I'd like to access the same database from a
    standalone, command window program and have tried
    setting the INITIAL_CONTEXT_FACTORY and PROVIDER_URL
    properties as shown below.I've never done this. I'm not sure if it can or should be done.
    The problem is that the standalone app isn't part of any Tomcat context.
    It also ties your standalong app to Tomcat. I don't think you want to do that.
    There's got to be a way to manage this without resorting to Tomcat. I'd look at the Commons docs to see.
    If I copy the JAR file containing
    BasicDataSourceFactory (viz. commons-dbcp-1.2.1.jar)
    from Tomcat's common\lib folder into Java's
    jre\lib\ext folder, This is a terrible idea. You shouldn't be putting anything in jre/lib/ext - it'll cause more problems than it's worth.
    Create a /lib directory for your project and put the 3rd party JARs in there. Disk space is cheap, and keeping all the artifacts that you need to create your app in one place is a good idea.
    %

  • Inserting data into Ms Access via jdbc odbc connectivity

    Can anyone help dictate what's wrong with this below method which is supposed to be adding new record(append) into my ms Access Table. This is giving me a hell of problem, I thought I have everything well. The module is branched via a Swing ui. Can you debug this ? and send a new code to try?
    public void Query3(){
    try{
    //while(rs.next() )
    stmt.executeUpdate("INSERT INTO pupRegister_Table1 " +
         "VALUES ('1001', 'Simpson', 'Mr.', 'Springfield', '2001')");
    //stmt.executeUpdate ("INSERT INTO pupRegister_Table1 " +
    //"VALUES(var_firstname)");
    // Close the result set, statement and the connection
    rs.close() ;
    stmt.close() ;
    conn.close() ;
    } catch( SQLException se )
    System.out.println( "SQL Exception:" ) ;
    Thanks. Note I have done all the DriverManager stuff already and other modules like for displaying the records, do work fine.

    Thanks a lot,
    that contribution really helped but I realised that I Missed adding the
    insertRow();
    that did the trick and it works fine now
    Thanks
    Yet another issue is about inserting the current date into the date field having data type as date. Hence I am using the Jdbc stuff. I am having problem here
    any further help?

  • Concurrent Access to JDBC from JSP

    I'm sure that I am not the first to ask this !!
    I have a JSP page that uses a bean to access a database table.
    This page gets a set of records, and displays a list, with the Primary key set to a hyperlink.
    This link tkaes the user to a detail page, that gets the specific record and displays all the fields.
    Now, if while the index page is running it's query, another page also runs the query, the two lists get mixed up, or if a user calls up the detail page, while another is running the list, the detail page doesn't grab the correct record.
    I have set <%@ page isThreadSafe="false" %> on every JSP page, and also set every public method in the bean to synchronized, but still the problem.
    The bean has PAGE scope.
    Any ideas ?? It's driving me nuts !!

    I am facing the same problem...... When same JSP Page Query is accessed by more than one client at the same time, results get mixed up. Is there any to prevent this....Please HELP!!!!!!!!!!!!!!!!!

  • Command Window Database Access via a DataSource

    Hi.
    I've succeeded in accessing a MySQL database via a DataSource from a servlet that makes use of a DAO. However, I would now like to use the same DAO to access the database from a standalone, command window program.
    The error that I am getting is "javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial". This error is generated by the second of the following two lines in the DAO:
    Context initialContext = new InitialContext();
    Context context = (Context)initialContext.lookup("java:comp/env");
    Is there any way in which I can get a standalone program to make use of my server.xml and web.xml DataSource mappings to access the database??
    Any help would be most appreciated.
    Thanks in anticipation.
    Jan

    The error that I am getting is
    "javax.naming.NoInitialContextException: Need to
    specify class name in environment or system property,
    or as an applet parameter, or in an application
    resource file: java.naming.factory.initial". This
    error is generated by the second of the following two
    lines in the DAO:
    Context initialContext = new InitialContext();
    Context context =
    (Context)initialContext.lookup("java:comp/env");
    The error itself suggests some solution to you. You need to specify the environment variables in the parameter to the InitialContext constructor. something like this...
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
    env.put(Context.PROVIDER_URL, "t3://localhost:7001");
    Context context = new InitialContext(env);Cheers!
    ***Annie***

  • Access to Database Access from JDBC

    Hello,
    I have a RFC to JDBC scenario.
    The database is on a different machine to the XI, but from XI is going to map a drive to see the database.
    In the communication channel I specified the drive with the rest of the path:
    jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=Z:/TestDB.mdb
    and I get an error:
    com.sap.aii.af.ra.ms.api.DeliveryException: Database connection could not be established
    Is it possible to access an Access database that is not physically in the machine XI?
    thanks very much,

    hi silvia
    first, you need to install JDBC driver in PI to be able to connect to MS Access.
    please, see these links
    https://forums.sdn.sap.com/click.jspa?searchID=24103238&messageID=7100823
    Re: MS access o XI : External driverof access is required or not.
    Regarding File to JDBC/MS Access database
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f04ce027-934d-2a10-5a8f-fa0b1ed4d88f
    thanks
    PD:points if useful
    Rodrigo

  • Database Access via WLS Datasource

    I need to access a database resource by JNDI Datasource lookup and not by JDBC Direct Connection. This is needed because the underlying database is an Oracle RAC with several machines and my intention is to use WLS MultiDatasource Feature to round-robin and failover all the database needs.
    Could someone help me ??
    Thanks in advance

    I'd like to access the same database from a
    standalone, command window program and have tried
    setting the INITIAL_CONTEXT_FACTORY and PROVIDER_URL
    properties as shown below.I've never done this. I'm not sure if it can or should be done.
    The problem is that the standalone app isn't part of any Tomcat context.
    It also ties your standalong app to Tomcat. I don't think you want to do that.
    There's got to be a way to manage this without resorting to Tomcat. I'd look at the Commons docs to see.
    If I copy the JAR file containing
    BasicDataSourceFactory (viz. commons-dbcp-1.2.1.jar)
    from Tomcat's common\lib folder into Java's
    jre\lib\ext folder, This is a terrible idea. You shouldn't be putting anything in jre/lib/ext - it'll cause more problems than it's worth.
    Create a /lib directory for your project and put the 3rd party JARs in there. Disk space is cheap, and keeping all the artifacts that you need to create your app in one place is a good idea.
    %

  • Error in extracting String value from MS ACCESS via JDBC

    Something wierd occurs in my program. I have a ACCESS database table named FormDetail. The attributes are:
    name memo
    val memo
    The actual data store in such a table is
    haihe 2
    String test="SELECT name, val FROM FormDetail";
    rs = stmt.executeQuery(test);
    while(rs.next())
    {  String name = rs.getString("name");
    String value = rs.getString("val");
    System.out.println("name: "+name+" value: "+value);
    When I execute the code, the output is
    name: haihe value:
    NO VALUE print out. Why?
    Any suggestion will be helpful! Thanks!

    Though not using Access myself in the moment, I remember a lot of post about its memo fields.
    Recommend to search for "+access +memo" here.

  • Database Access via a Servlet

    Hello
    I have the following Servlet code:
    package server;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import java.io.PrintWriter;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.sql.DriverManager;
    import java.sql.ResultSet;
    import java.sql.Connection;
    import java.sql.Statement;
    import java.sql.SQLException;
    import javax.sql.DataSource;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    public class ServletDB extends HttpServlet {
       private static String URL= "jdbc:microsoft:sqlserver://localhost:90;" +
         "DatabaseName=Filme;User=sa;Password=";     
      // GET handles the 'read' action
      protected void doGet(HttpServletRequest request,
                           HttpServletResponse response) throws IOException {
        PrintWriter out = response.getWriter();
        String action = request.getParameter("action");
        if (action == null) {
          out
            .println("You need to specify 'create' as the action parameter in GET.");
          return;
        if (action.equals("read")) {
          readDB(request, response, out);
        } else {
          out.println(action + " is not a valid action parameter.");
        return;
      public void doPost(HttpServletRequest request,
                         HttpServletResponse response) throws ServletException,
                         IOException {
        doGet(request, response);
      private void readDB(HttpServletRequest request,
                          HttpServletResponse response,
                          PrintWriter out) throws IOException {
        Statement stmt = null;
        ResultSet rs = null;
        Connection con = null;
        try {
          Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver").newInstance();
          con= DriverManager.getConnection(URL);       
          stmt = con.createStatement();
          rs = stmt.executeQuery("SELECT * FROM Voturi");
          // Read the data, a line at a time
          boolean hasEntries = false;
          while (rs.next()) {
            hasEntries = true;
            out.println(rs.getString("nume_film") + "," + rs.getString("nr_voturi")
                        + "," + rs.getString("an_de_productie"));
          if (!hasEntries) {
            out.println("database is empty");
          stmt.close();
          con.close();
        }catch (SQLException sqle) {
          out.println("Data not fetched. Check the stack trace!");
          sqle.printStackTrace();
        }catch (ClassNotFoundException cnfe) {
          cnfe.printStackTrace();
        }catch (InstantiationException instantiationException) {
          instantiationException.printStackTrace();
        }catch (IllegalAccessException illegalAccessException) {
          illegalAccessException.printStackTrace();
      // Get Servlet information
      public String getServletInfo() {
        return "server.ServletDB Information";
    }When I run this servlet I get a blank page instead of the requested information and I can't figure why?My database connection part of this program works because I tried it with a J2SE application. I have just started working with servlets so the answer might be simple but I just can't see it.
    Please help
    Regards,
    Michael

    Hello jSweep.
    Thank you for the reply.
    I put the jar files in the lib directory and run the servlet again. I got the following message: 'Data not fetched. Check the stack trace!'. I have no clue how to check the stack trace. Please help if you know how.
    Regards,
    Michael

Maybe you are looking for