Using JSP to connect to an Access Database

I need help on using JSP to connect to an Access database.
This is the code I currently have connecting to a mySQL DB. I need to change it to connect to an Access DB. The reason I am switching DB's is because mySQL is no longer going to be carried by my host.
Here is the code:
<html>
<head>
<basefont face="Arial">
</head>
<body>
<%@ page language="java" import="java.sql.*" %>
<%!
// define variables
String UId;
String FName;
String LName;
// define database parameters
String host="localhost";
String user="us867";
String pass="jsf84d";
String db="db876";
String conn;
%>
<table border="2" cellspacing="2" cellpadding="5">
<tr>
<td><b>Owner</b></td>
<td><b>First name</b></td>
<td><b>Last name</b></td>
</tr>
<%
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();
// generate query
String Query = "SELECT uid, fname, lname FROM abook";
// get result
ResultSet SQLResult = SQLStatement.executeQuery(Query);
     while(SQLResult.next())
          UId = SQLResult.getString("uid");
          FName = SQLResult.getString("fname");
          LName = SQLResult.getString("lname");
          out.println("<tr><td>" + UId + "</td><td>" + FName + "</td><td>" + LName
+ "</td></tr>");
// close connection
SQLResult.close();
SQLStatement.close();
Conn.close();
%>
</table>
</body>
</html>
Thank You,
Josh

<%@ page language="java"%>
<html>
<head>
<title>
First Bean
</title>
<%@ page import="java.sql.*" %>
</head>
<body>
<p>
<%!
Connection con;
Statement st;
ResultSet rs;
String userid;
String password;
%>
<%!public void db(JspWriter out)
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection("jdbc:odbc:phani");
catch(Exception e){}
try{
st=con.createStatement();
rs=st.executeQuery("SELECT * FROM login");
while(rs.next())
userid=rs.getString("userid");
password=rs.getString("password");
out.println(userid);
out.println("</br>");
out.println(password);
     out.println("</br>");     
}catch(Exception e){}
try{
con.close();
}catch(Exception e){}
%>
<%db(out);%>
</p>
</body>
</html>
phani is dsn name
login is table name
Good luck
phani

Similar Messages

  • Connecting to an access database

    I am trying to connect to an access database using asp.net
    vb.
    I am getting a "unidentified error".
    Any suggestions?

    1. Post code for how you're connecting
    2. Post procedure you went through to get that code
    "sabafana" <[email protected]> wrote in
    message
    news:e4krqh$h07$[email protected]..
    >I am trying to connect to an access database using
    asp.net vb.
    > I am getting a "unidentified error".
    > Any suggestions?

  • Trying to connect to an Access database

    Post Author: robert693
    CA Forum: Deployment
    Hello,
    I am trying to use Crystal to create reports out of an Access database. When I try to connect to the database thru the database expert, I go to Create Connection and choose Databse Files. I choose a database that is in My Documents. I get an error that says "Failed to load database information," and then "Unknown Query Engine Error." I was wondering what I have to do to connect to the Access database.
    Any help would be greatly appreciated!
    Robert 

    Post Author: [email protected]
    CA Forum: Deployment
    I connect to Access by first creating an ODBC connection to it and then have crystal use the ODBC.

  • Connect to remote Access database

    Hi there,
    Can any one tell me how to connect to the remote MS Access? The scnario is:
    Suppose there is a web server with IP 215.167.16.89. The JDBC driver (assumed to be JDataConnect) is installed on this machine. How to use this web server to connect to the Access database called db1.mdb with DSN 'db1' held in the maching with IP 165.247.17.43?
    The Jave connection codes I am using are:
    String url=new String ("jdbc:JDataConnect://165.247.17.43/db1:username:password");
    try{
    drvDriver=(Driver)Class.forName("JData2_0.sql.$Driver").newInstance();
    conConnection = drvDriver.connect(url, new Properties());
    showMessage("Connected to Company2 Database");
    Why can I not connect to the db1 database?
    If I use these codes to connect to the database in the same machine as the web server without specifying the IP address, it worked.
    String url=new String ("jdbc:JDataConnect:db1:username:password");
    Thanks in advance.

    Thanks for the help.
    So you need to give a full path of it as if you are accesing
    through windows explorer.I am not sure how to give a full path. Can you give me the detail please?
    What happens when you have two or more .mdb with the
    same name in different directories in that ip address.
    Since its a file... you need to access it as a file.I think we can specify the different DSN for the two or more .mdb databases.
    Thanks.

  • Trouble using XWD_RAMSTARTUP to connect to RAM DB:Database dbname must remain current

    Trouble using XWD_RAMSTARTUP to connect to RAM DB:Database dbname must remain current...
    I am having trouble connecting to the RAM database. The error I get is
    "In stored procedure XWD_RAMSTARTUP: The following Express Server error occurred: Database GLB must remain current becasue the TEST program is still executing it."
    The express database GLB is the global computing sample given by oracle doc.
    My Test program defined in Express Administrator for GLB has the following code:
    call xwd_meta.init
    call xwd_ramstartup('e:\\Orahome1\\olap\\oes632\\service\\glb.rdc','sampleolap', 'sampleolap')
    call xwd_attachdb('e:\\Orahome1\\olap\\oes632\\service\\glb.db')
    The hyperlink I used is " http://192.168.10.110/Scripts/oowa.exe/ExpSrv632/dbxwdevkit/xwd_init?glb/test "
    the content of the rdc file is
    [PATHS]
    CODE=E:\ORAHOME1\OLAP\OES632\COMMON\
    DATA=E:\ORAHOME1\OLAP\OES632\SERVCIE\
    EXTEND=E:\ORAHOME1\OLAP\OES632\SERVICE\
    [RELATIONAL]
    TYPE=OCI
    INSTANCE=SMSDW
    [DBINFO]
    DBNAME=GLB
    Any help/suggestions would be appreciated.

    Hi,
    > This program connects to database TEST, and reads table MYTABLE in schema MYSCHEMA.
    >
    > I would know if it is possible to select the table name in a dynamic way:
    >
    >   SELECT db_name() INTO :dbn FROM :ptab
    >
    > But this line fails with meesages:
    >
    >  dbdsmss: DBSL99 SQL1087
    >  Must declare the table variable "@P1".   - you have to declare variables in beginning of the program.
    You can select table name dynamic way , but you have to write ABAP code (Selection screen).
    post this question in ABAP forum. you will get more information.
    Thanks
    Siva

  • CONNECT BI7 TO ACCESS DATABASE

    <Moderator Message: Don't use upper case letters; Don't request documentation or links; Search the forums; follow the rules>
    Hello,
    Is it possible to connect Microsoft Access database to BW.
    Should i use DB connect or UD connect.
    If someone could provide simple documentation
    thanks for you help,
    Edited by: Siegfried Szameitat on Dec 9, 2008 12:02 PM

    Hi there!
    I think data binding is being added to netbeans 6 next year, otherwise you will have to use JDBC to access the database and call setText for the field with the data you get out of the db (manual coding). Google for the jdbc odbc bridge for accessing Access DB.
    For data binding you can use Swing X http://www.swinglabs.org/projects.jsp, as long as you don't mind writing code by hand.
    In the mean time, if you really want to do the binding using drag and drop you can use the Visual Web pack for netbeans 5.5 and create a web based app with data binding. If you wait a week or two the final version (preview can be downloaded at the moment) of the web pack should be released.
    Sorry about the tone of the other guy's comment, it seems that Java programmers are traditionally hostile towards VB guys and how they view the world ;)

  • DW Procedures to connect to MS ACCESS database located on remote server

    I am confused about the procedures within Dreamweaver CS3 to connect to a MS ACCESS database on a remoter server.
    I am working through a tutorial book, "Dreamweaver 8 with ASP, Cold Fusion and PHP Training from the Source", but the instructions are unclear concerning the procedures to connect to a MS ACCESS database located on a remote server. 
    The book indicates that the server administration has to create the DSN for you and screen shots indicate that you will result in a list of DSNs to choose from when creating the connections .asp file.
    I went through the procedures to create a connections .asp and resulting in a connection without and tables (of course) because I do not initially have any connection information from my remote site.
    I have generated the required two lines of code as follows for my MS ACCESS database connection on my remote server:
    'Database connection info and provider
    strCon="Provider=Microsoft.Jet.OLEDB.4.0;Data Source="&_
    Server.MapPath("database\trans.mdb") & ";" &_
    "User ID=xxx;Password=xxxxx"
    The question that I have is:
    How does this connection coding relate to the "connections/conn_newland.asp" file that was create within the Dreamweaver screens?  How do I merge the ASP coding?  The file (/connections/conn_newland.asp) generated within Dreamweaver is as follows:
    <%
    'FileName="Connection_odbc_conn_dsn.htm"
    'Type="ADO"
    'DesignationType="ADO"
    'HTTP="true"
    'Catelog=" "
    'Schema
    Dim MM_conn_newland_STRING
    MM_conn_newland_STRINT = "dsn=newland;"
    %>
    Any advice would be appreciated.  I know that this is simple but debugging an error from an  ASP coding merge would be a "bear" to debug!

    I have not used MS Access myself (fortunately) but I believe it works much like the old, old way of achieving a multi-user database in FileMaker.
    That is, it is not a true client-server database but more a peer-to-peer database and that each peer opens the same database file which is available to multiple user via file sharing. Therefore as elikness said it should just be a matter of putting the files on your Lion Server and then sharing that folder/volume using SMB sharing.
    However one thing to be aware of, since MS Access is not a true client-server database I would imagine it uses record locking to manage simultaneous direct access to records in the same files. File or Record locking is something that has historically been a bit flakey when using Windows clients with a Mac file server (and probably vice versa).
    While I am not proposing it as a solution to consider seriously, it is worth you knowing that FileMaker Pro is a database system that is available for both Mac and Windows and depending on how you configure things can be considered to stretch from a configuration very similar to MS Access at the low end all the way to a high-end MS SQL Server style setup at the top end. See http://www.filemaker.com for details.
    There is also a a third-party tool available for migrating databases to or from FileMaker Pro and it can convert MS Access databases to FileMaker Pro see http://www.fmpromigrator.com/
    You could use FileMaker Pro just on Windows machines if you wish.

  • Exception connecting to MS Access Database.

    I'm having problems using the jdbc-odbc bridge with an MS Access database and a file DSN. If I use a system DSN, it works fine but it does not seem to find the file DSN for some reason (And I HAVE to use a file DSN in this instance, for reasons I won't bore you with) - this is the error-message:
    "java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified"
    This is my example code:
    import java.sql.*;
    public class SamplePgm {
    private static Connection con;
    private static Statement stmt;
    private static ResultSet result;
    public static void main(String[] args) {
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = DriverManager.getConnection("jdbc:odbc:Testing", "", "");
    stmt = conn.createStatement();
    result = stmt.executeQuery("select TOP 3 emp_no from employee");
    while (result.next()) {
    System.out.println(result.getString("emp_no"));
    } catch (Exception e) {
    e.printStackTrace();
    } finally {
    try {
    result.close();
    stmt.close();
    con.close();
    } catch (SQLException e) {
    e.printStackTrace();
    The file DSN was set up using the Win2K ODBC administrator.
    Is there any other way to tell ODBC that it's using a file DSN ?
    I'd be very grateful for any/all assistance.
    Thanks.

    My guess would be that a file DSN is stored in a file, a system DSN is stored under the HKeyLocalMachine registry key and a user DSN is stored under the HKeyCurrentUser registry key, but it's only a guess.

  • How to connect with Microsoft Access Database with JAVA

    I want to know the command and query to connect between MSAccess and JDBC.
    Is it beter way to make connection with MSAccess comparing with other Databases such as SQL and Oracle.
    Which Database will be the best with Java?
    I also want to know to be platform indepadent which database is suitable?

    On Windows, you can use MS Access database by:
    Set up a System Data Source using the ODBC control panel applet.
    Use the jdbc:odbc bridge JDBC driver, and specify a jdbc url that points to the data source name you just specified.
    It's been too long since I've done this, so I don't remember the syntax of the jdbc url, but I'm sure that if you do a search for the jdbc:odbc bridge that you will find what you are looking for.
    As far as the question about which database is best, you will need to determine that based on your project requirements.
    If you want a quick and dirty, open source, cross-platform database, take a look at HyperSonic SQL.
    - K

  • Connection to ODBC access database failure

    I have made several sites using ACCESS databases via ODBC DSN
    name. But suddenly it does not work any more. I can not use the
    Database wizards in DM 8.02. When I have made a connection, tested
    it OK and I try to se the tables/views. I only got the word "none".
    If I in the advanced recordset wizard write the SQL command, the
    data is showen correctly!!???
    There is something wrong with DM's abillitry to connect to
    the ODBC DNS name...Everything is updateted to the latest version.
    Is there anybody who have any clue to what could be wrong. It
    is the same story on an old 2000 Server, a new 2003 small busines
    server and from DM installed on two different clientmaschines and
    on the two servers.

    Hi!
    You could try this It worked for me on all my connections.
    I found a extension called SP2DBFix1.0.2.mxp
    Down load here,
    http://download.macromedia.com/pub/dreamweaver/extensions/SP2DBFix1.0.2.mxp
    to fix a XP pro service pack2 connections.
    To fix: I went to Sites/Advanced/Remove connection Scripts,
    ran that removed
    my
    connection scripts. I then shut down Dreamweaver 8 installed
    the extension
    then opened dreamweaver 8 made a new connection and it works
    now Great! Im
    happy.
    You have to run this same routine on every site you have
    setup with
    connection scripts
    Good Luck.
    Dave
    "JOhnny Odgaard" <[email protected]> wrote
    in message
    news:ersvva$2hd$[email protected]..
    > I have made several sites using ACCESS databases via
    ODBC DSN name. But
    > suddenly it does not work any more. I can not use the
    Database wizards in
    DM
    > 8.02. When I have made a connection, tested it OK and I
    try to se the
    > tables/views. I only got the word "none". If I in the
    advanced recordset
    wizard
    > write the SQL command, the data is showen correctly!!???
    >
    > There is something wrong with DM's abillitry to connect
    to the ODBC DNS
    > name...Everything is updateted to the latest version.
    >
    > Is there anybody who have any clue to what could be
    wrong. It is the same
    > story on an old 2000 Server, a new 2003 small busines
    server and from DM
    > installed on two different clientmaschines and on the
    two servers.
    >

  • The Mystery of Connecting to an Access Database

    I am just starting to use designer and with some stumbles along the way have perfected the layout of the form I am trying to create. The next step is connecting it to a Microsoft Access database. However, I am having some problems.
    I have looked everywhere imaginable for a "how-to" on connecting an Access database to my form in Designer. I have gone through setting up data connections several times, all with the same result: "Connection for Source NPIF failed because the environment is not trusted". NPIF is the name of the data connection I've been trying to set up.
    I realize this is probably a very boring problem to solve, but I am desperate! I have not seen any answers to other posts asking this same question, so I'm worried this one will be overlooked too. Please, there are many of us out there who cannot figure this out! Help us?
    Other people seem to have set this up with no problems. Maybe one of you can post the steps you took to get it to work - share the love!!
    Thank you, Elizabeth

    Chris, here's my script. It's in the initialize event.<br /><br />----- ProjectInformationForm.Page1ClientBillingProject.Client.DataDropDownList::initialize - (JavaScript, client) <br /><br />/*     This dropdown list object will populate two columns with data from a data connection.<br /><br />     sDataConnectionName - name of the data connection to get the data from.  Note the data connection will appear in the Data View.<br />     sColHiddenValue      - this is the hidden value column of the dropdown.  Specify the table column name used for populating.<br />     sColDisplayText          - this is the display text column of the dropdown.  Specify the table column name used for populating.<br /><br />     These variables must be assigned for this script to run correctly.  Replace <value> with the correct value.<br />*/     <br /><br />var sDataConnectionName = "NPIF";          //     example - var sDataConnectionName = "MyDataConnection";<br />var sColHiddenValue = "ClientName";               //     example - var sColHiddenValue = "MyIndexValue";<br />var sColDisplayText = "ClientName";               //     example - var sColDisplayText = "MyDescription"<br /><br />//     Search for sourceSet node which matchs the DataConnection name<br />var nIndex = 0;<br />while(xfa.sourceSet.nodes.item(nIndex).name != sDataConnectionName)<br />{<br />     nIndex++;<br />}<br /><br />var oDB = xfa.sourceSet.nodes.item(nIndex);<br />oDB.open();<br />oDB.first();<br /><br />//     Search node with the class name "command"<br />var nDBIndex = 0;<br />while(oDB.nodes.item(nDBIndex).className != "command")<br />{<br />     nDBIndex++;<br />}<br /><br />//     Backup the original settings before assigning BOF and EOF to stay<br />var sBOFBackup = oDB.nodes.item(nDBIndex).query.recordSet.getAttribute("bofAction");<br />var sEOFBackup = oDB.nodes.item(nDBIndex).query.recordSet.getAttribute("eofAction");<br /><br />oDB.nodes.item(nDBIndex).query.recordSet.setAttribute("stayBOF", "bofAction");<br />oDB.nodes.item(nDBIndex).query.recordSet.setAttribute("stayEOF", "eofAction");<br /><br />//     Clear the list<br />this.clearItems();<br /><br />//     Search for the record node with the matching Data Connection name<br />nIndex = 0;<br />while(xfa.record.nodes.item(nIndex).name != sDataConnectionName)<br />{<br />     nIndex++;<br />}<br />var oRecord = xfa.record.nodes.item(nIndex);<br /><br />//     Find the value node<br />var oValueNode = null;<br />var oTextNode = null;<br />for(var nColIndex = 0; nColIndex < oRecord.nodes.length; nColIndex++)<br />{<br />     if(oRecord.nodes.item(nColIndex).name == sColHiddenValue)<br />     {<br />          oValueNode = oRecord.nodes.item(nColIndex);<br />     }<br />     else if(oRecord.nodes.item(nColIndex).name == sColDisplayText)<br />     {<br />          oTextNode = oRecord.nodes.item(nColIndex);<br />     }<br />}<br /><br />while(!oDB.isEOF())<br />{<br />      this.addItem(oTextNode.value, oValueNode.value);<br />       oDB.next();<br />}<br /><br />//     Restore the original settings<br />oDB.nodes.item(nDBIndex).query.recordSet.setAttribute(sBOFBackup, "bofAction");<br />oDB.nodes.item(nDBIndex).query.recordSet.setAttribute(sEOFBackup, "eofAction");<br /><br />//     Close connection<br />oDB.close();

  • How to connect to ms access database in jdbc

    i want to connect to my ms access database located in my c:\tapi\dbexperts.mdb. please help me construct the connection string. thanks in advance for your help.

                   String database = "c:\\tapi\\dbexperts.mdb"; /* change it*/
                   String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=" + database + ";DriverID=22;READONLY=false";
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   con = DriverManager.getConnection(url);

  • Breaking the Sharepoint connection within an Access database

    We have recently changed our online database to a new system. We downloaded all the current information into excel or access. However my major database to track all staff training, mandatory renewables and policy reviews will not allow attachments to be
    uploaded to the access database because "the sharepoint table is no longer available". We have had many problems with sharepoint, and wish to convert the database strictly to access and break the sharepoint connection to the former website. Is there
    a way to do this?
    Please advise

    Hi
    This is the forum to discuss questions about  Access develop. For your question is SharePoint related, I am moving this thread to the SharePoint forum
    The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share
    their knowledge or learn from your interaction with us.
    Thank you for your understanding.
    Best Regards
    Lan
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Cannot connect to an Access database from DreamWeaver

    Hello.
    I'm creating my first web page with a DB connection.
    I have a minimal DB with a simple table.
    This is a DB as Access create it by default, with no password
    and no
    security constraints.
    In DreamWeaver, I have created a default DB connection string
    for Access
    2000.
    I have removed, from this connection string, the UserID and
    the Password as
    there is no password for my DB.
    I have put the right path for this DB.
    But it doesn't work!
    I receive the message: (sorry for my bad english) cannot open
    the DB, it is
    already open by another user (it is not the case: the DB is
    closed) or you
    must have autorisation to visualised the data.
    Do you have an idea ?
    Alain.

    "chucknado" <[email protected]> a écrit
    dans le message de
    news:fbnon3$47m$[email protected]..
    > You might have a file or folder permissions problem.
    Please see the
    following:
    >
    >
    >
    http://livedocs.adobe.com/en_US/Dreamweaver/9.0/WSc78c5058ca073340dcda9110b1f693
    > f21-79f0.html
    >
    > Charles Nadeau
    > Dreamweaver
    > Adobe Systems
    >
    I'm not an expert in file permissions so I have simply moved
    my DB on the
    HDD of my PC, before it was on another server.
    So, now, I think I have no file permission problem anymore.
    I can connect the DB from DreamWeaver but I cannot see the
    tables !
    If I open the Tables node of the db tree in the Database
    window of
    DreamWeaver, I receive the message:
    "Error calling GetTables".
    Do you have an idea or an advice ?
    Thanks in advance,
    Alain.

  • Using JSP to write data to MySql database

    Please help. I am trying to develop a website where a user registers by filling details required onto a page this data is then posted onto another page and displayed to user the user can the store this data into the database if they are satisfied with it. The problem is although this data is displayed on the next JSP page when I click on save the data is not written to my database.
    Code below the problem is with datasave.jsp
    Register.jsp:
    <html>
    <body bgcolor="#d0d0d0">
    <style type ="text/css">
    @import "style.css"; </style>
    <head>
    <script src="form_functions.js" type="text/javascript"></script>
    <script type="text/javascript">
    function validateForm()
         errorMessage = "The following field(s) require your attention:";
         hasErrors = false;
         newline = "\n - ";
         if( isInvalidEmail( form1.email.value ) )
              errorMessage += newline + "Email :: must contain a valid email address";
              hasErrors = true;
         if( isEmpty( form1.Firstname.value ) )
              errorMessage += newline + "Firstname :: must not be empty";
              hasErrors = true;
    if( isEmpty( form1.Lastname.value ) )
              errorMessage += newline + "Lastname :: must not be empty";
              hasErrors = true;
         if( isNotInteger( form1.phone.value ) )
              errorMessage += newline + "Phone :: must consist of numbers";
              hasErrors = true;
    if( isEmpty( form1.Address.value ) )
              errorMessage += newline + "Address :: must not be empty";
              hasErrors = true;
         if( isEmpty( form1.City.value ) )
              errorMessage += newline + "City :: must not be empty";
              hasErrors = true;
         if (!document.form1.accept[1].checked)
         errorMessage += newline + "Please accept condition to continue";
              hasErrors = true;
         if( hasErrors )
              alert( errorMessage );
              return false;
         else
              return true;
    </script>
    </head>
    <body>
    <p>
    <body>
    <script src="dateLastUpdated.js"
              type="text/javascript">
    </script>
    <p><h1>REGISTER YOUR DETAILS FOR YOUR BUYANDSELL ACCOUNT</h1></p>
    <!-- ************* start of form **************** -->
    <form
         name="form1"
         method="POST"
         action="datasave.jsp"
         onSubmit="return validateForm();"
         >
    <p>
         Email:
         <input type="text" name="email"/>
         </p>
    <p>
         Password:
         <input type="password" name="Password"/>
         </p>
    <p>
         Firstname:
         <input type="text" name="Firstname"/>
         </p>
    <p>
    LastName:
         <input type="text" name="Lastname"/>
         </p>
    <p>
    Phone:
         <input type="text" name="phone"/>
         </p>
    <p>
    Address:
         <input type="text" name="Address"/>
         </p>
    <p>
    City:
         <input type="text" name="City"/>
         </p>
    <p>
         Country:
         <select name="country">
              <option value="Eire">Republic of Ireland </option>
              <option value="Northern Ireland">Northern Ireland </option>
         </select>
         </p>
    <p>
    Terms and Conditions:
    If you accept the Terms and Conditions - please click on "I accept" at the end of this
    document.
    1. GENERAL
    This website is owned and operated by B&S Limited, trading as BuyandSell ("BuyandSell")
    whose head office is at BuyandSell House, Argyle Square, Donnybrook, Dublin 4. For the
    purpose of these terms and conditions "we", "our" and "us" refers to BuyandSell.
    <input type=radio checked name="accept" value="0"> I do not accept<br>
    <input type=radio name="accept" value="1">I have read and I accept the Terms and
    Conditions
    </P>
    <p>
              <input type="submit" value="Contact Details"/>
         </p>
    </form>
    <!-- ************* end of form **************** -->
    <centre>
    <script language="JavaScript1.3">
         // run script
         dateLastUpdated();
    </script>
    </body> </html>
    datasave.jsp:
    <html>
    <style type ="text/css">
    @import "style.css"; </style>
    <HEAD>
    </script>
    </HEAD>
    <p><h1>CREATE YOUR BUYANDSELL USER ACCOUNT</h1></p>
    </P class= "links">
    <body>
    <%-- Set the scripting language to Java and --%>
    <%-- Import the java.sql package --%>
    <%@ page language="java" import="java.sql.*"%>
    <%-- -------- Open Connection Code -------- --%>
    <%
    /* Note: MySQL is accessed through port 3306. NAIJA is the name of the database */
         String connectionURL = "jdbc:mysql://localhost:3306/buyandsell";
         Connection connection = null;
         Statement statement = null;
    ResultSet rs = null;
    try {
    // Load SQL Server class file
    Class.forName("com.mysql.jdbc.Driver").newInstance();
    // Make a connection to the Mysql
    connection = DriverManager.getConnection(connectionURL, "root", "");
    %>
    <%-- -------- INSERT Code -------- --%>
    <%
    String action = request.getParameter("action");
    // Check if an insertion is requested
    if (action != null && action.equals("insert")) {
    // Begin transaction
    connection.setAutoCommit(false);
    // Create the prepared statement and use it to
    // INSERT the registration attributes INTO the registration table.
    PreparedStatement pstmt = connection.prepareStatement( "INSERT INTO registration(email,Password,Firstname,Lastname,phone,Address,City,Country) VALUES(?,?,?,?,?,?,?,?)");
                   pstmt.setString(1, request.getParameter("email"));
                   pstmt.setString(2, request.getParameter("Password"));
    pstmt.setString(3, request.getParameter("Firstname"));
                   pstmt.setString(4, request.getParameter("Lastname"));
                   pstmt.setDouble(
    5, Double.parseDouble(request.getParameter("phone")));
                   pstmt.setString(6, request.getParameter("Address"));
                   pstmt.setString(7, request.getParameter("City"));
    pstmt.setString(
    8, request.getParameter("Country"));
    int rowCount = pstmt.executeUpdate();
    // Commit transaction
    connection.commit();
    connection.setAutoCommit(true);
    %>
    <p>
    <p>
    <form
                        NAME="data"
                        action="Login.html" method="post">
    <input type="hidden" value="insert" name="action">
    </p>
    Email:
         <strong>
         <%= email %>
         </strong>
    <p>
    Firstname:
         <strong>
         <%= Firstname %>
         </strong>
    </p>
    <p>
    Lastname:
         <strong>
         <%= Lastname %>
         </strong>
    </p>
    <p>
    Phone no:
         <strong>
         "<%= phone %>"
         </strong>
    </p>
    <p>
    Address:
         <strong>
         <%= Address %>
         </strong>
    </p>
    <p>
    City:
         <strong>
         <%= City %>
         </strong>
    </p>
    <p>
    Country:
         <strong>
         <%= Country %>
         </strong>
    </p>
    <p>
    <input type="submit" value="SAVE">
    </form>
    </p>
    <%-- -------- Close Connection Code -------- --%>
    <%
    // Close the ResultSet
    rs.close();
    // Close the Statement
    statement.close();
    // Close the Connection
    connection.close();
    } catch (SQLException sqle) {
    out.println(sqle.getMessage());
    } catch (Exception e) {
    out.println(e.getMessage());
    %>
    </body>
    </html>

    Hi,
    I think in place of buyandsell put NAIJA
    String connectionURL = "jdbc:mysql://localhost:3306/NAIJA ";

Maybe you are looking for

  • How to: Cinema 4d file as fotoshop layer

    Hello: I am using fotoshop cc and would like to import a cinema 4d file as a 3d layer. The only way i managed this until now is by converting the c4d file to a 3ds file. Unfortunately i lose all colors when i import the file as fotoshop layer. Gratef

  • Can't find Audible Audiobook on Iphone 4s

    Hey everyone, First post here, so hopefully I get this right.  I've searched around and can't find anyone with a problem similar to mine. So I downloaded a book from audible.  And when I put the book on my iphone, i went to the audiobooks section to

  • 10.5.1 update and nested Smart Groups

    After installing the 10.5.1 update, it seems that my address book smart groups no longer "nest" properly within regular address book groups. Example: I have several smart groups built with rules like "email contains company X", these smart groups hav

  • Changing file format for images

    To save on memory, my boss wants me to change my images from bitmaps to png files. Should I go imto the project folder and open each file and re-save it, then make sure the link has the right extension. Any thoughts on the best way to do this?

  • Script for comparing 2 schemas based upon table compare

    Hi, I want to write a script on 2 schemas TEST and TEST1 which will compare the difference in tables in both schemas and will Insert Data into schema TEST from TEST1 depending upon the matched columns in schema TEST and TEST1 Any help will be nedful