Proble connecting Access in JSP

Hello friends
I am trying to connect MS Access database using jdbc-odbc driver. follwoing is the code:
<%@ page import="java.sql.*" %>
<html><head></head><body><%
    try{
        int companyId = 0;
        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        Connection cn = DriverManager.getConnection("jdbc:odbc:dream_jobs");
        out.println("Connected.........................");
        cn.close();
    catch(SQLException ex){
        out.println("<b><font color=red>Error occured while processing the data!!</font></b>") ;
        out.println(ex.getMessage());
    //finally
    %></body></html>-----------------------------------------------------
after running this code in Tomcat 5.5 on Windows XP (SP1) i get error
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified but when same DSN is used with .java source file it is OK.....
Please help me.
have a nice day

Sorry friends
I got the answer. The answer already was here on this forum. I am really sorry, first I should have searched and then should have posted......
have a nice day

Similar Messages

  • Database access in JSP?

    Can I easily access MS access using JSP? If it is, what kind of drive should be used to access the MS Access database?
    Thank you so much!

    <%!
    // define database parameters
    String host="localhost";
    String user="";
    String pass="";
    String db="";
    String conn;
    %>
    <%
    Class.forName("org.gjt.mm.mysql.Driver");
    // create connection string
    conn = "jdbc:mysql://" + host + "/" + db + "?user=" + user + "&password=" +
    pass;
    // pass database parameters to JDBC driver
    Connection Conn = DriverManager.getConnection(conn);
    // query statement
    Statement SQLStatement = Conn.createStatement();
    This is when accessing a database in a JSP, not a javabean... Try searching this forum, there are LOTS of topics about this.

  • Database Access from JSP

    I'm trying to access a SQL Server database through an ODBC connection on a JSP page and having difficulties. This is the code that I'm using:
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection conn = DriverManager.getConnection("jdbc:odbc:ODBCConnection", "username", "password");
    Statement stmt = conn.createStatement();
    ResultSet results = stmt.executeQuery(
    "SELECT numUserID, txtUsername, txtPassword FROM tblUsers");
    while (results.next()) {
    int DBuserid = results.getInt("numUserID");
    String DBusername = results.getString("txtUsername");
    String DBpassword = results.getString("txtPassword");
    conn.close();
    } catch (Exception exc) {                              
    out.println ("Exception \"" + exc + "\" occured....<br>");
    exc.printStackTrace();
    I've got two servers I'm testing it on. One is the IBM WebSphere 3.5 on Windows NT 4 and the other one is the Oracle 9i Server (Apache) with java support on Windows 2000. The code works fine on the Oracle server, but does not work on the WebSphere. I am getting a "java.sql.SQLException: [Microsoft][ODBC SQL Server Driver]Client unable to establish connection" exception. The problem is that I need to run this thing on the WebSphere server.
    I guess this might have something to do with the Java server differences or OS differences, but I don't know what that could be. I'm sure there's something that I'm not doing right, I just need some help figuring out what that is. I'd appreciate any help anyone can provide. Thanks.

    ODBC connection is set up the same on both servers and works with Access. In fact, I have tried to put the same code that I'm trying to use in a regular text java file, it compiled and ran on that same server. I've got a feeling I have the Websphere server setup wrong, but I don't know exactly what and how to fix it.
    Thanks.

  • MIcrosoft Access in JSP

    Hi,
    I would like to use as demo version, a JSP page which can connect on Access DB.
    Is there some good tutorial how to do it thru JSP ?
    thanks a lot,
    Maileen

    Hi,
    I would like to use as demo version, a JSP page which
    can connect on Access DB.
    Is there some good tutorial how to do it thru JSP ?
    thanks a lot,
    MaileenThere are tutorials to show how to connect to a database, including Access. JSP is immaterial, since JSP is supposed to be a view technology.
    Figure out how to do it with a POJO and then have your JSP simply call it.
    If you're asking how to set up a JNDI connection pool (an excellent idea), that's specific to the servlet/JSP engine you deploy your JSP to. Tomcat has docs - check them out.
    %

  • 500 error while accessing a jsp using tiles tags

    Hi all,
    when im trying to access a jsp which makes use of tiles tags, im getting the following error.
    status 500:
    org.apache.jasper.JasperException: The absolute uri: http://struts.apache.org/tags-tiles cannot be resolved in either web.xml or the jar files deployed with this application
    what might be the problem?
    Thanks in advance.

    asp,
    1. this is a java forum, and that's a jsp/struts question... you'll do better on the jsp forum.... or maybe a struts forum.
    2. it can't find http://struts.apache.org/tags-tiles ... but you knew that already didn't you... and where in the wide world might that uri be? maybe in struts generated xml? maybe in the schema declatation?
    keith.

  • Error while accessing a jsp file

              hi all,
              i am working on weblogic5.1 under solaris platform.
              my folder hierarchy is as follows weblogic_home/classes/weblogic/sun1/sun2.
              i have an import statement as follows import sun1.sun2.* in my JSP file.
              when i access this jsp file from my browser i have an error.
              the error is import package sun1 not found.
              i have set my classpath correctly(i feel so)...
              can anybody help me with this problem.
              if there is some fault in my classpath please tell me where exactly i should set my classpath for jsp files.
              thanx in advance.
              Prasad.
              

              Hi,
              1) what is your "weblogic.httpd.documentRoot=????"
              2) if it is "public_html" put your jsp there.
              Joe
              "Prasad" <[email protected]> wrote:
              >
              >hi all,
              >
              >i am working on weblogic5.1 under solaris platform.
              >
              >my folder hierarchy is as follows weblogic_home/classes/weblogic/sun1/sun2.
              >
              >i have an import statement as follows import sun1.sun2.* in my JSP file.
              >
              >when i access this jsp file from my browser i have an error.
              >
              >the error is import package sun1 not found.
              >
              >i have set my classpath correctly(i feel so)...
              >
              >can anybody help me with this problem.
              >
              >if there is some fault in my classpath please tell me where exactly i should set my classpath for jsp files.
              >
              >thanx in advance.
              >Prasad.
              

  • 500 error while trying to access a jsp which makes use of tiles tags

    Hi all,
    when im trying to access a jsp which makes use of tiles tags, im getting the following error.
    status 500:
    org.apache.jasper.JasperException: The absolute uri: http://struts.apache.org/tags-tiles cannot be resolved in either web.xml or the jar files deployed with this application
    what might be the problem?
    Thanks in advance.

    Hi all,
    sorry...got the reason for the above error..missed to include the tld file in WEB-INF.

  • Portal 3 Profile access through JSP on iws6

    Hi,
    I have portal 3 sp4 and iws6 installed on the same server. The portal basically has URL scrappers of the web server. I want to access the user profile from the JSP sitting on the iws6.
    For this i have added the following lines in the JSP
    <%@ page import="java.io.*"%>
    <%@ page import="java.util.*"%>
    <%@ page import="com.iplanet.portalserver.naming.*"%>
    <%@ page import="com.iplanet.portalserver.session.*"%>
    <%@ page import="com.iplanet.portalserver.profile.*"%>
    <%
    try{
    SessionID sid = null;
    Session sess = null;
    sid = new SessionID(request);
    sess = Session.getSession(sid);
    Profile profile = sess.getUserProfile();
    catch(Exception e)
    %>
    Exception Occured
    <%
    out.println(" Error Message "+e);
    When i try to access the JSP it is throwing the following exception.
    com.iplanet.portalserver.session.SessionException: Invalid service host name .
    What do i have to do to access the profile info of the user from the JSP.
    Any suggestion is welcome.
    Regards
    Giriraj

    you need to allow cookies through to your web server; the client component on the web server
    and try to determine your portal and its not
    being passed thru.

  • Error accessing my jsp page

    I have created a simple web application and using tomcat 5. when i try accessing my jsp page..it just gives an error message..HTTP Status 404...The requested resource (/carnhotel/date.jsp) is not available.
    however, it works fine when i deploy in default applications (servlet-examples, jsp-examples,root)...plz help..

    How are you deploying this web application? Just in the webapps >directory?iewebapps/carnhotel/date.jsp?i have deployed in the webapps directory with the same directory structure...and also WEB-INF/web.xml
    also, when i open tomcat admin console...click on host(localhost/context(/carnhotel))..displays an error ...
    HTTP Status 500 - Error retrieving attribute debug
    type Status report
    message Error retrieving attribute debug
    description The server encountered an internal error (Error retrieving attribute debug) that prevented it from fulfilling this request.
    thnx...
    .

  • Connecting Access Databse to BI Publisher

    Hi,
    Please anyone tell me, how to connect MS Access database to BI Publisher.
    There is no explicitly drivers defined in JDBC Connection, so what should I use in this case as DriverType & Connection String.
    Hoping for quick reply.
    Thanks in Advance.

    Hi Vestrini,
    Thanks for your reply, but only connection string is not enough, what about Driver type, Database Driver Class, username and password.
    Please, provide some detail step to connect access database to BI Publisher.
    Thanks.

  • Using JTA enabled connection in a JSP/servlet without transaction

    Can we use a JTA enabled connection in a JSP/servlet without any transaction?
    Thanks

    This might be helpful.
    http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/transactions/transactions6.html

  • Connection pooling in JSP

    how to maintain database connectivity in each jsp file without explicitly opening connection in each jsp file.

    Write one ConnectionManager Class and use that object in every JSP file.

  • Daniel or anyone else, Help on why I can't access certain jsp pages

    I have installed the Web Service Portlet Wizard to build my portlets. In particular,
    I have created a URL porlet jsp which receives its content from a URL.
    This URL that I retrive is an application that I have running on my Weblogic 6.1
    Server. I can access the login page, and can logon and do a few things but for
    some reason I Can't access certain pages. The pages I can't access are also jsp
    pages on the wlserver6.1 server(exactly the same as other ones I can access and
    interact with).
    The error I receive on the Portal Front end is attached in a word doc. I have
    also included in there, a snapshot of the access log for those pages, but I can't
    really make out what it is telling me (if anything!).
    For one of the pages, that I can't successfully access I get java.lang.ArrayIndexOutOfBoundsException
    This only happens with 1 of the pages. But trying to access the same page withouth
    going thru the portal I get NO errors what so ever.
    Please if anyone can give me any information on why I can't access certain pages
    via my portal It would be very helpful.
    Finally I have included the code of my Portlet which accesses the URL. This is
    also included in the word doc.
    Thanks
    Ramy
    [Portal.doc]

    Ramy,
    I don't know the Web Service Portlet Wizard too well, but I notice that
    login.htm never seems to be found (404 in logs). I would think that the two
    warnings below your JSP call (cookies, and portlet state) are your most
    likely culprits. If the Web Service Portlet Wizard does not handle cookies
    then the portal server will have to continiously reauthenticate. I will
    forward your email however and see if I can dig up a better diagnosis. Also,
    could you post the stack trace for the ArrayIndexOutOfBoundsException you
    are seeing.
    Sincerely,
    Daniel Selman
    "Ramy" <[email protected]> wrote in message
    news:[email protected]..
    >
    I have installed the Web Service Portlet Wizard to build my portlets. Inparticular,
    I have created a URL porlet jsp which receives its content from a URL.
    This URL that I retrive is an application that I have running on myWeblogic 6.1
    Server. I can access the login page, and can logon and do a few things butfor
    some reason I Can't access certain pages. The pages I can't access arealso jsp
    pages on the wlserver6.1 server(exactly the same as other ones I canaccess and
    interact with).
    The error I receive on the Portal Front end is attached in a word doc. Ihave
    also included in there, a snapshot of the access log for those pages, butI can't
    really make out what it is telling me (if anything!).
    For one of the pages, that I can't successfully access I getjava.lang.ArrayIndexOutOfBoundsException
    This only happens with 1 of the pages. But trying to access the same pagewithouth
    going thru the portal I get NO errors what so ever.
    Please if anyone can give me any information on why I can't access certainpages
    via my portal It would be very helpful.
    Finally I have included the code of my Portlet which accesses the URL.This is
    also included in the word doc.
    Thanks
    Ramy

  • How to connect access database through oracle sql prompt

    i want to connect access database via oracle , i am trying to import all the data in Access table into oracle table how it is possible .
    A.R

    The simplest way, if You have already created tables in Oracle DB, is to open the Access MDB, link Oracle tables via ODBC and build a query to append rows reading from Access tables to Oracle tables.
    Hope this helps
    Max

  • Accessing a JSP file via context URL

    Hi experts ,
    i have a requirement to access a jsp file via context url i.e. /irj/... abc.jsp , can  any one please suggest how to access this , i have a jsp dynpage component in the pagelet folder i have a jsp page, that im not able to access via the context url , and the images that are there in the image folder are accessible via context path i.e /irj/.. abc.gif etc.
    can any one please suggest a solution .
    Regards
    Govardan Raj

              Hi,
              1) what is your "weblogic.httpd.documentRoot=????"
              2) if it is "public_html" put your jsp there.
              Joe
              "Prasad" <[email protected]> wrote:
              >
              >hi all,
              >
              >i am working on weblogic5.1 under solaris platform.
              >
              >my folder hierarchy is as follows weblogic_home/classes/weblogic/sun1/sun2.
              >
              >i have an import statement as follows import sun1.sun2.* in my JSP file.
              >
              >when i access this jsp file from my browser i have an error.
              >
              >the error is import package sun1 not found.
              >
              >i have set my classpath correctly(i feel so)...
              >
              >can anybody help me with this problem.
              >
              >if there is some fault in my classpath please tell me where exactly i should set my classpath for jsp files.
              >
              >thanx in advance.
              >Prasad.
              

Maybe you are looking for

  • Error message not authorized for use with Adobe ID

    I just started getting this error message when I transfer EPub books to my KOBO. They are e-books from the public library. I am asked to sign in with the authorized Adobe ID, but I thought I had done that when I set up Adobe DE 3.0

  • How do I stop iTunes mapping to a deleted directory?

    When I open iTunes on my PC, every song title I have is duplicated - one maps correctly to the location of the song but the other maps to an old directory that has been deleted and no longer exists in the file structure. When I select the one with th

  • Document type for J1IV..?

    Hi all Can anybody explain me were to find the document type used for return delivery to vendor process. For taking print of return excise invoice , were the document type wehave to maintain.. Thanks sap-mm

  • Applescript flow disrupted in Mountain Lion

    Has anyone else had problems with AppleScript in Mountain Lion? I have a script with a repeat loop that looks through every sheet in a Numbers document to gather data from the pages.  Previously (in Lion and Snow Leopard) it zipped through the docume

  • Simple XML question

    org.xml.sax.SAXParseException: The markup in the document following the root element must be well-formed. at org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:235) at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:20