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]

Similar Messages

  • Upload file in JSP with Oracle Database 10gR2

    How to upload file with oracle database 10gR2??
    i can't find how to upload..
    i've tried to create a procedure in oracle and execute in netbeans but the file save in directory and then from directory save to database.
    it means the file save in 2 location, in directory and database..
    does anybody know how to save file direct from the JSP file into database without save in directory?
    this is the procedure..
    create or replace PROCEDURE load_file (
    p_id number,
    p_photo_name in varchar2) IS
    src_file BFILE;
    dst_file BLOB;
    lgh_file BINARY_INTEGER;
    BEGIN
    src_file := bfilename('DIR_TEMP', p_photo_name);
    -- insert a NULL record to lock
    INSERT INTO temp_photo
    *(id, photo_name, photo)*
    VALUES
    *(p_id , p_photo_name ,EMPTY_BLOB())*
    RETURNING photo INTO dst_file;
    -- lock record
    SELECT photo
    INTO dst_file
    FROM temp_photo
    WHERE id = p_id
    AND photo_name = p_photo_name
    FOR UPDATE;
    -- open the file
    dbms_lob.fileopen(src_file, dbms_lob.file_readonly);
    -- determine length
    lgh_file := dbms_lob.getlength(src_file);
    -- read the file
    dbms_lob.loadfromfile(dst_file, src_file, lgh_file);
    -- update the blob field
    UPDATE temp_photo
    SET photo = dst_file
    WHERE id = p_id
    AND photo_name = p_photo_name;
    -- close file
    dbms_lob.fileclose(src_file);
    END load_file;

    Well your Oracle procedure is designed to load a file, so that's what it does. If you want it to load from a data stream such as an upload, you need to rewrite it accordingly.
    So far this is not a Java question at all.

  • Trouble with access database online

    Hello everyone,
    I created an applet that simply inserts data into an access database and then prints it out on the screen the sql insert statement.
    I signed the applet so I can trust it so I wont get any security errors.
    When I upload it to the site it shows the correct insert statement because the primary key auto increments and displays on the screen. I don't get any SQLException errors or SecurityException errors so I assume it is working.
    When I download my database and look at it I dont see the data inserted into it. But when I see it in my browser it displays the insert statement with the primary key so I am really confused.
    I tried in internet explorer and firefox and made sure I cleared my cache. Is there any possible thing that I missed as to why it gets the auto-increment primary key and doesnt get caught in the try catch but when I look at the database I don't see anything.
    Any help would be great.
    Thanks

    Thanks for the advice but this does not really help
    my situation.
    Well it does in that it is not "advice" it is a statement of fact and so it does help you in that you shouldn't waste time pursuing that.
    The reason is, as you are already seeing, that when you update the Access database in your applet you are only actually updating the local copy (downloaded by the Applet) not the copy of the file on the server. So you can make all the changes you want but won't see them.
    I could send data through a url and then program an
    asp page to handle the database stuff.Yes that would be a better way all around.
    >
    If you cant help me with doing the sql in the appletIt's not that I can't help you. It's that is impossible. If you chose another database that was a server it would be possible.
    I mean I can help but I cannot do the impossible.
    can you help me on sending data through a url in a
    java applet.
    Yes. Use the HttpURLConnection class to do what you want. You can send it by GET (aka ASP Request.QueryString) or by POST (aka ASP Request.Form).
    This tutorial shows you how http://java.sun.com/docs/books/tutorial/networking/urls/index.html

  • Insurance / medical devices data with Access database

    I have to find managing solution for 2 Israeli companies which need customer relationship relations and projects solution like Oracle RDBMS - plus for specialized data comes from a professional applications (one for insurance and other for medical devices data).
    If ORACLE will manage all business data it will be well, but additionally ORACLE will have to manage Access DB comes from the software for insurance from company named IDIT, and other medical devices data from medical solutions from "Hadasit" (Hadassah Hospital and "Hebrew University")
    Oracle RDBMS would handle well the Access database?

    Hi Saurabh,
    While posting a query, make sure that you provide all required info. i.e. CR version with SP level, VS version etc.
    providing detailed environmment info would help you get faster responses.
    - Bhushan
    Senior Engineer
    SAP Active Global Support
    Follow us on Twitter
    Got Enhancement ideas? Try the SAP Idea Place
    Getting started and moving ahead with Crystal Reports .NET applications.

  • Problem with accessing database

    Hi everybody
    I try to execute some wars included with the J2EE tutorial final version
    and I follow all the steps in building and deploying the
    specified wars, some of those wars is a punch of JSP pages and
    Servlet that make access to database.
    When I execute any war using the admin console at Sun application
    Server 8.2 PE. I have got the message in all the JSP pages
    That requires access to database.
    Your request cannot be completed. The server got the following error:
    "" javax.servlet.jsp.JspTagException: Error getting connection:
    "java.sql.SQLException: No suitable driver" :
    java.sql.SQLException: No suitable driver ""
    Am already starting the derby database server .
    I don�t know what the reason for that bug is.
    Please help �
    Best regards

    Hi everybody
    I try to execute some wars included with the J2EE
    tutorial final version
    and I follow all the steps in building and deploying
    the
    specified wars, some of those wars is a punch of JSP
    pages and
    Servlet that make access to database.
    When I execute any war using the admin console at Sun
    application
    Server 8.2 PE. I have got the message in all the JSP
    pages
    That requires access to database.
    Your request cannot be completed. The server got
    the following error:
    "" javax.servlet.jsp.JspTagException: Error getting
    connection:
    "java.sql.SQLException: No suitable driver" :
    java.sql.SQLException: No suitable driver ""
    Am already starting the derby database server .
    I don�t know what the reason for that bug is.
    Please help �
    Best regardsI suppose you've deployed the applications.
    Can you check to see in the admin console if the resources and connection pools also have been defined?
    Are the connection pools (database -- derby) reachable?
    Can you ping the database through the connection pool?
    Thanks,
    Kedar

  • Problem with accessing database in minisap 4.6 d( very urgent need ur help)

    hi all sap masters please help me.
    i have installed the minisap 4.6d system in the windows 200 prof os.
    i had the following problem in my minisa access.
    while Displaying table contents with transactions SE11 or SE16
    gives an error "No changes on SAP objects allowed".
    while Accessing the logical database F1S gives a syntax error because the
    include DBF1SF01 is missing.
    so i have used the mbspatch1 that comes with the cd.
    i have copied the mbscorr0104200 file in the directory '<MBS_DIR>\trans\tmp' as mentioned.
    and i have followed the steps as follows.but i have the same problem.please have a look at the
    process below and hel me to make it work roerly.
    this roblem is really eating me a lot and since many in this forum are sap master,thought
    you all can help me please.
    C:\>cd mbs
    C:\MBS>dbenv.cmd
    C:\MBS>REM Setting environment for db connect to MBS
    C:\MBS>set dbms_type=mss
    C:\MBS>set DIR_LIBRARY=.
    C:\MBS>set MSSQL_DBNAME=MBS
    C:\MBS>cd trans\tmp
    C:\MBS\TRANS\TMP>r3trans -i mbscorr01042000
    'R3TRANS' is not recognized as an internal or external command,
    operable program or batch file.
    hope there was some problem here only,but to continue i have pasted the r3trans in the folder C:\MBS\TRANS\TMP
    C:\MBS\TRANS\TMP>r3trans -i mbscorr01042000
    This is R3TRANS version 6.05 (release 46D - 04.10.00 - 09:16:00).
    2EETW169 no connect possible: "connect failed with DBLI_RC_LOAD_LIB_FAILED."
    R3TRANS finished (0012).
    then i have done the generate program step .
    (4) Generate programs:
         - Logon as user BCUSER to the MBS system.
         - Start transaction SE38.
         - Enter the program 'SAPLSTRD' and select 'Program -> Generate'.
         - Enter the program 'SAPDBF1S' and select 'Program -> Generate'.
    while generating the second program i got the error Accessing the logical database F1S gives a
    syntax error because the include DBF1SF01 is missing.
    hope somebody could have got the same problem.so please help me with your experience.iam new to this
    minisap problems.
    again all the problem of acessing the tables exit even after doing the steps.
    hope i have explained my problem very clearly.
    please find where i went wrong or suggest some help to acess the datadase tables with the minisap cd.

    all webas downloads (ABAP, java)
    https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/cfc19866-0401-0010-35b2-dc8158247fb6
    webas 6.40 ABAP server
    https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/webcontent/uuid/b2918eea-0601-0010-6284-e6cb7eee4399 [original link is broken]
    SAP gui
    https://www.sdn.sap.com/irj/sdn/softwaredownload?download=ftp://ftp.sap.com/pub/sdn/devkits/netweaver/abap/50072743_4.zip&df=0
    Regards
    Raja

  • JSP with mysql database

    *********************This is my HTML form for Media search*****************
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Strict//EN">
    <html>
    <head>
    <meta content="text/html; charset=ISO-8859-1"
    http-equiv="content-type">
    <title>search media form</title>
    </head>
    <body>
    <form name="search" action="med_search.jsp"> <big
    style="font-weight: bold; color: rgb(0, 102, 0);">Media
    : Search<br>
    </big>
    <hr
    style="height: 1px; width: 50%; margin-left: 0px; margin-right: auto;"><label>Media
    :   equals :</label><big
    style="font-weight: bold; color: rgb(0, 102, 0);">  
    <select size="1" name="msearch_name">
    <option>-All-</option>
    <option>100% Home Girls</option>
    <option>1800mumanddad</option>
    <option>2D Max</option>
    <option>Access all areas</option>
    <option>Adelaide Advertiser</option>
    <option>Adelaide Messenger</option>
    <option>Adelaide Sunday Mail TV guide</option>
    <option>All Media</option>
    <option>Ari Reserved</option>
    <option>Austar</option>
    <option>Blockbuster</option>
    <option>Brisbane Courier Mail</option>
    <option>Brisbane Quest</option>
    <option>Brisbane Sunday Mail- TV guide</option>
    <option>Cleo</option>
    <option>Community</option>
    <option>Cosmo</option>
    <option>Day Time TV</option>
    <option>Dolly</option>
    <option>Edge</option>
    <option>Empire</option>
    <option>EMS</option>
    <option>Explode</option>
    <option>Facing Sanity</option>
    <option>Fairfax</option>
    <option>FHM</option>
    <option>Foxtel</option>
    <option>Funkysexycool</option>
    <option>Gametel newsletter</option>
    <option>Gametel Sim Pack</option>
    <option>Gametel UI 1st Version</option>
    <option>Gametel UI 2nd Version</option>
    <option>Gametel Website</option>
    <option>Geelong Advertiser-TV guide</option>
    <option>Girlfriend</option>
    <option>Good Medicine</option>
    <option>Herald Sun</option>
    <option>Home Girls</option>
    <option>Insight</option>
    <option>MailBlast</option>
    <option>Maximum Performance</option>
    <option>Melboume Leader</option>
    <option>Mobile</option>
    <option>Mobile Pet-Ari</option>
    <option>Money Saver</option>
    <option>Motor Show Mag</option>
    <option>Mr.Wisdoms Whopper</option>
    <option>MTV</option>
    <option>Music Australia</option>
    <option>New Chat</option>
    <option>New Idea</option>
    <option>NW Magazine</option>
    <option>One Love</option>
    <option>Optus</option>
    <option>Penthouse</option>
    <option>People</option>
    <option>Picture</option>
    <option>Picture Premium Edition</option>
    <option>Picture Premium Special</option>
    <option>Platinum Girls</option>
    <option>Phychic Business Cards</option>
    <option>Phychic Calender</option>
    <option>Phychic CD Cover</option>
    <option>Ralph</option>
    <option>Sain Magazine</option>
    <option>Sanity Chart</option>
    <option>Series 40 gametel subscriber</option>
    <option>Series 60 gametel community</option>
    <option>Series 60 gametel non-subscriber</option>
    <option>Series40 non-subscriber</option>
    <option>Smash Hits</option>
    <option>SMS Chat</option>
    <option>Soap World</option>
    <option>SPAM</option>
    <option>STM-WA</option>
    <option>Stupid People Line</option>
    <option>Sunday Herald Sun TV guide</option>
    <option>Sunday Telegraph TV guide</option>
    <option>Sunday Times TV guide</option>
    <option>Sydney Cumberland</option>
    <option>Sydney Daily telegraph</option>
    <option>Take 5</option>
    <option>Tasmania TV guide</option>
    <option>That's Life</option>
    <option>Total Gamer</option>
    <option>TV 10</option>
    <option>TV 7</option>
    <option>TV 9</option>
    <option>TV Hits</option>
    <option>TV Soap</option>
    <option>TV Week</option>
    <option>UNASSIGNED</option>
    <option>Urban Hits</option>
    <option>VH1</option>
    <option>Video Ezy</option>
    <option>Vogue Girl</option>
    <option>WAP</option>
    <option>Web Competitions</option>
    <option>Website</option>
    <option>West Magazine</option>
    <option>Western Australian</option>
    <option>What DVD</option>
    <option>What's Hot on Video</option>
    <option>Witchcraft</option>
    <option>Women's Day</option>
    <option>xxx</option>
    </select>
    <br>
    <span style="font-weight: bold;"><span
    style="color: rgb(0, 102, 0);"><span
    style="font-weight: bold;"><span
    style="font-weight: bold;"></span></span></span></span></big><big
    style="font-weight: bold; color: rgb(0, 102, 0);">  
          </big><big
    style="color: rgb(0, 102, 0);"><small><label
    style="color: rgb(0, 0, 0);">or
    is like :</label></small></big><big
    style="font-weight: bold; color: rgb(0, 102, 0);">  
    <textarea cols="20" rows="1" name="msearch_like"></textarea><br>
         </big><label
    style="color: rgb(0, 0, 0);">Media Type
    :</label><big style="font-weight: bold; color: rgb(0, 102, 0);">
    <select size="1" name="msearch_type">
    <option>-All-</option>
    <option>magazine</option>
    <option>newspaper</option>
    <option>other</option>
    <option>tv</option>
    <option>tv guide</option>
    </select>
    <br>
    <br>
    </big> <input name="med_search" value="Search"
    type="submit">  <input name="med_reset"
    value="Reset" type="reset"></form>
    <br>
    <br>
    </body>
    </html>
    //After clicking search button it will go to this jsp and gets the searched records.
    ***********************************med_search.jsp***********************
    <html>
    <body>
    <h1>Search Media</h1>
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%--
    The taglib directive below imports the JSTL library. If you uncomment it,
    you must also add the JSTL library to the project. The Add Library... action
    on Libraries node in Projects view can be used to add the JSTL 1.1 library.
    --%>
    <%--
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    --%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <%@ page import="java.sql.*" %>
    <% Connection con=null;%>
    <% PreparedStatement pstmt=null;%>
    <%
    try
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    con = DriverManager.getConnection("jdbc:mysql://silverbullet:3306/elmophish", "sirisha", "gametel123");
    out.println("<table border=0>");
    if(request.getParameter("msearch_name").equals("-All-")&request.getParameter("msearch_type").equals("-All-"))
    %>
    <jsp:forward page="med_search.html"/>
    <%
    else if(!(request.getParameter("msearch_name").equals("-All-"))&!(request.getParameter("msearch_type").equals("-All-")))
    pstmt=con.prepareStatement("select media.media_name,media.media_code,media_types.media_type,media_genders.media_gender,media.target_age,publishers.publisher,media.is_bookable,media_id from media,media_types,media_genders,publishers where media_name in (select media_name from media where media_type_id in (select media_type_id from media_types where media_type=" + "'" + request.getParameter("msearch_type") + "'" +") and media.media_name =" + "'" + request.getParameter("msearch_name") +"'" + ")and media.media_type_id=media_types.media_type_id and media.target_gender_id=media_genders.media_gender_id and media.publisher_id=publishers.publisher_id");
    out.println("<th></th><th><b>Name</b>&nbsp</th><th><b>Code</b>&nbsp</th><th><b>Type</b>&nbsp</th><th><b>Gender</b>&nbsp</th><th><b>Age</b>&nbsp</th><th><b>Publisher</b>&nbsp</th><th><b>Active</b>&nbsp</th>");
    else if(!(request.getParameter("msearch_name").equals("-All-"))&&(request.getParameter("msearch_type").equals("-All-")))
    pstmt=con.prepareStatement("select media_name,media_code,media_type,media_gender,target_age,publisher,is_bookable,media_id from media me inner join media_types mt on me.media_type_id = mt.media_type_id inner join media_genders mg on mg.media_gender_id = me.target_gender_id inner join publishers pub on pub.publisher_id = me.publisher_id where media_name="+"'"+request.getParameter("msearch_name")+"'"+"") ;
    out.println("<th></th><th><b>Name</b>&nbsp</th><th><b>Code</b>&nbsp</th><th><b>Type</b>&nbsp</th><th><b>Gender</b>&nbsp</th><th><b>Age</b>&nbsp</th><th><b>Publisher</b>&nbsp</th><th><b>Active</b>&nbsp</th>");
    else if(request.getParameter("msearch_name").equals("-All-")&!(request.getParameter("msearch_type").equals("-All-")))
    pstmt=con.prepareStatement("select media_name,media_code,media_type,media_gender,target_age,publisher,is_bookable,media_id from media me inner join media_types mt on me.media_type_id = mt.media_type_id inner join media_genders mg on mg.media_gender_id = me.target_gender_id left join publishers pub on pub.publisher_id = me.publisher_id where media_type=" + "'"+request.getParameter("msearch_type")+"'"+"");
    out.println("<th></th><th><b>Name</b>&nbsp</th><th><b>Code</b>&nbsp</th><th><b>Type</b>&nbsp</th><th><b>Gender</b>&nbsp</th><th><b>Age</b>&nbsp</th><th><b>Publisher</b>&nbsp</th><th><b>Active</b>&nbsp</th>");
    ResultSet rst=pstmt.executeQuery();
    ResultSetMetaData rsmd=rst.getMetaData();
    int n=rsmd.getColumnCount();
    while(rst.next())
    out.println("<tr>");
    %>
    <td><form action="test.jsp" method="post"> <a href="t.jsp?media_id=<% out.print(rst.getString(8)); %>">Edit</a></form></td>
    <%
    out.print("<td>"+rst.getString(1)+"</td>");
    out.print("<td>"+rst.getString(2)+"</td>");
    out.print("<td>"+rst.getString(3)+"</td>");
    out.print("<td>"+rst.getString(4)+"</td>");
    out.print("<td>"+rst.getString(5)+"</td>");
    out.print("<td>"+rst.getString(6)+"</td>");
    out.print("<td>"+rst.getString(7)+"</td>");
    out.print("</tr>");
    }catch(Exception e)
    out.println(e);
    finally
    con.close();
    %>
    <%--
    This example uses JSTL, uncomment the taglib directive above.
    To test, display the page like this: index.jsp?sayHello=true&name=Murphy
    --%>
    <%--
    <c:if test="${param.sayHello}">
    <!-- Let's welcome the user ${param.name} -->
    Hello ${param.name}!
    </c:if>
    --%>
    </body>
    </html>
    //In this search output we have edit button for each row.After we click search it will enter into another form where we can edit the record.
    //In this jsp,i have designed the form for editing and displayed the current record values as initial values and after edit it must save and update the DB.But before I click save changes,its updating the DB with all zeros.
    ******************edit_search.jsp**************************************
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%--
    The taglib directive below imports the JSTL library. If you uncomment it,
    you must also add the JSTL library to the project. The Add Library... action
    on Libraries node in Projects view can be used to add the JSTL 1.1 library.
    --%>
    <%--
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    --%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <h1>Edit Search</h1>
    </head>
    <body>
    <%@ page import="java.sql.*" %>
    <% Connection con=null;%>
    <% String str1,str2,str3,str4,str5,str6;%>
    <%
    try
    int mgid=0;
    int tage=0;
    int pid=0;
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    con = DriverManager.getConnection("jdbc:mysql://silverbullet:3306/elmophish", "sirisha", "gametel123");
    PreparedStatement pstmt=con.prepareStatement("SELECT media_name,media_code,media_type,media_gender,target_age,publisher,is_bookable FROM media m INNER JOIN media_types met ON m.media_type_id = met.media_type_id INNER JOIN media_genders meg ON m.target_gender_id = meg.media_gender_id LEFT JOIN publishers pubs ON m.publisher_id = pubs.publisher_id where media_id=" + "'"+request.getParameter("media_id")+"'");
    ResultSet rs=pstmt.executeQuery();
    ResultSetMetaData rsmd=rs.getMetaData();
    int n=rsmd.getColumnCount();
    while(rs.next())
    %>
    <form method="post" action="">
    <label>Name</label> <%=rs.getString("media_name")%><br>
    <label>Code</label> <textarea cols="20" rows="1"name="med_code"><%=rs.getString("media_code")%></textarea><br>
    <label>Type</label> <%=rs.getString("media_type")%><br>
    <label>Target Gender</label>&nbsp
    <% PreparedStatement pstmt2=con.prepareStatement("SELECT media_gender FROM media_genders");
    ResultSet rst1=pstmt2.executeQuery();
    ResultSetMetaData rstmd2=rst1.getMetaData();
    int cnt1=rstmd2.getColumnCount();
    %>
    <select name="tar_gen">
    <%
    while(rst1.next())
    %>
    <option><%=rst1.getString("media_gender")+"<br>"%></option>
    <%
    %>
    </select><br>
    <label>Target Age</label> <textarea cols="20" rows="1" name="med_age"><%=rs.getString("target_age")%></textarea><br>
    <label>Publisher</label> 
    <%
    PreparedStatement pstmt1=con.prepareStatement("SELECT publisher FROM publishers");
    rst1=pstmt1.executeQuery();
    ResultSetMetaData rstmd1=rst1.getMetaData();
    int cnt2=rstmd1.getColumnCount();
    %>
    <select name="pub">
    <%
    while(rst1.next())
    %>
    <option><%=rst1.getString("publisher")+"<br>"%></option>
    <%
    %>
    </select><br>
    <label>Bookable</label> 
    <input type="checkbox">
    <%
    if (rs.getString("is_bookable").equals("1"))
    %>
    <checkbox maxlength="20" <checked></checkbox>
    <%
    else
    %>
    <checkbox maxlength="20" <unchecked></checkbox>
    <%
    %>
    <%
    str1=request.getParameter("med_code");
    PreparedStatement pst2=con.prepareStatement("select media_gender_id from media_genders where media_gender = "+ "'" + request.getParameter("med_gen") +"'");
    ResultSet rst2=pst2.executeQuery();
    while(rst2.next())
    mgid=rst2.getInt(1);
    rst2.close();
    str2=request.getParameter("med_gen");
    try
    tage=Integer.parseInt("'"+request.getParameter("med_age")+"'");
    catch(NumberFormatException e){}
    PreparedStatement pst3=con.prepareStatement("select publisher_id from publishers where publisher = "+ "'" + request.getParameter("pub")+"'");
    ResultSet rst3=pst3.executeQuery();
    ResultSetMetaData rsmd3=rst3.getMetaData();
    int nnn=rsmd3.getColumnCount();
    while(rst3.next())
    pid=rst3.getInt(1);
    rst3.close();
    //str4=request.getParameter("pub");
    try
    if(request.getParameter("bookable").equals("true"))
    str5="1";
    }catch(Exception e)
    str5="0";
    //str5=request.getParameter("bookable"");
    %><input name="med_edit" value="Save Changes" type="submit"><br></form>
    <%
    //out.println("<h2>2"+str1+"</h2>");
    PreparedStatement pstmt3=con.prepareStatement("UPDATE media set media_code="+str1+",target_gender_id="+mgid+",target_age="+tage+",publisher_id="+pid+" WHERE media_id="+"'"+request.getParameter("media_id")+"'");
    pstmt3.executeUpdate();
    //ResultSet res=.updateRow();
    //out.println("<h2>3"+str1+"</h2>");
    }catch(Exception e)
    out.println(e);
    finally
    con.close();
    %>
    <%--
    This example uses JSTL, uncomment the taglib directive above.
    To test, display the page like this: index.jsp?sayHello=true&name=Murphy
    --%>
    <%--
    <c:if test="${param.sayHello}">
    <!-- Let's welcome the user ${param.name} -->
    Hello ${param.name}!
    </c:if>
    --%>
    </body>
    </html>
    //This is another jsp which i replaced for edit_search.jsp.Functionality is same.And also giving the same result.But this is some what clear than edit_search.jsp.
    ****************************test.jsp******************************
    <%@page contentType="text/html"%>
    <%@page pageEncoding="UTF-8"%>
    <%--
    The taglib directive below imports the JSTL library. If you uncomment it,
    you must also add the JSTL library to the project. The Add Library... action
    on Libraries node in Projects view can be used to add the JSTL 1.1 library.
    --%>
    <%--
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    --%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>JSP Page</title>
    </head>
    <body>
    <%@ page import="java.sql.*" %>
    <% Connection con=null;%>
    <% String str1=null;
    String str2=null;
    String str3=null;
    String mgid=null;
    String tage=null;
    String pid=null;
    %>
    <%
    try
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    con = DriverManager.getConnection("jdbc:mysql://silverbullet:3306/elmophish", "sirisha", "gametel123");
    PreparedStatement pstmt=con.prepareStatement("SELECT media_name,media_code,media_type,media_gender,target_age,publisher,is_bookable FROM media m INNER JOIN media_types met ON m.media_type_id = met.media_type_id INNER JOIN media_genders meg ON m.target_gender_id = meg.media_gender_id LEFT JOIN publishers pubs ON m.publisher_id = pubs.publisher_id where media_id=" + "'"+request.getParameter("media_id")+"'");
    ResultSet rs=pstmt.executeQuery();
    while(rs.next()){
    %>
    <form method="post" action="">
    <label>Name</label> <%=rs.getString("media_name")%><br>
    <label>Code</label> <textarea cols="20" rows="1"name="med_code"><%=rs.getString("media_code")%></textarea><br>
    <label>Type</label> <%=rs.getString("media_type")%><br>
    <label>Target Gender</label>&nbsp
    <% PreparedStatement pstmt1=con.prepareStatement("SELECT media_gender FROM media_genders");
    ResultSet rst1=pstmt1.executeQuery();
    %>
    <select name="tar_gen">
    <%
    while(rst1.next())
    %>
    <option><%=rst1.getString("media_gender")%></option>
    <%
    %>
    </select><br>
    <label>Target Age</label> <textarea cols="20" rows="1" name="med_age"><%=rs.getString("target_age")%></textarea><br>
    <label>Publisher</label> 
    <%
    PreparedStatement pstmt2=con.prepareStatement("SELECT publisher FROM publishers");
    ResultSet rst2=pstmt2.executeQuery();
    %>
    <select name="pub">
    <%
    while(rst2.next())
    %>
    <option><%=rst2.getString("publisher")%></option>
    <%
    %>
    </select><br>
    <label>Bookable</label> 
    <input type="checkbox">
    <%
    if (rs.getString("is_bookable").equals("1"))
    %>
    <checkbox maxlength="20" <checked></checkbox>
    <%
    else
    %>
    <checkbox maxlength="20" <unchecked></checkbox>
    <%
    str1=request.getParameter("med_code");
    PreparedStatement pstmt3=con.prepareStatement("select media_gender_id from media_genders where media_gender = "+ "'" + request.getParameter("med_gen") +"'");
    ResultSet rst3=pstmt3.executeQuery();
    while(rst3.next()){
    mgid=rst3.getString("media_gender_id");
    rst3.close();
    try
    tage=request.getParameter("med_age");
    catch(NumberFormatException e){}
    PreparedStatement pstmt4=con.prepareStatement("select publisher_id from publishers where publisher = "+ "'" + request.getParameter("pub")+"'");
    ResultSet rst4=pstmt4.executeQuery();
    while(rst4.next()){
    pid=rst4.getString("publisher_id");
    rst4.close();
    try
    if(request.getParameter("bookable").equals("true"))
    str3="1";
    catch(Exception e)
    str3="0";
    %>
    <input type="submit" value="Save Changes"><br></form>
    <%
    PreparedStatement pstmt5=con.prepareStatement("UPDATE media set media_code="+str1+",target_gender_id="+mgid+",target_age="+tage+",publisher_id="+pid+",is_Bookable="+str3+" WHERE media_id="+"'"+request.getParameter("media_id")+"'");
    pstmt5.executeUpdate();
    out.println("123"+"media_code"+str1+" gender"+mgid+"....age.."+tage+"publisher_id="+pid+" is_Bookable="+str3);
    catch(Exception e)
    out.println("ttttttttttt");
    out.println(e);
    finally
    con.close();
    %>
    <%--
    This example uses JSTL, uncomment the taglib directive above.
    To test, display the page like this: index.jsp?sayHello=true&name=Murphy
    --%>
    <%--
    <c:if test="${param.sayHello}">
    <!-- Let's welcome the user ${param.name} -->
    Hello ${param.name}!
    </c:if>
    --%>
    </body>
    </html>
    *********************************************************************

    I want to know or How to connect Mysql
    with JSP or JSF any other software isavailable?
    please help me.....First you need to find 25 m of a CatV cable and...The DB files need to be located on the ninth device of a SCSI Daisy Chain with the total SCSI cable length being over 150 m (and the devices (and cables) need to be mix of Differential and Non-Differential).
    Edit: And forget the terminator, who needs it?

  • Report with Access Database or TXT file

    Dear All,
    I was wondering if someone can help me with the following issue.
    We have created a Crystal Reports XI report which has a Access MDB or Plain Text file as source data (2 different reports; one with MDB connection only and the other one with a Lotus Notes ODBC connection and TXT file).
    The report runs correctly locally and it also runs correctly on the server but as soon as I post the report via the repository folder to the server, it does not work anymore.
    Viewing the report via InfoView gives me a password request while both, the MDB and TXT file are not password protected.
    We have tried to make system DSN and file DSN connections to both the MDB and TXT file but also this ends with a password request which is not defined.
    Did anyone came across this as well? Any idea about a solution?
    Thank you in advance,
    Annique.

    Hi Annique,
    Since this works in CR Designer I'm moving your post to the Business Objects forum.
    It's likely due to BOE servers not having access to the data sources. Make sure you put them in a folder that the WEB server and BOE Servers have access to. To prompt for log on is because we can't find the data files.
    Thank you
    Don

  • How to connect JSP with MySql Database?

    HI All...
    I want to know or How to connect Mysql with JSP or JSF any other software is available? please help me.....

    I want to know or How to connect Mysql
    with JSP or JSF any other software isavailable?
    please help me.....First you need to find 25 m of a CatV cable and...The DB files need to be located on the ninth device of a SCSI Daisy Chain with the total SCSI cable length being over 150 m (and the devices (and cables) need to be mix of Differential and Non-Differential).
    Edit: And forget the terminator, who needs it?

  • GetTables() method with access database

    hello,
    i m trying to use getTables method() using access db using
    dbmd.getTables("d:\inv\db\inventory",null,null,"Table");
    but this gives folowing execption
    java.sql.SQLExecption:[Microsoft][ODBC Micosoft Access Driver]optional feature not implemented.
    at the above line.
    plz help.

    Please see the output below. The ODBC Driver version is 2.0001 (4.00.6019). But it still errors out 'Optional Feature not implemented' ??? I do not have MS Access 2000 installed in my system. I got this database from a different system. Could anybody please let me know what is wrong ?
    dbVer..:04.00.0000
    dbDMV..:2
    dbDRV..:1
    dbDName:JDBC-ODBC Bridge (odbcjt32.dll)
    dbDVer.:2.0001 (04.00.6019)
    Sql error getting table name[Microsoft][ODBC Microsoft Access Driver]Optional feature not implemented
    Sql error getting Catalog name[Microsoft][ODBC Driver Manager] Invalid cursor state
    Sql error getting Schema name[Microsoft][ODBC Microsoft Access Driver]Optional feature not implemented

  • Uploading images in access database using jsp

    Hi, am using jsp with access database and want to upload as in a profile picture for any profile on the site[i mean depending on the user's convenience] ..
    I just have a code which helps select the image from the client's machine n gets its address..but then how to use it in a form or something so that it can be submitted and inserted in the database?
    Any idea? I d prefer not using servelet.. but if it just cannot be done without servelet then ok can suggest with that too.
    Here is the code of Browsing to obtain the picture:
    <form name=uploadForm action="uploadpic.jsp" method=post enctype="multipart/form-data" >     <input type="file" > <input type="submit" name="submit"  />     </form>

    silversurface wrote:
    Hi, am using jsp with access database and want to upload as in a profile picture for any profile on the site[i mean depending on the user's convenience] ..
    bad. Don't put business logic in JSP, and that includes accessing databases.
    Any idea? I d prefer not using servelet.. but if it just cannot be done without servelet then ok can suggest with that too.
    Don't put business logic in JSP. That's what servlets are for (and EJB).

  • 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

  • Database access using HTML, JSP, JavaBean, & Access

    I am trying to create an HTML page that a user logs into and can choose to query, add, delete or modify a specified database. I have created the HTML, the JSP, and access database but I can't figure out how to have 4 different JSP pages(one for each option) to get information from one JavaBean. PLEASE HELP

    http://swforum.sun.com/jive/thread.jspa?threadID=53106&tstart=0

  • Using JavaScript to access Database

    Hi all,
    I am using JSP and Tomcat for my web application.
    Now i need to use Javascript to access the MS Access database. Can anyone please tell me the class and command for accessing database from javascript.
    Please give me an example and that will help me. I know it is not good to access database using JavaScript. But in this situation i have to use it anyhow.
    Thatnks

    Hi all,
    Thanks very much for your help. Now some of you said that it is not possible in JSP to access database using JavaScript, some of you said yes it is possible but not secure, I understand the both concepts.
    Now my problem is last year i built a web application for my company and the scenario is like this:
    The staff records their working time in that application. Now when they click a button it creates a drop down list of all clients they have and that list is in HTML as SELECT TAG. So the select tag includes 100+ client name.
    Now they can add as many client as they want for example if i have worked with 10 clients i will create 10 drop down list by pressing button called ADD CLIENT and will record their hours.
    Now from the description above you guys can understand that an OnClick Javascript event in involved to create multiple dropdown list.
    Now what i want is that i want those 100+ client list to come from database rather than typing them in the SELECT TAG. and please remember the SELECT tag is implemented in Javascript using innerHTML event.
    Now for those of you who suggested that it is not possible to use Javascript in accessing database, can you please tell me how can i implement Onclick event using JSP/Serverlet and can create dynamic drop downlist?
    Thanks for your time to read this long message.

  • How to reference MS Access database in ColdFusion MX 7 on 64-bit Windows

    I am migrating customers from:
    Windows 2000 Server (fully patched)
    Internet Information Services (IIS) 5
    ColdFusion 5
    to:
    Windows Server 2003 Standard x64 Edition (fully patched)
    Internet Information Services (IIS) 6 (running in 32-bit
    mode)
    ColdFusion MX 7 (7.0.2) Standard
    Unfortunately, some of these existing customers are still
    using Microsoft Access databases instead of SQL Server. Having all
    of these existing customers migrate to SQL Server is not yet
    practical. On the old Windows 2000 / ColdFusion 5 server, they are
    using OLE DB data sources to reference the MS Access databases
    using the "Microsoft.Jet.OLEDB.4.0" provider. None are configured
    to use ODBC drivers when referencing MS Access or SQL Server.
    I have yet to figure out how to get ColdFusion MX 7 to:
    - Create a data source that references MS Access databases on
    64-bit Windows.
    - Reference an existing MS Access data source created with
    the 32-bit version of the ODBC Data Source Manager on 64-bit
    Windows.
    A bit of background information regarding MS Access on 64-bit
    Windows:
    - At the time of this writing, Microsoft has not
    created/released 64-bit drivers for Microsoft Access and it's
    unlikely they ever will, for understandable reasons.
    - Contrary to seemingly popular belief, the Microsoft Jet 4.0
    Database Engine does exist on 64-bit Windows. See the following
    regarding version and file location information:
    How to obtain the latest service pack for the Microsoft Jet
    4.0 Database Engine
    http://support.microsoft.com/kb/239114
    - You CAN create MS Access based data sources within 64-bit
    Windows, but they have to be made using the 32-bit version of "ODBC
    Data Source Manager". I'm assuming these DSNs may only be used by
    32-bit applications, but I have not tested that theory.
    32-bit data sources:
    ODBC Data Source Manager:
    %SystemRoot%\SysWOW64\odbcad32.exe
    Registry location:
    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC
    Default file DSN directory:
    C:\Program Files (x86)\Common Files\ODBC\Data Sources
    64-bit data sources:
    ODBC Data Source Manager:
    %SystemRoot%\system32\odbcad32.exe
    Registry location:
    HKEY_LOCAL_MACHINE\SOFTWARE\ODBC
    Default file DSN directory:
    C:\Program Files\Common Files\ODBC\Data Sources
    The 64-bit version of "ODBC Data Source Manager" (under
    Administrative Tools) only show "SQL Server" and/or "SQL Native
    Client" as options when creating new data sources, unless
    third-party software is installed that supplies additional drivers.
    The 32-bit version of "ODBC Data Source Manager" (by default,
    there is no shortcut for this in the Start menu) shows the typical
    drivers seen on 32-bit versions of Windows, including SQL Server,
    SQL Native Client, Microsoft Access, Excel, FoxPro, Paradox, etc.
    When using ColdFusion Administrator in ColdFusion MX 7.0.2 in
    64-bit Windows 2003 (IIS is running in 32-bit mode to allow
    ColdFusion MX 7 to function at all), two problems are encountered
    when dealing with MS Access (and presumably other 32-bit drivers).
    In both cases, ColdFusion is trying to reference the registry
    location for 64-bit data sources instead of 32-bit:
    1. Creating a new data source within ColdFusion
    Administrator:
    Data Source Name: whatever
    Driver: Microsoft Access
    CF Data Source Name: whatever
    Database file: (physical path to whatever.mdb)
    (other settings are irrelvant for this example)
    Error generated when submitting:
    Unable to update the NT registry.
    Cannot open HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC
    Data Sources: Windows error number 5 occurred.Access is denied.
    ColdFusion stores the data source, however a "verify"
    generates the following error:
    Connection verification failed for data source: whatever
    java.sql.SQLException: [Macromedia][SequeLink JDBC
    Driver][ODBC Socket]internal error: Data source name not found and
    no default driver specified
    The root cause was that: java.sql.SQLException:
    [Macromedia][SequeLink JDBC Driver][ODBC Socket]internal error:
    Data source name not found and no default driver specified
    2. Creating the data source using the 32-bit version of "ODBC
    Data Source Manager" then trying to reference it with ColdFusion:
    ODBC Data Source Manager:
    System DSN or File DSN:
    Name: whatever
    Driver: Microsoft Access Driver (.mdb)
    Database: (physical path to whatever.mdb)
    (creation is successful within ODBC Data Source Manager)
    Reference the above DSN within ColdFusion Administrator:
    Data Source Name: whatever
    Driver: ODBC Socket
    Error generated when submitting:
    Error accessing available odbc datasources. - Cannot open
    HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources:
    Windows error 2 occurred.The system cannot find the file specified.
    ColdFusion MX 7 can't find the 32-bit data source on 64-bit
    Windows because it's looking for it in the wrong registry location.
    Can ColdFusion MX 7 be configured to look in
    HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\ODBC
    instead of
    HKEY_LOCAL_MACHINE\SOFTWARE\ODBC
    on a 64-bit Windows machine?

    Paul,
    Thanks for the insight on this. Regarding the initial problem
    I ran into with creating Access based DSNs, very early-on, I
    noticed there were two different driver options for Access
    displayed within ColdFusion MX 7 Administrator:
    Microsoft Access
    Microsoft Access with Unicode
    For reasons I'm am still baffled over, I somehow completely
    forgot about and through the wonders of apparent tunnel vision,
    completely overlooked the "Microsoft Access with Unicode" driver
    option when I was running through my tests.
    At your seemingly-obvious suggestion, I created a data source
    using the Microsoft Access with Unicode driver and it worked
    perfectly fine with the one customer's web site I'm using for
    testing (of course, this is a copy--the production site is still
    housed on the old ColdFusion 5 server). This obviously doesn't
    actually fix the underlying issue with ColdFusion looking in the
    wrong part of the registry on 64-bit Windows, but at least when it
    comes to dealing with Access databases, your suggestion of using
    the Microsoft Access with Unicode driver appears to be a functional
    work-around. So long as there aren't any surprises waiting for me,
    hopefully this will also work for the remaining ColdFusion sites I
    have to migrate that are using Access databases.
    Since you mentioned JDBC drivers in comparison with ODBC, I'm
    pointing out a couple of references in case they're helpful to
    anyone following this thread:
    ColdFusion MX 7 - About JDBC
    http://livedocs.adobe.com/coldfusion/7/htmldocs/00001736.htm
    Types of JDBC technology drivers
    http://java.sun.com/products/jdbc/driverdesc.html
    http://java.sun.com/products/jdbc/
    I don't actually develop anything in ColdFusion, so I'm
    dealing with all of this from a server administration standpoint
    since we do have some domain hosting customers that do develop or
    at least have existing ColdFusion based sites. I am all
    too-familiar with the caveats of using Access in any kind of
    production or heavily used environment and have spent years keeping
    users away from ODBC. For ColdFusion users, that meant creating OLE
    DB DSNs and often having to fix poorly written SQL statements and
    fixing ColdFusion date-related values and boolean values (the
    common problems encountered when switching CF / MS Access users
    from ODBC to OLE DB). I can only recall running into problems with
    a single SQL Server based ColdFusion site when migrating from ODBC
    to OLE DB. That customer never did get their many coding problems
    fixed, so they're the only ones still using ODBC in CF. I have no
    idea what'll happen when that one site gets migrated over--if it'll
    even work. Obviously a lot of things have changed between
    ColdFusion 5 and the MX versions that have come along afterward.
    Thanks again for the Access with Unicode driver tip and JDBC
    info. It looks like I can finally start moving forward again with
    the site migration process.
    Josh

Maybe you are looking for

  • How do i enable airplay on my macbook pro

    How do I enable airplay on macbook pro. I have a denon receiver that can handle airplay.

  • Playing dvd on dvd player

    I copied pix from iphoto onto a dvd-r disc. The dvd plays on my iBook but when I tried to play it on my dvd player it won't play and I get an "incorrect disc" message on the screen. Does anyone know which type of dvd or disc that I should use to burn

  • Can default settings for new entries be changed?

    When entering a new event, the default setting is "all day."  This rarely is the case.  Can it be turned off?

  • Problems with time lapse in Premiere Pro cs5.5

    About a month ago I tried to make a time lapse with my Canon 7D. I imported the pictures to Lightroom and exported them as JPG. Than in Premiere Pro I clicked on import, selected the first image and checked the "numbered stills" box. It all worked as

  • Keyboard Issue in Leopard for Powerbook G4

    Since a fresh Leopard install, I have been having the following problems: the caps lock and num lock keys do not light up anymore, and the keyboard stops responding intermittently. The only fix I have found is to restart the computer. I have read abo