Jsp----microsoft access---image

Hi everyone,
I am trying to save an image in a Microsoft Access database, so i can make a query to that image using jsp, and display the image in the .jsp.
The problem is that I don't know what data type to declare in "access" when i am creating the table.
I have tried with OLE Object type, and it doesnt work;
I tried also with Text type, and doesnt work either.
what data type do i have to declare, and how should I save it in the database, so when i make the query from the .jsp the image will be displayed?
thanks...

Hi,
I did it like this:
<TD>
<img src="images/<%= recordset.getString(5)%>">
</TD>it worked correctly,
but,
I am having trouble getting all of the images from one column,
this is what i'm trying:
    ResultSet result = null;
    ResultSetMetaData rsmd = null;
   int columns=0;
     try {
       rsmd = result.getMetaData();
       columns = rsmd.getColumnCount();
<table width="60%" height="50%" border="1">
  <tr>
  <%
     try {
       for (int i=1; i<=1; i++) {
             out.write("<th>" + rsmd.getColumnLabel(i) + "</th>");
  %>
  </tr>
  <%
        while (result.next()) {
           out.write("<tr>");
           for (int i=1; i<=1; i++) {
             out.write("<td>" + result.getString(i) + "</td>");
           out.write("</tr>");
        }my problem is that I don't know how to insert the:
<img src="images/what can I do?

Similar Messages

  • JSP , Microsoft Access & Date/Time

    I am trying to write a program in which a database contains two tables pcorr & mscorr.
    result1 = stmt1.executeQuery("select pcorr.corrppo,mscorr.ppoprint from pensionr where pcorr.regimental = '" + icstr + " 'and (pcorr.status = 'P') and (mscorr.ppoprint>pcorr.dtreceipt)");
    In above, icstr is input from a Form and ppoprint & dtreceipt are date type.
    This is not reflecting true data on the screen. While same program in MS Access query, it is showing required a result.
    Please do suggest for date comparison in JSP

    datevalue(value)

  • Getting image from Microsoft Access database to display in browser

    Hey! anybody please help me
    I've been trying with no success to get an image from a microsoft access database
    so far this is what i have:
    package Servlets;
    import java.io.*;
    import java.net.*;
    import utils.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class serv extends HttpServlet {
        java.sql.ResultSet rs=null;
        ClsConexion conexion=new ClsConexion("Nedermex");
        protected void processRequest(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            conexion.conectate("1", "1");
            rs=conexion.obtenRegSelect("SELECT * FROM Flores WHERE ID=1");
            try{
                rs.next();
                System.out.println("sadfsadf " + rs.getString("ID"));
            }catch(Exception e){
                e.printStackTrace();
            String ubicGIF = request.getParameter("ubicGIF");
            if((ubicGIF==null) || ubicGIF.length() == 0 ){
                indicarError(response, "Archivo de imagen no establecido");
                return;
            //String archivo = getServletContext().getRealPath(ubicGIF);
            try{
                if(rs.next()){
                    System.out.println("sadfsadf " + rs.getString("ID"));
                    BufferedInputStream ingreso = new BufferedInputStream(rs.getBinaryStream("Imagen"));
                   // BufferedInputStream ingreso = new BufferedInputStream(new FileInputStream(getServletContext().getRealPath("1.jpg")));
                    ByteArrayOutputStream flujoBytes = new ByteArrayOutputStream(512);
                    int byteImagen;
                    while ((byteImagen= ingreso.read()) != -1){
                        flujoBytes.write(byteImagen);
                    ingreso.close();
                    String indiPersistencia = request.getParameter("usePersistence");
                    boolean usePersistence = ((indiPersistencia == null) || (!indiPersistencia.equals("no")));
                    response.setContentType("image/jpeg");
                    if(usePersistence){
                        response.setContentLength(flujoBytes.size());
                    flujoBytes.writeTo(response.getOutputStream());
            }catch(IOException ioe){
                indicarError(response, "Error: " + ioe);
            }catch(java.sql.SQLException sqle){
                indicarError(response, "Error: " + sqle);
        public void indicarError(HttpServletResponse response, String mensaje) throws IOException {
            response.sendError(response.SC_NOT_FOUND, mensaje);
        // <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
        /** Handles the HTTP <code>GET</code> method.
         * @param request servlet request
         * @param response servlet response
        protected void doGet(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            processRequest(request, response);
        /** Handles the HTTP <code>POST</code> method.
         * @param request servlet request
         * @param response servlet response
        protected void doPost(HttpServletRequest request, HttpServletResponse response)
        throws ServletException, IOException {
            processRequest(request, response);
        /** Returns a short description of the servlet.
        public String getServletInfo() {
            return "Short description";
        // </editor-fold>
    }i have a class Conexion wich controls the connection and resultsets
    As you can see, i tested accessing a jpeg file: 1.jpg with FileInputStream, and it works perfectly, but when i try to get an image from Microsoft Access using the resultset the way i did, the browser shows the following message
    The image �http://localhost:8084/Nedermex/serv� cannot be displayed, because it contains errors.
    My table in the database in Access is configured as following
    FieldName::::::::::::::DataType
    ID::::::::::::::::::::::::::::::Number
    Imagen::::::::::::::::::::OLE Object
    Now, when i insert an image in the Imagen field, i select the option "Create from file" and select the jpg file (the one that worked with the FileInputStream) and uncheck the Link option (to save the data in the db
    maybe there is something wrong with the sizes or something....
    please help me here!!!
    thank you!

    Yes it is an sql question
    Consider this as my condition need to fetch records collected in database on 16-4-2012 
    Table name =TEST_REPORT
    i have passed the following query
    Select Serial_Number,System_Date,System_Time,Department,O​perator_Name,Serial_Number,Test_Case,Pass_Fail from TEST_REPORT  where System_Date = 4-16-2012, it displays the entire record from database. i have my vi along with this mail.
    Attachments:
    Report Viewer.vi ‏24 KB

  • JSP and Access 2007 database

    i've been trying to look for codes on how to access the Access 2007 database (.accdb).
    i've done a previous JSP app with Access database, but it is of a lower version (.mdb).
    i need something like the following, but for the 2007 version. is it just a matter of changing the extension for both statements, or is there more to it?
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String DBQ = request.getRealPath("sales.mdb");
    String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=" + DBQ + ";DriverID=22;READONLY=true";thanks.

    <%@page import="java.sql.*" %>
    <table boder="1">
    <%
    Statement statement;
    Connection conn;
    String url = "jdbc:mysql://localhost/dbName";
    String user = "username";
    String pass = "password";
    try {
        class.forName("com.mysql.jdbc.Driver");
        conn = DriverManager.getConnection(url, user, pass);
        statement = conn.createStatement();
    String query = "SELECT images FROM database";
    ResultSet results = statement.executeQuery(query);
    while(results.next()) {
    %>
        <tr>
            <td><img src="<%= results.getString("images") %>"></td>
        </tr>
    <% } %>
    </table>The while loop will loop through your result set and print the table row for each image it finds in the query.
    Hope this helps,
    Jon

  • Can not Insert data to Microsoft Access successfully

    I am using Microsoft Access database, and trying to insert some data into a table with a "while" loop, but every time, the last row can not be inserted although the return value of the "executeUpdate()" is 1, can anyone tell what's wrong with that? thank you very much

    http://forums.java.sun.com/thread.jsp?forum=48&thread=147704
    Sounds like it may be the same "glitch"
    Jamie

  • How can I use Microsoft Access on my Mac?

    How can I use Microsoft Access on my Mac Pro?

    Welcome to Apple Support Communities
    Microsoft Access isn't available for OS X, so you can't use it. If you need it, you have to install Windows on a virtual machine.
    On a virtual machine, you can install the Windows version you most like and the Access version you need, so you won't have any problem using it. You just need a full Windows version with its DVD or ISO image and product key, and an application like Parallels, VMware Fusion or VirtualBox to create the virtual machine. If you want to save money, System Builder versions are cheaper and you can find them at Amazon or NewEgg.
    As you have a Mac Pro, I suppose you won't have any problem using a 64-bit version, but it's important you have enough memory. Open  > About this Mac, and check how much memory you have. I recommend 4 or 8 GB of memory at least.
    After installing Windows on the virtual machine, you will be able to install Access there.
    There are applications for OS X that allow you to run Windows applications without having to install Windows. Those apps often fail, so I don't recommend you to use them

  • A very strange problem encoutered in microsoft access

    Hi everyone,
    I have a access database set up and try to insert some record in it with JDBC, but some strange things happend. If I try to insert the string "client for update", it won't work, other string such as "client for", "client abc" ... will work. I really got a headache with this.
    I wish to thank an expert named "Mod", who give me an alternative solution which works perfectly. But I'm wondering why my code will not work. Here is my code:
    //Notes.mdb is my database
    //Test is my table
    //Subject is a field with Text type in Access 2000
    //Content is a field with Memo type in Access 2000
    import java.sql.*;
    public class MemoInsertTest{
    public static void main(String[] args){
    try{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection connection = DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=Notes.mdb");
    String sql = "INSERT INTO TEST(SUBJECT,CONTENT) VALUES('test8','client for update')";
    Statement statement = connection.createStatement();
    int rowCount = statement.executeUpdate(sql);
    System.out.println("# rows inserted " + rowCount);
    statement.close();
    connection.close();
    catch(Exception e){
    e.printStackTrace(System.err);
    Notes.mdb is my database which located at the current directory (the same directory of my java file above)
    After compile and run it, error information comes up:
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Optional feature
    not implemented
    at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcStatement.execute(Unknown Source)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeUpdate(Unknown Source)
    at MemoInsertTest.main(MemoInsertTest.java:9)
    If, instead, I change that string to "client for", this time it works, the result is printed out:
    # rows inserted 1
    I hope someone will explain this problem for me. Thank you all.
    With my best,
    Zike Huang(jim)

    This is a branch of a couple of existing threads:
    http://forum.java.sun.com/thread.jsp?forum=48&thread=447162&tstart=0&trange=15
    MOD

  • JSP with Access Database

    Could I use Access Database in JSP source code without Having DSN (DSN-less)
    I mean i do not want to set up a DSN in Control panel.
    I want only give JSP code a access database (.mdb)
    Please tell me the Connection String.
    Thank you

    try the following code:
    String url = System.getProperty("user.dir")+"\\db1.mdb";
    String conStr = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ="+url;
    try{
    System.out.println(conStr);
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = DriverManager.getConnection(conStr);
    JOptionPane.showMessageDialog(this,"connection created");
    }catch(Exception e){System.out.println("Error : "+e);}
    where db1.mdb is the database to be used in application
    find this code working let me ack. at [email protected]

  • Problems while accessing images outside the web document-root folder

    Our application runs on Oracle application server on Linux. Facing problems while accessing images outside the web document-root folder. This works with changes in global-web-application.xml by including the <virtual-directory> tag. The same change does not work when done on Linux machine. It is unable to find the image. Please help in resolving this issue.
    </locale-encoding-mapping>
    </locale-encoding-mapping-list>
    </web-app>
    <virtual-directory virtual-path="/img" real-path="/home/eposuat/" />
    </orion-web-app>
    Code in the jsp:
    <img width=700 height=700 src="/img/3.tif"></img>
    <img width=700 height=700 src="/img/WB.gif"></img>

    This is one of the least satisfactory aspects of site management in Dreamweaver, and several developers, including myself, have been pressuring the Dreamweaver team for some years to improve this. Who knows? They might eventually take notice.
    The only way to do this at the moment is to create two site definitions, one nested inside the other. Set up the site definition normally based on htdocs as your site root. Then create a new site definition based on site. Dreamweaver will nag you that it can cause problems, but it won't actually stop you from doing it. The only potential problem is with site synchronization.
    The problem with using site as the only basis for your site definition is that Dreamweaver automatically puts things like the Connections, Scripts, and other folders in the site root. So, everything ends up at the wrong level of the site hierarchy. Quite frankly, the whole thing is a bit of a pain. Dynamic site development was added to Dreamweaver only in version 6 (Dreamweaver MX), and no one had really thought through the need to store files outside the site root.

  • How to save a picture file into Microsoft Access Database?

    I want to save a picture file,such example.jpg file into a Microsoft Access Database in JSP,anybody know how to save picture file into Microsoft Access Database and read this picture file from Microsoft Access Database and then show this picture in a JSP page?
    Thanks in advance.

    Not posible in case of Microsoft Access ..
    You will hv to use oracle for that ....
    search for Blob / Clob

  • Non-technical user needs help with Microsoft Access/MS-Query connection

    I've read through some of the other threads on problems with the ODBC connection from MS Access to an Oracle database but as a non-techie I'm afraid I need to ask based on the steps I have always used. I'm not totally inexperienced as I have gone through the same steps on multiple Windows XP machine running different versions of Oracle and Office over the past 10 years but the steps aren't working this time. If there are settings that need to be checked or changed (path, etc.) I'm afraid I'll need specific instructions as to where I need to look for them.
    I'm currently trying to set up a connection on a new laptop running a 64-bit version of Windows 2007 Professional.
    1) I've installed a full 64 bit Oracle 11g client and 32 bit copy of Microsoft Office Professional Plus 2013.
    2) I set up the Oracle data source using the client Net Manager. I can connect from there.
    3) I added it in the Oracle-provided Microsoft ODBC Administrator and can connect from there.
    I the past, after doing this, the was automatically included in the list of ODBC Databases in MS Acess but this time it's not. I tried adding it as a new data source by selecting the Microsoft ODBC for Oracle driver but receive the same  "The Oracle(tm) client and networking components were not found" error message that has plagued so many others.

    This is bad code, for lots of reasons:
    (1) Scriptlet code like this should not be used. Learn JSTL and use its <sql> tags if you must.
    (2) This code belongs in a Java object that you can test outside of a JSP. JSPs are for display only. Let server-side objects do the database work for you.
    (3) You don't close any ResultSet, Statement, or Connection that I can see. Microsoft Access doesn't save any records until you close the Connection.
    (4) You don't have any transactional logic. When you write to a database, you usually want it to be a unit of work that is committed or rolled back together.
    %

  • Can't view Microsoft Access data

    Hello,
    I am trying to use a Microsoft Access database (97) as a data source for my repository. I can import it in the Administration Tool and see all the tables. When I finish my repository the global consistency is without errors.
    Then I go to the Answers and make a table, here I see the repository but when I try to view the results it returns only values from the other data source.
    I am using OBIEE 10.1.3.3.2
    Anyone got a suggestion?
    Rgds,
    Dennis de Kock

    I cannot see data at column level either.
    Perhaps there still is a (logical) problem in your logical model.
    I suggest to quickly create a new business model, just for testing. Drag and drop 1 table from your access source twice to the business model. Create a complex join between table and table#. Put an aggregate on one number field in table#. Drag/drop business model to presentation layer.
    Have a look if you now have data from this table in Answers.
    Regards

  • How do I open a pdf stored in a Microsoft Access database using Visual Basic studios 2012

    Currently I am unable to find a valid method of being able to open a pdf stored in a Microsoft Access database using Visual Basic studios 2012. I've tried displaying the entire database on a form, but when I do this all the other columns show up with
    the correct data besides the one containing the pdf's, it just displays <binary data> in each row down the column. I also tried another method with which you use the database as a dataset and can drag and drop the rows and columns into the form, which
    again works for all the other columns besides the one containing the pdf's but this time I'm unable to interact with the column  at all. 
    Not too sure if this is in the correct place, but any answers or help would be appreciated. Cheers.

    Alex,
    This forum is dedicated to Project and Project Server. You might get better response, if you post to a Visual Basic forum. Here are couple I could find. 
    https://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=vbgeneral%2Cvblanguage&filter=alltypes&sort=lastpostdesc
    Cheers,
    Prasanna Adavi, Project MVP
    Blog:
      Podcast:
       Twitter:   
    LinkedIn:
      

  • The Microsoft Access database engine cannot open or write to the file in Report Builder 3.0

    I am trying to build a report in Report Builder 3.0.  I created the Data Source to point to my Excel file and the Data Set.  I drag a couple of fields on to the canvas and then choose Run.  I get the error:  "The Microsoft Access
    database engine cannot open or write to the file.  It is already opened exclusively by another user".  I am using the Excel driver.  Why am I getting this message?  How can I fix this?

    No, now I am getting the error message again.  It is quite long:
    ERROR [HY000] [Microsoft][ODBC Excel Driver] The Microsoft Access database engine cannot open or write to the file '(unknown)'. It is already opened exclusively by another user, or you need permission to view and write its data.
    ERROR [01S00] [Microsoft][ODBC Excel Driver]Invalid connection string attribute Trusted_Connection
    Please help

  • How do I open a Crystal Report from Microsoft Access?

    I'm looking for step-by-step instructions on how to launch a Crystal Report from a Microsoft Access application (for a dummy like me).
    My Crystal Report uses a connection to the Access database as the data.
    I have Microsoft Access 2002 with Microsoft Visual Basic 6.5.
    I have Crystal Reports 2008 CR Developer 12.
    I'll need to know where to find the Visual Basic code references, and/or ActiveX Controls, if applicable.
    Thanks
    Janeen

    I concur with Don. Just a bit of help - a sample VBA app is here;
    https://smpdl.sap-ag.de/~sapidp/012002523100006013432008E/rdc_vba.exe
    But as Don mentioned, you will have to downgrade to CR XI r2 (or lower) to implement the above solution.
    Ludek

Maybe you are looking for

  • Why is someone elses machine connected to mine via bluetooth?

    Hello, I'm here to report strange bluetooth behaviour on my personal/work computer.  It's a late 2012 Macbook Pro Retina 15" that's running Yosemite. Occasionally, when I try to remedy the constant bluetooth connection dropping issues that I have, I

  • ASA5585 - which rack mount?

    Sadly dissappointed in the documentation...   I would think that one of these parts would be the rack kit used when eliminating the slide rails to fit the 5585 in a narrow rack as described in the hardware installation guide ( http://www.cisco.com/c/

  • Installed Reader XI on a Win7 desktop 10 hours ago, accepted Eula, previously permitted 3rd pty brwsr exts, cant enter 1st ltr in 4m

    The form would not let me fill it out with Reader 9 so I installed Reader XI  on my desktop running Windows 7.  I had previously enabled 3rd party browser extensions, yet Reader XI froze up and I had to use Task manager to return to civilization. The

  • Problems downloading CS5 on new laptop

    After buying a new laptop, an Apple support person helped me migrate all files from old MacBook Pro including CS5.  However, these Adobe files are corrupted and when trying to open Photoshop, I got this message: "Some of the application components ar

  • Rounding in Invoice

    How to add "Rounding" field in the invoice? In US Demo I have this field and I want to define it in Canadian company thanks, Olga