Inserting into MS Access Database - Wierd resultset!!

I'm developing an application that takes in values from t1 in the database, performs operations on them and inserts them into t2. For this I have to check all records in t2 every time I'm about to make an insertion.. Strangely enough, rs1.beforeFirst() (rs1 is the resultset for t2) in my code refuses to put the cursor before the 1st row, and the code continues operations from the last row..Help!!
Here's a sample of my code:
rs1.beforeFirst();
               if(rs1.next())
                    do
                         if(rs1.getInt("uid")!=i)
                         {     rs1.next();     }
                         else
                         {     break;
                    }while(!rs1.last());
                    if(rs1.isAfterLast())
                    {     n=1;
                         s1="Insert into t_urlinfo values('" + dt + "'," + i + ",'" + text + "'," + n + ")";
                         System.out.println(s1);
                         stmt2.executeUpdate(s1);
                    }

Where, in that code, are you calling beforeFirst?
Also, why do you feel it necessary to "check every row" before an insert? Is it to avoid duplicates? If so, does your table have a primary key or other unique field? If so, simply attempt to insert and then catch the SQLException.

Similar Messages

  • How to insert date into ms access database using sql query in servlet

    sir all thing is working well now only tell me how we can insert date into ms access database which is input by user .
    insert into db2(bookname,studentname,date) values('"+bname+"','"+sname+"',date_format)";{code}
    or either the system date is inserted with query .
      plz help me
    thanx                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    bhavishya wrote:
    sir all thing is working well now only tell me how we can insert date into ms access database which is input by user .
    insert into db2(bookname,studentname,date) values('"+bname+"','"+sname+"',date_format)";{code}
    or either the system date is inserted with query .
    plz help me
    thanxAnd that SQL statement is another reason to use PreparedStatement. I assume bname and sname are input from some form? Well, if that's the case, simply inserting them into SQL by simple String concatenation is just begging for all sorts of problems. What if there is an apostrophe in the entry? Broken Statement. Worse, it's a wide open invitation to an SQL Injection attack.

  • I can insert data into an access database, but I need to querry the database for specific information. How do I do it?

    I can insert data into an access database, now I need to do some simple querries such as selecting all records that are greater than a certain value or = a certain value. How can I return only the selected records?

    If you don't want to spend any money, then instead of ActiveX, I would recomend LabSQL from Jeffrey Travis. I use it instead of the Connectivity toolkit and have had no problems. Besides being free, you have the advantage of being able to use it with any database. ActiveX ties you to Access and you upgrade your version of Access and find the properties and methods are different, you've got a lot of reprogramming to do.

  • 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

  • How To Insert Data into a Access Database from a PDF File

    Hi All,
    Could anyone help me to insert PDF form data to an MS Access database.I am new to this and I would appreciate if anyone can help me at the earliest.
    Thanks,
    Deepti

    You can submit your PDF to a server-side script (ASP/PHP), and store the new record in a MS Access database.
    For more information on how to store your PDF submission in a database, please visit:
    http://www.fdftoolkit.net

  • Error while inserting into ms access using jsp

    i am using the following code to insert values from textboxes into access database
    try
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = DriverManager.getConnection(url);
              Statement stmt=con.createStatement();
              //ResultSet rs = null;
              //String sql = ("INSERT INTO co-ords VALUES ('" + nam + "','" + lat + "','" + lon + "','"+ latm +"','"+ lonm +"','"+ latmd +"','"+ lonmd +"','"+ latms +"','"+ lonms +"') ");
              String sql = "INSERT INTO co-ords (nam ,lat , lon , latm ,lonm , latmd , lonmd ,latms , lonms) VALUES ('" + nam + "','" + lat + "','" + lon + "','"+ latm +"','"+ lonm +"','"+ latmd +"','"+ lonmd +"','"+ latms +"','"+ lonms +"') ";
              out.println(sql);
              stmt.executeUpdate(sql);
    the output i get is
    INSERT INTO co-ords (nam ,lat , lon , latm ,lonm , latmd , lonmd ,latms , lonms) VALUES ('cck','28.656529681148545','77.23440170288086','28','77','39','14','23.508','3.8472') Exception:java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.
    can somebody help me?

    Simple,
    Some error in your query right. Unable to understand Quotation stuff.
    Well understand it properly else error will follow forever :)
    Without String, Straight Away Values
    stmt1.executeUpdate("insert into Login_Details values('Example','Exmaple')");This is the query with Login_Id Pass_Word String containing the value
    stmt1.executeUpdate("insert into Login_Details values('"+Login_Id+"','"+Pass_Word+"')");Then storing sql as string and pass it in executeUpdate(sql)
    String sql="insert into Login_Details values ('example','example') "String + Values in String
    String sql="insert into Login_Details values ('"+example+"','"+example+"') "Just first it . Hope this reply solve ur SQL EXCEPTIONG
    Sachin Kokcha

  • Insert into an Access DB

    I'm trying toinsert in an access database and when I execute the Update it appears the error:
    java.sql.SQLException: No row count was produced
    the source code I use is:
    <%@ page import="java.io.*"%>
    <%@ page import="java.io.IOException"%>
    <%@ page import="javax.servlet.http.*"%>
    <%@ page import="java.util.*"%>
    <%@ page import="java.sql.*"%>
    <%
    int i=0;
    int k,j;
    String name="defecte";
    String req="defecte";
    String url="jdbc:odbc:avimar";
    String driver="sun.jdbc.odbc.JdbcOdbcDriver";
    String query="defecte";
    String query2="defecte";
    String query3="defecte";
    String resultat = new String();
    String resultat2 = new String();
    Vector vector=new Vector();
    Vector vec=new Vector();
    Vector vec2=new Vector();
    Vector vec3=new Vector();
    Class.forName(driver);
    Connection con= DriverManager.getConnection(url);
    %>
    <html>
    <head>
    <title>Registrar-se a Avimar.net</title>
    </head>
    <body bgcolor="#8C968C" text="#000000">
    <%
    String nom =request.getParameter("nom");
    String cognoms =request.getParameter("cognoms");
    String lg = request.getParameter("login");
    String psw =request.getParameter("psw");
    String rpsw =request.getParameter("rpsw");
    String direccio =request.getParameter("direccio");
    String poblacio =request.getParameter("poblacio");
    String cpostal =request.getParameter("cpostal");
    String telefon =request.getParameter("telefon");
    String horaris =request.getParameter("horaris");
    query3="INSERT INTO Usuari (id,STR_Login,STR_Psw,STR_Nom,STR_Cognoms,STR_Direccio,STR_Poblacio,STR_Cpostal,STR_Telefon,STR_Horaris,INT_Id_permis,BOOL_Flag_actiu) VALUES (2,'"+lg+"','"+psw+"','"+nom+"','"+cognoms+"','"+direccio+"','"+poblacio+"','"+cpostal+"','"+telefon+"','"+horaris+"',1,true)";
    Statement select2=con.createStatement();
    System.out.println(query3);
    try{
    select2.executeUpdate(query);
    catch(SQLException ee)
    System.out.println("ha petat en el executeUpdate");
    ee.printStackTrace();
    %> <jsp:forward page="registrat.html">
    </jsp:forward>
    </body>
    <%
    select.close();
    con.close();
    %>
    </html>

    No idea. You might try re-writing in java and see if it works that way.

  • Related to insertion into HASH access method

    Hi,
    I have four multi-threaded processes (2 writer and 2 reader processes), which make use of Berkeley DB transactional data store. I have multiple environments and the associated database and log files are located in separate directories.
    Database access method used is DB_HASH.
    When I looked into stack trace of the Writer process, following is observed:
    A] Indicates insertion into HASH database
    ffffffff7b9a84f4 _pwrite (65, fffffffea28bc6e0, 2000, 3e18000, 7358, 7357) + c
    ffffffff7c667bec __os_io (104c58c80, 3e18000, 104c9f140, 1f0c, 2000, 0) + 29c
    ffffffff7c650fb0 __memp_pgwrite (104c58c80, 104c9c250, fffffffea00e4d98, fffffffea28bc698, 0, 2000) + 200
    ffffffff7c650aa4 __memp_bhwrite (104c58c80, 104c9c250, fffffffea03829e8, fffffffea28bc698, 0, 100c559c0) + 454
    ffffffff7c64fa84 __memp_alloc (fffffffea00e4dc4, fffffffea00e4d98, 1852e6, 0, 104c58c80, fffffffea0000138) + 72c
    ffffffff7c65360c __memp_fget (104ca1a50, 104ca4b54, 0, fffffffea0384c18, 0, fffffffea0000138) + 1bdc
    ffffffff7c5909ac __ham_get_cpage (104ca4920, 0, 104ca4b60, 104ca1a50, 104ca4b40, 104ca14d0) + 1c4
    ffffffff7c57d334 __ham_lookup (104ca4920, fffffffe3e3fb140, 1bb5, 2, fffffffe3e3fa4dc, 104ca4b40) + 74
    ffffffff7c57badc __hamc_put (104ca4920, fffffffe3e3fb140, fffffffe3e3fb118, 34, fffffffe3e3fa4dc, 104ca4b40) + ec
    ffffffff7c603230 __dbc_put (104ca4920, 28, e, 104ca4920, 104ca4920, ffffffff7c794508) + db0
    ffffffff7c5f538c __db_put (104ca14d0, 19f388, 104ca15d8, fffffffe3e3fb140, fffffffe3e3fb118, 0) + 21c
    ffffffff7c60e00c __db_put_pp (104c58c80, 0, fffffffe3e3fb140, fffffffe3e3fb118, 0, 104ca14d0) + 244
    00000001001079f0 __1cLBDBDatabaseGinsert6MrknDstdEpair4CpCC2__IkIIII_v_ (104c9c3a0, 0, 4, 7, 74, 4) + 178
    00000001001b83cc __1cIIndexSetKwriteIndex6MrkirnDstdDmap4n0BEpair4CpCC4__CIn0BEless4n0C___n0BJallocator4n0BEpair4Ckn0C_CI___
    ____i_ (1009ecf80, 104ca7398, 1069fbee0, 74, 45f29f466a48b, 10084bcd0) + b8
    00000001000af1e8 __1cLIndexWriterOpProcessObject6MpnDstdDmap4n0BEpair4CpCC2__CIn0BEless4n0C___n0BJallocator4n0BEpair4Ckn0C_C
    I_______v_ (104ca7240, 1069fbee0, fffffff71e49eb29, 92b0e8920, 100572990, 49587449) + 214
    00000001000b156c __1cbJManagerProducerThreadConsumersModel4nDstdDmap4n0AEpair4CpCC1__CIn0AEless4n0B___n0AJallocator4n0AEpair
    4Ckn0B_CI_______OpDoProcessHook6M_v_ (104ca7240, 1069fbee0, 1003d1, 0, 1005729e0, 1003d120c) + 250
    00000001002bc224 __1cKThreadBaseKmDoProcess6M_v_ (104ca7240, 10043d000, 1000b131c, 104ca72a0, 10043dc6d, 10020e90c) + 1ac
    00000001002bbf44 __1cKThreadBaseQmThreadMainChild6Fpv_1_ (104ca7240, 100572000, 10043d, 0, 10043dbcb, 1005729e0) + ec
    ffffffff7eb17c9c lwpstart (0, 0, 0, 0, 0, 0)
    B] Does the below stack trace indicate the insertion into HASH database? I am getting this doubt because the above and below mentioned stack traces
    differ. Can this happen when the access method used is DB_HASH or is it something to do with application flag / config settings? Please suggest.
    ffffffff7b9a71f4 _pread (65, fffffffeae356140, 2000, 129c8000, 81e6, 81e5) + c
    ffffffff7c667acc __os_io (104c58c80, 129c8000, 104c9f140, 94e4, 2000, 0) + 17c
    ffffffff7c650bfc __memp_pgread (104c9c250, fffffffea0079c58, fffffffeae3560f8, 0, 0, 104c58c80) + 90
    ffffffff7c653928 __memp_fget (104c9c250, 0, fffffffeae3560f8, fffffffea03829e8, 1, fffffffea0000138) + 1ef8
    ffffffff7c5619e8 __bam_get_root (104d1cde0, 2, 20002, 1000, fffffffe3e7fa1e4, 0) + d8
    * ffffffff7c5606ec __bam_rsearch (104d1cde0, 104d1d32c, 3242, 1, 104c9c250, 3242) + 44*
    * ffffffff7c560438 __ram_add (104d1cde0, 104d1d32c, fffffffe3e7fb118, 2, 0, 104d1d200) + 44*
    * ffffffff7c55ecb4 __ramc_put (104d1cde0, fffffffe3e7fb140, fffffffe3e7fb118, e, 0, 0) + 64*
    ffffffff7c6032c0 __dbc_put (104c9f200, 28, e, 104c9f200, ffffffff7c55ec50, e) + e40
    ffffffff7c5f538c __db_put (104c9bc60, 19f388, 104c9bd68, fffffffe3e7fb140, fffffffe3e7fb118, 0) + 21c
    ffffffff7c60e00c __db_put_pp (104c58c80, 0, fffffffe3e7fb140, fffffffe3e7fb118, 0, 104c9bc60) + 244
    00000001001079f0 __1cLBDBDatabaseGinsert6MrknDstdEpair4CpCC2__IkIIII_v_ (104c95790, 0, 4, 7, 74, 4) + 178
    00000001001b83cc __1cIIndexSetKwriteIndex6MrkirnDstdDmap4n0BEpair4CpCC4__CIn0BEless4n0C___n0BJallocator4n0BEpair4Ckn0C_CI___
    ____i_ (1009ecf80, 104ca6ee8, 105f8a580, 74, 45f29f466b002, 10084bcd0) + b8
    00000001000af1e8 __1cLIndexWriterOpProcessObject6MpnDstdDmap4n0BEpair4CpCC2__CIn0BEless4n0C___n0BJallocator4n0BEpair4Ckn0C_C
    I_______v_ (104ca6d90, 105f8a580, fffffff71e49eb29, 92b0e8920, 100572990, 49587449) + 214
    00000001000b156c __1cbJManagerProducerThreadConsumersModel4nDstdDmap4n0AEpair4CpCC1__CIn0AEless4n0B___n0AJallocator4n0AEpair
    4Ckn0B_CI_______OpDoProcessHook6M_v_ (104ca6d90, 105f8a580, 1003d1, 0, 1005729e0, 1003d120c) + 250
    00000001002bc224 __1cKThreadBaseKmDoProcess6M_v_ (104ca6d90, 10043d000, 1000b131c, 104ca6df0, 10043dc6d, 10020e90c) + 1ac
    00000001002bbf44 __1cKThreadBaseQmThreadMainChild6Fpv_1_ (104ca6d90, 100572000, 10043d, 0, 10043dbcb, 1005729e0) + ec
    ffffffff7eb17c9c lwpstart (0, 0, 0, 0, 0, 0)
    Details about the application are as follows:
    For Writer / Reader:
    Environment flags : DB_CREATE | DB_INIT_MPOOL | DB_THREAD | DB_INIT_LOCK | DB_INIT_TXN
    Following are the parameters to db-&gt;open function call:
    WRITER*
    DB-&gt;open(DB *db,
    DB_TXN *txnid, =&gt; NULL
    const char *file, =&gt; file name
    const char *database, =&gt; NULL
    DBTYPE type, =&gt; DB_HASH
    u_int32_t flags, =&gt; DB_READ_UNCOMMITTED | DB_AUTO_COMMIT | DB_CREATE | DB_THREAD
    int mode =&gt; 0);
    Also, DB_DUP flag is set.
    READER_
    DB-&gt;open(DB *db,
    DB_TXN *txnid, =&gt; NULL
    const char *file, =&gt; file name
    const char *database, =&gt; NULL
    DBTYPE type, =&gt; DB_UNKNOWN
    u_int32_t flags, =&gt; DB_READ_UNCOMMITTED | DB_RDONLY | DB_AUTO_COMMIT | DB_THREAD
    int mode =&gt; 0);
    DB_CONFIG file contents are as follows:
    set_cachesize 0 536870912 1
    set_lg_bsize 10485760
    set_data_dir DATADIR
    set_lg_dir LOGDIR
    set_lk_max_locks 100000
    set_lk_max_lockers 100000
    set_lk_max_objects 100000
    set_flags DB_REGION_INIT
    set_tx_max 150
    mutex_set_increment 7500
    Thanks,
    Magesh

    Hi Nandish,
    DB statistics were collected using the following command:
    db_stat -d <database name>
    When db_stat and db_verify utilities were run during the application runtime, both of them failed for most of the databases.
    Please find below sample output for db_stat and db_verify utilities for 'SUBID_P1_S1_FF3' DB:
    Sun Jan 4 07:55:28 2009 Local time
    db_stat: page 44972: illegal page type or format
    db_stat: PANIC: Invalid argument
    db_stat: PANIC: fatal region error detected; run recovery
    db_stat: close: DB_RUNRECOVERY: Fatal error, run database recovery
    db_stat: File handles still open at environment close
    db_stat: Open file handle: /opt/vol1/data/SUBID_P1_S1_FF3
    db_stat: PANIC: fatal region error detected; run recovery
    db_stat: dbenv->close: DB_RUNRECOVERY: Fatal error, run database recovery
    db_verify: Page 44972: duplicate page of inappropriate type 13
    db_verify: Page 20769: record count incorrect: actual 285, in record 286
    db_verify: Page 9337: bad record count: has 867 records, claims 868
    db_verify: Page 44497: record count incorrect: actual 88, in record 81
    db_verify: Page 21317: bad record count: has 670 records, claims 663
    db_verify: Page 4524: record count incorrect: actual 273, in record 275
    db_verify: Page 1141: bad record count: has 2601 records, claims 2603
    db_verify: Page 40872: record count incorrect: actual 380, in record 382
    db_verify: Page 20150: bad record count: has 962 records, claims 964
    db_verify: Page 44984: duplicate page of inappropriate type 0
    db_verify: Page 43953: record count incorrect: actual 9, in record 8
    db_verify: Page 9877: bad record count: has 591 records, claims 590
    db_verify: Page 44994: duplicate page of inappropriate type 0
    db_verify: Page 41115: record count incorrect: actual 100, in record 101
    db_verify: Page 9279: bad record count: has 682 records, claims 683
    db_verify: Page 44975: duplicate page of inappropriate type 13
    db_verify: Page 44997: duplicate page of inappropriate type 0
    db_verify: Page 8113: item 0 hashes incorrectly
    db_verify: Page 8113: item 4 hashes incorrectly
    db_verify: Page 8113: item 8 hashes incorrectly
    db_verify: Page 8143: item 40 hashes incorrectly
    db_verify: Page 8143: item 42 hashes incorrectly
    db_verify: Page 8143: item 46 hashes incorrectly
    db_verify: Page 8143: item 60 hashes incorrectly
    db_verify: Page 8143: item 62 hashes incorrectly
    db_verify: Page 39405: hash page has bad prev_pgno
    db_verify: Page 8145: item 4 hashes incorrectly
    db_verify: Page 8145: item 10 hashes incorrectly
    db_verify: Page 8145: item 20 hashes incorrectly
    db_verify: Page 8145: item 22 hashes incorrectly
    db_verify: Page 8145: item 28 hashes incorrectly
    db_verify: Page 8145: item 32 hashes incorrectly
    db_verify: Page 8145: item 38 hashes incorrectly
    db_verify: Page 8145: item 40 hashes incorrectly
    db_verify: Page 8145: item 48 hashes incorrectly
    db_verify: Page 44993: duplicate page of inappropriate type 0
    db_verify: Page 42178: record count incorrect: actual 581, in record 582
    db_verify: Page 40166: btree or recno page is of inappropriate type 13
    db_verify: Page 40166: record count incorrect: actual 0, in record 62
    db_verify: Page 9206: bad record count: has 2909 records, claims 2972
    db_verify: Page 44985: hash page has bad prev_pgno
    db_verify: Page 21250: record count incorrect: actual 494, in record 491
    db_verify: Page 9834: bad record count: has 1076 records, claims 1073
    db_verify: Page 39247: duplicate page of inappropriate type 13
    db_verify: Page 44973: duplicate page of inappropriate type 13
    db_verify: Page 20460: btree or recno page is of inappropriate type 13
    db_verify: Page 20460: record count incorrect: actual 0, in record 9
    db_verify: Page 20390: bad record count: has 4656 records, claims 4665
    db_verify: Page 44696: unterminated leaf chain
    db_verify: Page 43989: record count incorrect: actual 22, in record 21
    db_verify: Page 8917: bad record count: has 604 records, claims 603
    db_verify: Page 44982: hash page has bad prev_pgno
    db_verify: Page 45000: hash page has bad prev_pgno
    db_verify: Page 44981: duplicate page of inappropriate type 13
    db_verify: Page 44990: hash page has bad prev_pgno
    db_verify: Page 38676: record count incorrect: actual 107, in record 106
    db_verify: Page 4486: bad record count: has 689 records, claims 688
    db_verify: Page 39602: record count incorrect: actual 127, in record 129
    db_verify: Page 9202: bad record count: has 709 records, claims 711
    db_verify: Page 21291: record count incorrect: actual 175, in record 176
    db_verify: Page 4585: bad record count: has 757 records, claims 758
    db_verify: Page 44897: record count incorrect: actual 219, in record 95
    db_verify: Page 2259: bad record count: has 3129 records, claims 3005
    db_verify: Page 44987: duplicate page of inappropriate type 0
    db_verify: Page 44979: duplicate page of inappropriate type 13
    db_verify: Page 9055: duplicate page of inappropriate type 13
    db_verify: Page 44980: hash page has bad prev_pgno
    db_verify: Page 44971: duplicate page of inappropriate type 13
    db_verify: Page 39405: hash page referenced twice
    db_verify: Page 44995: duplicate page of inappropriate type 0
    db_verify: Page 38457: hash page has bad prev_pgno
    db_verify: Page 44986: duplicate page of inappropriate type 0
    db_verify: Page 44179: btree or recno page is of inappropriate type 13
    db_verify: Page 44179: record count incorrect: actual 0, in record 582
    db_verify: Page 44999: btree or recno page is of inappropriate type 0
    db_verify: Page 44999: record count incorrect: actual 0, in record 2
    db_verify: Page 4709: bad record count: has 0 records, claims 584
    db_verify: Page 41333: record count incorrect: actual 55, in record 54
    db_verify: Page 9531: bad record count: has 637 records, claims 636
    db_verify: Page 44970: hash page has bad prev_pgno
    db_verify: Page 38400: record count incorrect: actual 132, in record 131
    db_verify: Page 9811: bad record count: has 714 records, claims 713
    db_verify: Page 40735: duplicate page of inappropriate type 13
    db_verify: Page 44996: duplicate page of inappropriate type 0
    db_verify: Page 44998: hash page has bad prev_pgno
    db_verify: Page 44991: hash page has bad prev_pgno
    db_verify: Page 44988: duplicate page of inappropriate type 0
    db_verify: Page 44516: hash page has bad prev_pgno
    db_verify: Page 44976: duplicate page of inappropriate type 13
    db_verify: Page 43273: record count incorrect: actual 289, in record 280
    db_verify: Page 1082: bad record count: has 2035 records, claims 2026
    db_verify: Page 42154: record count incorrect: actual 78, in record 79
    db_verify: Page 18214: bad record count: has 660 records, claims 661
    db_verify: Page 44992: duplicate page of inappropriate type 0
    db_verify: Page 42067: record count incorrect: actual 496, in record 487
    db_verify: Page 2266: bad record count: has 2824 records, claims 2815
    db_verify: Page 43694: record count incorrect: actual 23, in record 26
    db_verify: Page 9294: bad record count: has 605 records, claims 608
    db_verify: SUBID_P1_S1_FF3: DB_VERIFY_BAD: Database verification failed
    After restarting the application, db_stat and db_verify utilities worked fine. Without running db_recover, if these commands are working fine means it is not a genuine case of database corruption.
    Is it something to do with the way in which db_stat and db_verify utilities work?
    We will also try using -h option for db_stat and db_verify utilities.
    Thanks,
    Magesh

  • Need to archive Oracle data into MS Access database

    Gurus,
    I've been tasked with archiving several large tables (10 million records) into an MS Access database. I'm looking through MS Access help guide which states that I can use the ODBC driver to create table, column definitions, and import data.
    Does anyone have any good resources on creating an ODBC driver for MS Access. Also, any reference material would be greatly appreciated.
    Thanks
    Scott

    sreese wrote:
    Gurus,
    I've been tasked with archiving several large tables (10 million records) into an MS Access database. On the face of it, that is an astoundingly bad idea. Using the worst database product (I can't even really refer to it as an RDBMS) on the planet to archive data that is already in the best RDBMS on the planet?
    What does the person who came up with this idea expect to achieve?
    I'm looking through MS Access help guide which states that I can use the ODBC driver to create table, column definitions, and import data. ODBC drivers don't create anything. They provide a common link between ODBC enabled apps and the native db interface.
    >
    Does anyone have any good resources on creating an ODBC driver for MS Access. You don't create the driver. It is provided by either MS or Oracle (they both have them). You just configure a connection definition (aka "Data Source Name" or DSN) that utilizes it.
    Also, any reference material would be greatly appreciated.
    Thanks
    Scott

  • Insert into Microsoft access 2010 Database on sharepoint using OLEDB

    Hi,
    want to insert data into a microsoft access web db using oledb object. but the i am unable to open the database.
        dbLoc = "http://XXXX.com/project/design/Test_Web_DB
        Dim strConnection As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source= " & dbLoc
        Try
                con = New OleDb.OleDbConnection(strConnection)
                If con.State = ConnectionState.Closed Then con.Open()
        Catch ex As OleDbException
               MsgBox("OleDbException: Unable to Open DB")
        End Try
    it always go to the exception. is there any problem with the above code??

    Hey Bala,
    Browsing the link (as shown below) on the browser doesnt open the DB.
    http://XXXX.com/project/design/Test_Web_DB.accdb
    Instead, without ".accdb" works.
    my requirement is something like below, please recommend your suggestion
    1. i have a DB on access 2010, which gets updated on regular basis (currently db is on common location) by different VB.net application client my the network
    2. i want to create various reports out of the data and want them visible available on sharepoint.
    please help
    -Manash

  • Problem updating data into ms access database

    Hi! I need to update a database based on user's entries. But I have a problem with the updating code. Can some1 help? Here is my whole servlet's code :
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    public class editstaff extends HttpServlet
      static Connection link;
      static Statement statement;
      static ResultSet results;
      public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException,ServletException
        response.setContentType("text/HTML");
        PrintWriter out = response.getWriter();
        out.println("<HTML>");
        out.println("<HEAD>");
        out.println("<TITLE>Edit Staff Particulars</TITLE>");
        out.println("</HEAD>");
        out.println("<BR><BR>");
        out.println("<BODY>");
        String staff = request.getParameter("name");
           try
            Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
            link = DriverManager.getConnection("jdbc:odbc:occ","","");
          catch(ClassNotFoundException e)
            System.out.println("Sorry! Unable to load driver. Pls try again later.");
            System.exit(1);
          catch(SQLException e)
            System.out.println("Sorry! Unable to connect to the database. Pls try again later.");
            System.exit(1);
         try
            statement=link.createStatement();
            String select = "SELECT * FROM Staff WHERE Name =  '" + staff+"'";//name taken from html page
             results = statement.executeQuery(select);
            out.println("<table border=1>");
            out.println("<tr>");
            out.println("<th bgcolor=orchid>Name</th>");
            out.println("<th bgcolor=orchid>IC</th>");
            out.println("<th bgcolor=orchid>Staff_ID</th>");
            out.println("<th bgcolor=orchid>Date_Joined</th>");
            out.println("<th bgcolor=orchid>Address</th>");
            out.println("<th bgcolor=orchid>Date_of_Birth</th>");
            out.println("<th bgcolor=orchid>Designation</th>");
            out.println("<th bgcolor=orchid>Driving_License</th>");
            out.println("<th bgcolor=orchid>Mobile</th>");
            out.println("<th bgcolor=orchid>Home_Tel</th>");
            out.println("<th bgcolor=orchid>E-mail</th>");
            out.println("<th bgcolor=orchid>Section</th>");
            out.println("<th bgcolor=orchid>Department</th>");
            out.println("<th bgcolor=orchid>Course</th>");
            out.println("<th bgcolor=orchid>Date_Trained</th>");
            out.println("<th bgcolor=orchid>Recurrent_Date</th>");
            out.println("<th bgcolor=orchid>Proficiency</th>");
            while (results.next())
              out.println("<tr>");
              out.println("<td>");
              out.println(results.getString(1));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(8));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(9));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(16));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(4));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(6));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(10));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(7));
              out.println("</td>");
              out.println("<td>");
              out.println(new Integer(results.getString(2)));
              out.println("</td>");
              out.println("<td>");
              out.println(new Integer(results.getString(3)));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(5));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(17));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(11));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(12));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(13));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(14));
              out.println("</td>");
              out.println("<td>");
              out.println(results.getString(15));
              out.println("</td>");
              out.println("</tr>");
            out.println("</table>");
            out.println("<BR><BR><BR>");
            out.println("<table border=1>");
            out.println("<tr>");
            out.println("<th>Name</th>");
            out.println("<td><input name=nam type=text id=nam></td>");
            out.println("</tr>");
            out.println("<tr>");
            out.println("<th>IC number</th>");
            out.println("<td><input name=ic type=text id=ic></td>");
            out.println("</tr>");
            out.println("<tr>");
            out.println("<th>Staff ID</th>");
            out.println("<td><input name=ID type=text id=ID></td>");
            out.println("</tr>");
            out.println("<tr>");
            out.println("<th>Date Joined</th>");
            out.println("<td>");
            out.println("<select name=jday size=1 id=jday>");
            out.println("<option>1</option>");
            out.println("<option>2</option>");
            out.println("<option>3</option>");
            out.println("<option>4</option>");
            out.println("<option>5</option>");
            out.println("<option>6</option>");
            out.println("<option>7</option>");
            out.println("<option>8</option>");
            out.println("<option>9</option>");
            out.println("<option>10</option>");
            out.println("<option>11</option>");
            out.println("<option>12</option>");
            out.println("<option>13</option>");
            out.println("<option>14</option>");
            out.println("<option>15</option>");
            out.println("<option>16</option>");
            out.println("<option>17</option>");
            out.println("<option>18</option>");
            out.println("<option>19</option>");
            out.println("<option>20</option>");
            out.println("<option>21</option>");
            out.println("<option>22</option>");
            out.println("<option>23</option>");
            out.println("<option>24</option>");
            out.println("<option>25</option>");
            out.println("<option>26</option>");
            out.println("<option>27</option>");
            out.println("<option>28</option>");
            out.println("<option>29</option>");
            out.println("<option>30</option>");
            out.println("<option>31</option>");
            out.println("</select>");
            out.println("<select name=jmth size=1 id-jmth>");
            out.println("<option>January</option>");
            out.println("<option>February</option>");
            out.println("<option>March</option>");
            out.println("<option>April</option>");
            out.println("<option>May</option>");
            out.println("<option>June</option>");
            out.println("<option>July</option>");
            out.println("<option>August</option>");
            out.println("<option>September</option>");
            out.println("<option>October</option>");
            out.println("<option>November</option>");
            out.println("<option>December</option>");
            out.println("</select>");
            out.println("<select name=jyear size=1 id=jyear");
            out.println("<option>2004</option>");
            out.println("<option>2005</option>");
            out.println("<option>2006</option>");
            out.println("<option>2007</option>");
            out.println("<option>2008</option>");
            out.println("<option>2009</option>");
            out.println("<option>2010</option>");
            out.println("<option>2011</option>");
            out.println("<option>2012</option>");
            out.println("<option>2013</option>");
            out.println("<option>2014</option>");
            out.println("</select></td></tr>");
            out.println("<tr><th>Address</th>");
            out.println("<td><textarea name=add id=add></textarea></td></tr>");
            out.println("<tr><th>Date of Birth");
            out.println("<td>");
            out.println("<select name=bday size=1 id=bday>");
            out.println("<option>1</option>");
            out.println("<option>2</option>");
            out.println("<option>3</option>");
            out.println("<option>4</option>");
            out.println("<option>5</option>");
            out.println("<option>6</option>");
            out.println("<option>7</option>");
            out.println("<option>8</option>");
            out.println("<option>9</option>");
            out.println("<option>10</option>");
            out.println("<option>11</option>");
            out.println("<option>12</option>");
            out.println("<option>13</option>");
            out.println("<option>14</option>");
            out.println("<option>15</option>");
            out.println("<option>16</option>");
            out.println("<option>17</option>");
            out.println("<option>18</option>");
            out.println("<option>19</option>");
            out.println("<option>20</option>");
            out.println("<option>21</option>");
            out.println("<option>22</option>");
            out.println("<option>23</option>");
            out.println("<option>24</option>");
            out.println("<option>25</option>");
            out.println("<option>26</option>");
            out.println("<option>27</option>");
            out.println("<option>28</option>");
            out.println("<option>29</option>");
            out.println("<option>30</option>");
            out.println("<option>31</option>");
            out.println("</select>");
            out.println("<select name=bmth size=1 id=bmth>");
            out.println("<option>January</option>");
            out.println("<option>February</option>");
            out.println("<option>March</option>");
            out.println("<option>April</option>");
            out.println("<option>May</option>");
            out.println("<option>June</option>");
            out.println("<option>July</option>");
            out.println("<option>August</option>");
            out.println("<option>September</option>");
            out.println("<option>October</option>");
            out.println("<option>November</option>");
            out.println("<option>December</option>");
            out.println("</select>");
            out.println("<select name=byear size=1 id=byear>");
            out.println("<option>1946</option>");
            out.println("<option>1947</option>");
            out.println("<option>1948</option>");
            out.println("<option>1949</option>");
            out.println("<option>1950</option>");
            out.println("<option>1951</option>");
            out.println("<option>1952</option>");
            out.println("<option>1953</option>");
            out.println("<option>1954</option>");
            out.println("<option>1955</option>");
            out.println("<option>1956</option>");
            out.println("<option>1957</option>");
            out.println("<option>1958</option>");
            out.println("<option>1959</option>");
            out.println("<option>1960</option>");
            out.println("<option>1961</option>");
            out.println("<option>1962</option>");
            out.println("<option>1963</option>");
            out.println("<option>1964</option>");
            out.println("<option>1965</option>");
            out.println("<option>1966</option>");
            out.println("<option>1967</option>");
            out.println("<option>1968</option>");
            out.println("<option>1969</option>");
            out.println("<option>1970</option>");
            out.println("<option>1980</option>");
            out.println("<option>1981</option>");
            out.println("<option>1982</option>");
            out.println("<option>1983</option>");
            out.println("<option>1984</option>");
            out.println("<option>1985</option>");
            out.println("<option>1986</option>");
            out.println("<option>1989</option>");
            out.println("<option>1990</option>");
            out.println("</select></td></tr>");
            out.println("<tr><th>Designation</th>");
            out.println("<td><input name=designation type=text id=designation></td></tr>");
            out.println("<tr><th>Driving License</th>");
            out.println("<td>");
            out.println("<select name=license size=1 multiple=multiple id=license>");
            out.println("<option>Class 3</option>");
            out.println("<option>Class 4</option>");
            out.println("<option>Class 5</option>");
            out.println("</select></td></tr>");
            out.println("<tr><th>Mobile</th>");
            out.println("<td><input name=mobile type=text id=mobile></td></tr>");
            out.println("<tr><th>Home Tel</th>");
            out.println("<td><input name=home type=text id=home></td></tr>");
            out.println("<tr><th>E-mail Address</th>");
            out.println("<td><input name=email type=text id=email</td></tr>");
            out.println("</tr><th>Section</th>");
            out.println("<td>");
            out.println("<select name=section size=1 id=section>");
            out.println("<option>Ramp</option>");
            out.println("<option>Baggage</option>");
            out.println("<option>Service Asisstants</option>");
            out.println("<option>Flight Coordinators</option>");
            out.println("</select></td>");
            out.println("<th>Department</th>");
            out.println("<td>");
            out.println("<select name=dept size=1 id=dept>");
            out.println("<option>PAX</option>");
            out.println("<option>Ramp</option>");
            out.println("<option>Cargo</option>");
            out.println("</select></td>");
            out.println("<th>Course</th>");
            out.println("<td>");
            out.println("<select name=course size=1 multiple=multiple id=course>");
            out.println("<option>Ramp Safety</option>");
            out.println("<option>Dangerous Goods</option>");
            out.println("<option>Security Training</option>");
            out.println("</select></td></tr>");
            out.println("<tr><th>Date Trained</th>");
            out.println("<td>");
            out.println("<select name=tday size=1 id=tday>");
            out.println("<option>1</option>");
            out.println("<option>2</option>");
            out.println("<option>3</option>");
            out.println("<option>4</option>");
            out.println("<option>5</option>");
            out.println("<option>6</option>");
            out.println("<option>7</option>");
            out.println("<option>8</option>");
            out.println("<option>9</option>");
            out.println("<option>10</option>");
            out.println("<option>11</option>");
            out.println("<option>12</option>");
            out.println("<option>13</option>");
            out.println("<option>14</option>");
            out.println("<option>15</option>");
            out.println("<option>16</option>");
            out.println("<option>17</option>");
            out.println("<option>18</option>");
            out.println("<option>19</option>");
            out.println("<option>20</option>");
            out.println("<option>21</option>");
            out.println("<option>22</option>");
            out.println("<option>23</option>");
            out.println("<option>24</option>");
            out.println("<option>25</option>");
            out.println("<option>26</option>");
            out.println("<option>27</option>");
            out.println("<option>28</option>");
            out.println("<option>29</option>");
            out.println("<option>30</option>");
            out.println("<option>31</option>");
            out.println("</select>");
            out.println("<select name=tmth size=1 id=tmth>");
            out.println("<option>January</option>");
            out.println("<option>February</option>");
            out.println("<option>March</option>");
            out.println("<option>April</option>");
            out.println("<option>May</option>");
            out.println("<option>June</option>");
            out.println("<option>July</option>");
            out.println("<option>August</option>");
            out.println("<option>September</option>");
            out.println("<option>October</option>");
            out.println("<option>November</option>");
            out.println("<option>December</option>");
            out.println("</select>");
            out.println("<select name=tyear size=1 id=tyear>");
            out.println("<option>2005</option>");
            out.println("<option>2006</option>");
            out.println("<option>2007</option>");
            out.println("<option>2008</option>");
            out.println("<option>2009</option>");
            out.println("<option>2010</option>");
            out.println("<option>2011</option>");
            out.println("<option>2012</option>");
            out.println("<option>2013</option>");
            out.println("<option>2014</option>");
            out.println("<option>2015</option>");
            out.println("</select></td></tr>");
            out.println("<tr><th>Recurrent Date</th>");
            out.println("<td>");
            out.println("<select name=rday size=1 id=rday>");
            out.println("<option>1</option>");
            out.println("<option>2</option>");
            out.println("<option>3</option>");
            out.println("<option>4</option>");
            out.println("<option>5</option>");
            out.println("<option>6</option>");
            out.println("<option>7</option>");
            out.println("<option>8</option>");
            out.println("<option>9</option>");
            out.println("<option>10</option>");
            out.println("<option>11</option>");
            out.println("<option>12</option>");
            out.println("<option>13</option>");
            out.println("<option>14</option>");
            out.println("<option>15</option>");
            out.println("<option>16</option>");
            out.println("<option>17</option>");
            out.println("<option>18</option>");
            out.println("<option>19</option>");
            out.println("<option>20</option>");
            out.println("<option>21</option>");
            out.println("<option>22</option>");
            out.println("<option>23</option>");
            out.println("<option>24</option>");
            out.println("<option>25</option>");
            out.println("<option>26</option>");
            out.println("<option>27</option>");
            out.println("<option>28</option>");
            out.println("<option>29</option>");
            out.println("<option>30</option>");
            out.println("<option>31</option>");
            out.println("</select>");
            out.println("<select name=rmth size=1 id=rmth>");
            out.println("<option>January</option>");
            out.println("<option>February</option>");
            out.println("<option>March</option>");
            out.println("<option>April</option>");
            out.println("<option>May</option>");
            out.println("<option>June</option>");
            out.println("<option>July</option>");
            out.println("<option>August</option>");
            out.println("<option>September</option>");
            out.println("<option>October</option>");
            out.println("<option>November</option>");
            out.println("<option>December</option>");
            out.println("</select>");
            out.println("<select name=ryear size=1 id=ryear>");
            out.println("<option>2005</option>");
            out.println("<option>2006</option>");
            out.println("<option>2007</option>");
            out.println("<option>2008</option>");
            out.println("<option>2009</option>");
            out.println("<option>2010</option>");
            out.println("<option>2011</option>");
            out.println("<option>2012</option>");
            out.println("<option>2013</option>");
            out.println("<option>2014</option>");
            out.println("<option>2015</option>");
            out.println("</select></td></tr>");   
            out.println("<tr><th>Proficiency</th>");
            out.println("<td><input name=prof type=text id=prof</td></tr>");
            out.println("</table>");
            out.println("<p align=right>");
      out.println("<input type=submit name=submit value=Submit>");
      out.println("<input type=reset name=reset value=Reset>");
      out.println("</p>");
            String nam = request.getParameter("nam");
            String ic = request.getParameter("IC");
            String jday = request.getParameter("jday");
            String jmth = request.getParameter("jmth");
            String jyear = request.getParameter("jyear");
            String mobile = request.getParameter("mobile");
            String home = request.getParameter("home");
            String add = request.getParameter("add");
            String email = request.getParameter("email");
            String day = request.getParameter("day");
            String mth = request.getParameter("mth");
            String year = request.getParameter("year");
            String designation = request.getParameter("designation");
            String dept = request.getParameter("dept");
            String ID = request.getParameter("ID");
            String license = request.getParameter("license");
            String course = request.getParameter("course");
            String tday = request.getParameter("tday");
            String tmth = request.getParameter("tmth");
            String tyear = request.getParameter("tyear");
            String rday = request.getParameter("rday");
            String rmth = request.getParameter("rmth");
            String ryear = request.getParameter("ryear");
            String prof = request.getParameter("prof");
            String sect = request.getParameter("job");
        String dob = ""+day+"-"+mth+"-"+year+"";
        String train = ""+tday+"-"+tmth+"-"+tyear+"";
        String date = ""+jday+"-"+jmth+"-"+jyear+"";
        String recurrent = ""+rday+"-"+rmth+"-"+ryear+"";
            String name = request.getParameter("name");
            String change = "UPDATE Staff  SET Name='"+nam+"',Mobile='"+mobile+"',Home='"+home+"',"
                                    +"Address='"+add+"',E-mail='"+email+"',DOB='"+dob+"',Driving License='"+license+"',IC='"+ic+"',"
                                    +"Staff ID='"+ID+"',Designation='"+designation+"',Department='"+dept+"',Course='"+course+"',"
                                    +"Date Trained='"+train+"',Recurrent Date='"+recurrent+"',Proficiency='"+prof+"',"
                                    +"Date Joined='"+date+"',Section'"+sect+"' WHERE Name='"+name+"'";//name taken from html page
            results = statement.executeQuery(change);
          catch(SQLException e)
            System.out.println("Sorry! Unable to update data. Pls try again later.");
            e.printStackTrace();
            System.exit(1);
          try
              out.println("<br />");
              out.println("</font></BODY>");
              out.println("</HTML>");
              out.flush();
              link.close();
          catch(SQLException e)
            System.out.println("Sorry! Unable to execute query. Pls try again later.");
            e.printStackTrace();
            System.exit(1);
      

    hi,
    For Select Query there is Method executeQuery();
    For insert, update, delete executeUpdate() is use
    so try with executeUpdate()
    and it will return how much row are updated.

  • How to input sound file into MS Access Database, not random folder?

    Hi, I am trying to input a sound file into an MS Access 2000 database, I know it can be copied and pasted into there, but how can u input into the database with a user record, i also need the code to extract it as well as inputting it....at the moment it records the sound and stores it as test.wav on the local drive....
    here is my code for my applet do far....
    compile this file first....
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.*;
    import java.io.IOException;
    import java.io.File;
    import java.net.URL;
    import javax.sound.sampled.DataLine;
    import javax.sound.sampled.TargetDataLine;
    import javax.sound.sampled.AudioFormat;
    import javax.sound.sampled.AudioSystem;
    import javax.sound.sampled.AudioInputStream;
    import javax.sound.sampled.LineUnavailableException;
    import javax.sound.sampled.AudioFileFormat;
    public class VoicePasswordRecorder extends Thread {
         private TargetDataLine m_line;
         private AudioFileFormat.Type m_targetType;
         private AudioInputStream m_audioInputStream;
         private File m_outputFile;
         public VoicePasswordRecorder(TargetDataLine line,
                             AudioFileFormat.Type targetType,
                             File file)
              m_line = line;
              m_audioInputStream = new AudioInputStream(line);
              m_targetType = targetType;
              m_outputFile = file;
         /** Starts the recording.
             (i) The line is started,
              (ii) The thread is started,
         public void start()
              /* Starting the TargetDataLine. It tells the line that
                 data needs to be read from it. If this method isn't
                 called then it won't be able to read data from the line.
              m_line.start();
              /* Starting the thread. This call results in the
                 method 'run()'being called. There, the
                 data is actually read from the line.
              super.start();
         /** Stops the recording.
             Note that stopping the thread is not necessary. Once
             no more data can be read from the TargetDataLine, no more data
             can be read from the AudioInputStream. The method 'AudioSystem.write()'
             (called in 'run()' returns. Returning from 'AudioSystem.write()'
             is followed by returning from 'run()', and then the thread
             stops automatically.
         public void stopRecording()
              m_line.stop();
              m_line.close();
         /** Main working method.
             'AudioSystem.write()' is called.
              Internally, it works like this: AudioSystem.write()
             contains a loop that is trying to read from the passed
             AudioInputStream. Since there is a special AudioInputStream
             that gets data from a TargetDataLine, reading from the
             AudioInputStream leads to reading from the TargetDataLine. The
             data read this way is then written to the passed File. Before
             writing of audio data starts, a header is written according
             to the desired audio file type. Reading continues until no
             more data can be read from the AudioInputStream. In this case,
             it happens if no more data can be read from the TargetDataLine.
             This happens if the TargetDataLine is stopped. Then,
             the file is closed and 'AudioSystem.write()' returns.
         public void run()
                   try
                        AudioSystem.write(
                             m_audioInputStream,
                             m_targetType,
                             m_outputFile);
                   catch (IOException e)
                        e.printStackTrace();
         public static void main(String[] args)
              if (args.length != 1 || args[0].equals("-h"))
                   printUsageAndExit();
              /* There is only one command line argument.
                 This is taken as the filename of the soundfile
                 to store to.
              String     strFilename = args[0];
              File     outputFile = new File(strFilename);
              /* For simplicity, the audio data format used for recording
                 is hardcoded here. The PCM 44.1 kHz, 16 bit signed,
                 stereo was used.
              AudioFormat     audioFormat = new AudioFormat(
                   AudioFormat.Encoding.PCM_SIGNED,
                   44100.0F, 16, 2, 4, 44100.0F, false);
              /* Here, the TargetDataLine is being received. The
                 TargetDataLine is used later to read audio data from it.
                 If requesting the line was successful, it will open it.
              DataLine.Info     info = new DataLine.Info(TargetDataLine.class, audioFormat);
              TargetDataLine     targetDataLine = null;
              try
                   targetDataLine = (TargetDataLine) AudioSystem.getLine(info);
                   targetDataLine.open(audioFormat);
              catch (LineUnavailableException e)
                   out("unable to get a recording line");
                   e.printStackTrace();
                   System.exit(1);
              AudioFileFormat.Type     targetType = AudioFileFormat.Type.WAVE;
              /* The creation of the VoicePasswordRecorder object.
                 It contains the logic of starting and stopping the
                 recording, reading audio data from the TargetDataLine
                 and writing the data to a file.
              VoicePasswordRecorder     recorder = new VoicePasswordRecorder(
                   targetDataLine,
                   targetType,
                   outputFile);
              /* It is waiting for the user to press ENTER to
                 start the recording.
              out("Press ENTER to start the recording.\n");
              try
                   System.in.read();
              catch (IOException e)
                   e.printStackTrace();
              /* Here, the recording is actually started.
              recorder.start();
              out("Recording...\n");
              /* It is waiting for the user to press ENTER,
                 this time to signal that the recording should be stopped.
              out("Press ENTER to stop the recording.\n");
              try
                   System.in.read();
              catch (IOException e)
                   e.printStackTrace();
              /* Here, the recording is actually stopped.
              recorder.stopRecording();
              out("Recording stopped.\n");
         private static void printUsageAndExit()
              out("VoicePasswordRecorder: usage:");
              out("\tjava VoicePasswordRecorder -h");
              out("\tjava VoicePasswordRecorder <audiofile>");
              System.exit(0);
         private static void out(String strMessage)
              System.out.println(strMessage);
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.io.*;
    import javax.sound.sampled.*;
    import javax.swing.*;
    public class AppletTest extends JApplet
        implements ActionListener
        public AppletTest()
            comp = null;
            startrecording = null;
            stoprecording = null;
            recorder = null;
        public void init()
            Panel panel = new Panel(new FlowLayout(1));
            comp = new JTextArea(50, 50);
            comp.setPreferredSize(new Dimension(50, 50));
            comp.setEditable(false);
            JButton startrecording = new JButton("Start");
            JButton stoprecording = new JButton("Stop");
            comp.append("Please record your Voice Password...\n");
            GridBagLayout gridbag = new GridBagLayout();
            GridBagConstraints c = new GridBagConstraints();
            getContentPane().setLayout(gridbag);
            c.weightx = 1.0D;
            c.weighty = 1.0D;
            gridbag.setConstraints(comp, c);
            gridbag.setConstraints(panel, c);
            getContentPane().add(comp, c);
            getContentPane().add(panel, c);
            c.weightx = 0.0D;
            c.weighty = 0.0D;
            startrecording.setEnabled(true);
            stoprecording.setEnabled(true);
            startrecording.addActionListener(this);
            gridbag.setConstraints(startrecording, c);
            getContentPane().add(startrecording, c);
            stoprecording.addActionListener(this);
            gridbag.setConstraints(stoprecording, c);
            getContentPane().add(stoprecording, c);
            int width = 300;
            int height = 200;
            setSize(width, height);
            setVisible(true);
            boolean looping = false;
        public void actionPerformed(ActionEvent ae)
            if(ae.getActionCommand().equals("Start"))
                createRecorder();
                recorder.start();
                System.out.println("Start Button Clicked");
            } else
            if(ae.getActionCommand().equals("Stop"))
                recorder.stopRecording();
                System.out.println("Stop Button Clicked");
        private void createRecorder()
            String strFilename = "C:\test.wav";
            File outputFile = new File(strFilename);
            AudioFormat audioFormat = new AudioFormat(javax.sound.sampled.AudioFormat.Encoding.PCM_SIGNED, 44100F, 16, 2, 4, 44100F, false);
            javax.sound.sampled.DataLine.Info info = new javax.sound.sampled.DataLine.Info(javax.sound.sampled.TargetDataLine.class, audioFormat);
            TargetDataLine targetDataLine = null;
            try
                targetDataLine = (TargetDataLine)AudioSystem.getLine(info);
                targetDataLine.open(audioFormat);
            catch(LineUnavailableException e)
                comp.append("unable to get a recording line\n");
                e.printStackTrace();
                System.exit(1);
            javax.sound.sampled.AudioFileFormat.Type targetType = javax.sound.sampled.AudioFileFormat.Type.WAVE;
            recorder = new SimpleAudioRecorder(targetDataLine, targetType, outputFile);
            comp.append("Press ENTER to start the recording.\n");
            try
                System.in.read();
            catch(IOException e)
                e.printStackTrace();
            comp.append("Recording...\n");
            comp.append("Press ENTER to stop the recording.\n");
            try
                System.in.read();
            catch(IOException e)
                e.printStackTrace();
            comp.append("Recording stopped.\n");
        private JTextArea comp;
        private JButton startrecording;
        private JButton stoprecording;
        private SimpleAudioRecorder recorder;
    }I intend to use this for verifying the username, password and a voice password over the web....as shown in the following code...
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta http-equiv="Content-Language" content="en-us">
    <title>Home Page</title>
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta name="Microsoft Theme" content="artsy 011, default">
    <meta name="Microsoft Border" content="tl, default">
    </head>
    <body background="arttilea.jpg" bgcolor="#000000" text="#FFFFCC" link="#FF9900" vlink="#999900" alink="#669933">
    <!--mstheme--><font face="Arial, Helvetica">
          <p align="left"><font size="4" color="#FFFFFF">Please enter login
          details below:</font></p>
    <form>
    <!--mstheme--></font><table border=0 cellpadding=3 cellspacing=3>
    <tr>
        <td align=right width="74"><!--mstheme--><font face="Arial, Helvetica">
          <p align="left"><font face="Arial, Helvetica, sans-serif"><b><i>Username</i></b></font></p>
        <!--mstheme--></font></td>
        <td width="335"><!--mstheme--><font face="Arial, Helvetica">
          <p align="left"><input type=text
          name=username size="20"></p>
        <!--mstheme--></font></td>
    </tr>
    <tr>
        <td align=right width="74"><!--mstheme--><font face="Arial, Helvetica">
          <p align="left"><font face="Arial, Helvetica, sans-serif"><b><i>Password</i></b></font></p>
        <!--mstheme--></font></td>
        <td width="335"><!--mstheme--><font face="Arial, Helvetica">
          <p align="left">
            <input
            type=password name=password size="20"></p>
          <!--mstheme--></font></td>
      </tr>
      <tr>
        <td align=center width="74"><!--mstheme--><font face="Arial, Helvetica">
          <p align="left"><font face="Arial, Helvetica, sans-serif"><b><i>Voice
          Password Check</i></b></font></p>
        <!--mstheme--></font></td>
        <td width="335"><!--mstheme--><font face="Arial, Helvetica">
           <p align="left">
    <APPLET CODE="AppletTest.class" ALIGN="MIDDLE" WIDTH=272 HEIGHT=38 NAME="AppletTest.class"></APPLET> </p>
        <!--mstheme--></font></td>
      </tr>
    <tr>
        <td colspan=2 align=center><!--mstheme--><font face="Arial, Helvetica">
        <p align="left"><font face="Arial Narrow"><input type=submit value="Enter Website" name="Submit"></font></p>
        <!--mstheme--></font></td>
    </tr>
    </table><!--mstheme--><font face="Arial, Helvetica">
    </form>
          <p align="left">This page was last updated on <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d/%m/%y" startspan -->25/03/04<!--webbot bot="Timestamp" endspan i-checksum="12776" -->.</p>
    <!--mstheme--></font></body>
    </html>I will be very grateful if somebody could help me out....as this is my first time at java programming ....also my first time for using this forum!
    Thanks,
    Regards,
    Mayur Patel

    Hi
    I Learned how to read a file text and Parse as StringTokenizer. But still i don't know how to read the Individual tokens into to database.
    But now i face a new Problem, i am not able to sort it out.
    i am posting my code
    import java.io.FileReader;
    import java.io.FileWriter;
    import java.io.BufferedReader;
    import java.io.PrintWriter;
    import java.io.IOException;
    import java.io.*;
    import java.util.*;
    public class CSVExample {
        public static void main(String[] args) throws IOException {
            BufferedReader inputStream = null;
            PrintWriter outputStream = null;
            try {
                inputStream = new BufferedReader(new FileReader("file.csv"));
              String text;
                 while((text=inputStream.readLine())!= null)
                    StringTokenizer st = new StringTokenizer(text);
                         if(st.hasMoreTokens())
                        System.out.println(st.nextToken());
            } finally {
                if (inputStream != null) {
                    inputStream.close();
    }Here the Problem is The file.csv has got two fields ID, NAME The content of this file is as follows
    T12,MR.RAJ KUMAR
    T13,MR.EARNEST DIES
    T14,MR.MATHEW HYDEN
    Now when i StringTokenize this File The Output printed as follows
    T12,MR.RAJ
    T13,MR.EARNEST
    T14,MR.MATHEW
    That means when it finds the Space it is not printing the Remaining Text.
    Please Help me in this and then Tell me how to INSER The Tokens into the Database Table
    Thank you for your service
    Cheers
    Jofin

  • Access database query resultset in java scriptlet

    Question:
    1) I am Creating a web page and plotting points on the page:
    2) Database query results in decimal values dec_latitude and dec_longiitude.
    3) Perform calculations on lati. & long. in a java scriptlet to create a plot position (xpos, ypos).
    4) Send the xpos and ypos back to the java server page
    5) Use <IMG and absolute positioning to plot the point at position xpos, and ypos.
    6) Repeat until all rows in the query result set have been plotted.
    I don't know how to pass the dec_latitude and dec_longitude to the java scriptlet.
    After the java scriptlet calculation translates the latitude and longitude
    into xpos and ypos, I need to pass the xpos and ypos back to the java server page so that a data point is plotted on a map at position xpos, ypos.
    I tried many ways of doing it but am just guessing as
    to how to pass the data.
    Thanks in Advance. - John
    Here is what I am trying so far .... see snippet below:
    The code below results in a runtime error.
    Am I supposed to create a java object and access that in the java scriptlet? Can the java scriptlet access the latvar and longvar created during the "<c:set var="latvar"... ?
    If not, what mechanisum do I use to access the resulting colums: dec_latitude and dec_longitude? I need the java scriptlet to convert the
    dec_latitude and dec_longitude into a display position based on the number of pixels from the TOP and LEFT (xpos, ypos). Then plot of the data point using the IMG and (xpos, ypos). This will overlay a map whose z-index is lower than the plotted data point.
    *** Query the database ***
    <sql:query var="qryBio">
    SELECT
    DEC_LATITUDE,
    DEC_LONGITUDE,
    ENTRY_TIMESTAMP
    FROM app.biosurvey where
    </sql:query>
    *** for each row retreived from the database ***
    <c:forEach var="row" items="${qryBio.rows}">
    <c:set var="latvar" value="${row.dec_latitude}" scope="page"/>
    <c:set var="longvar" value="${row.dec_longitude} "scope="page" />
    *** java code scriptlet - ***
    *** convert latitude and longitude to xpos and ypos for display ***
    <%
    latitude = (Float)pageContext.getAttribute("latvar"); <--- runtime error !!!!
    longitude = (Float)pageContext.getAttribute("longvar");
    xpos = (int)Math.round(latitude);
    ypos = (int)Math.round(longitude);
    xpos = 1082 - xpos;
    ypos = 700 + ypos;
    pageContext.setAttribute("xpos", xpos);
    pageContext.setAttribute("ypos", ypos);
    %>
    *** plot a point on the display html page overlaying the map ***
    <IMG ID="Row" SRC="smallredbox.jpg" ALT="red box"
    STYLE="position:absolute;
    top:<%=xpos%> px;
    left:<%=ypos%> px;
    z-index:2">
    </c:forEach>

    Thanks
    I still get a runtime error: I translated the code you gave to code below .... which I think is equivalent. See Below: I'm still learning about this stuff so I may not have not translated this properly. Do
    you see what I am doing wrong?
    Best Regards,
    - John
    %@ page language="java" contentType="text/html;
    charset=ISO-8859-1"%>
    <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@ page import="java.lang.Math"%>
    <sql:setDataSource dataSource="jdbc/SampleDB" />
    <c:set var="genus_name" value="${param.genus_name}" />
    <c:set var="species_name" value="${param.species_name}" />
    <c:set var="species_common_name" value="${param.species_common_name}" />
    <c:set var="dd_sighted" value="${param.dd_sighted}" />
    <c:set var="mm_sighted" value="${param.mm_sighted}" />
    <c:set var="yyyy_sighted" value="${param.yyyy_sighted}" />
    <c:set var="species_state" value="${param.species_state}" />
    <c:set var="species_county" value="${param.species_county}" />
    <c:set var="species_country" value="${param.species_country}" />
    <c:set var="dec_latitude" value="${param.dec_latitude}" />
    <c:set var="dec_longitude" value="${param.dec_longitude}" />
    <c:set var="notes" value="${param.notes}" />
    <c:set var="person_first_name" value="${param.person_first_name}" />
    <c:set var="person_last_name" value="${param.person_last_name}" />
    <c:set var="person_street" value="${param.person_street}" />
    <c:set var="person_city" value="${param.person_city}" />
    <c:set var="person_state" value="${param.person_state}" />
    <c:set var="person_zip" value="${param.person_zip}" />
    <c:set var="person_country" value="${param.person_country}" />
    <c:set var="person_email" value="${param.person_email}" />
    <h2>Species Sightings:</h2>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>Breckenridge Citizen Bio-Survey Selective Output Page</title>
    </head>
    <body>
    Izaak Walton League of America
    <h1>Breckenridge Citizen Bio-Survey Selective Output</h1>
    <HR>
    <c:if test="${param.action == 'Submit'}">
    <%int xpos = 0;
         int ypos = 0;
         float latitude = 0.0F;
         float longitude = 0.0F;
         float latitudeMpls = 45.06F;
         float longitudeMpls = -93.14F;                    int xposMpls = 1205 - (int) Math.round(latitudeMpls);
         int yposMpls = 735 + (int) Math.round(longitudeMpls);
    %>
    <IMG SRC="minnesota_1990.jpg" ALT="minesota map" style="z-index:1;"> <----- THIS WORKS FINE
    <IMG ID="Row" SRC="smallredbox.jpg" ALT="red box"
    STYLE="position:absolute;
    top:<%=xposMpls%> px;
    left:<%=yposMpls%> px;
    z-index:2"> <----- THIS WORKS FINE FOR HARDCODED MPLS XPOS AND YPOS
    <sql:query var="qryBio">
    SELECT
    PERSON_FIRST_NAME,
    PERSON_LAST_NAME,
    GENUS_NAME,
    SPECIES_NAME,
    SPECIES_COMMON_NAME,
    SPECIES_COUNTY,
    SPECIES_STATE,
    SPECIES_COUNTRY,
    DD_SIGHTED,
    MM_SIGHTED,
    YYYY_SIGHTED,
    DEC_LATITUDE,
    DEC_LONGITUDE,
    NOTES,
    ENTRY_TIMESTAMP
    FROM app.biosurvey where
    genus_name like rtrim(upper('${genus_name}')) AND
    species_name like rtrim(upper('${species_name}')) AND
    species_common_name like rtrim(upper
    ('${species_common_name}')) AND
    species_state like rtrim(upper('${species_state}')) AND
    species_county like rtrim(upper('${species_county}')) AND
    species_country like rtrim(upper('${species_country}')) AND
    person_first_name like rtrim(upper('${person_first_name}')) AND
    person_last_name like rtrim(upper('${person_last_name}')) AND
    person_email like rtrim(upper('${person_email}'))
    </sql:query>
    <c:forEach var="row" items="${qryBio.rows}">
    <--- THE LINE ABOVE WORKS FINE --->
    <c:set var="latvar" value="${row.dec_latitude}" scope="page" />
    <c:set var="longvar" value="${row.dec_longitude} " scope="page" />
    <%
    latitude =
    Float.parseFloat((String)pageContext.getAttribute("latvar"));
    <--- RUNTIME ERROR OCCURS HERE --- SEE LINE ABOVE --->
    longitude =
    Float.parseFloat((String)pageContext.getAttribute("longvar"));
    xpos = (int) Math.round(latitude);
    ypos = (int) Math.round(longitude);
    xpos = 1082 - xpos;
    ypos = 700 + ypos;
    request.setAttribute("xpos",new Integer(xpos));
    request.setAttribute("ypos",new Integer(ypos));
    %>
    IIMG ID="Row" SRC="smallredbox.jpg" ALT="red box"
    STYLE="position:absolute;
    top:<%=xpos%> px;
    left:<%=ypos%> px;
    z-index:2">
    <--- THIS (ABOVE) WORKS FINE WITH CORRECT VALUES FOR XPOS AND YPOS WHEN RUNTIME ERROR DOES NOT OCCUR --->
    </c:forEach>
    </c:if>

  • SSIS - Insert into two different databases, with one Connection Manager

    I need to use one Connection Manager for a flat file, and one Connection Manager to SQL, to do the following.
    Read from flat file to database X
    Select from database X and Insert to database Y
    Both databases are on the same instance/server.
    I see that the OLE DB Destination Editor has a SQL Command option, although I can't find instructions on how to use it for an insert.
    Or is there anyway to accomplish what I need??
    Thanks!
    -Al H

    If X and Y are on different servers, you can possibly use a single OLEDB connection if the servers are already linked, as in Linked Servers. Then you can use an Execute SQL Task for an INSERT...SELECT using four-part naming convention i.e. [Server].[Database].[Schema].[Object]
    If both X and Y are on the same server then you can use a single connection and use three-part naming convention i.e. [Database].[Schema].[Object] in your INSERT statement.
    Otherwise you can plan to have three connections -
    Flat File connection for the text file
    OLEDB connection for database X
    OLEDB connection for database Y
    1 and two to load the text file to X. Then 2 and 3 to move data from X to Y.
    - Aalamjeet Rangi | (Blog)

  • Inserting date in access database

    /String text1=date.getText();
              Calendar c1=new GregorianCalendar(Integer.parseInt(text1.substring(6)),Integer.parseInt(text1.substring(3,5))-1,Integer.parseInt(text1.substring(0,2)));
              java.sql.Date d1=new java.sql.Date(c1.getTime().getTime());
              JOptionPane.showMessageDialog(this,d1.toString());
              PreparedStatement s=DataSource.getConnection("RealFotoInc").prepareStatement("update Transaction set date={d,?} where envelopNumber='"+envNumber+"'");
              s.setDate(1,d1);
              s.execute();I tried the above code and it tells me error in ur insert to statement and it is been like that for a longtime I have tried manythings no way]

    "update Transaction set date={d,?} where envelopNumber='"+envNumber+"'"You should use "update Transaction set [date]=? where envelopNumber='"+envNumber+"'"

Maybe you are looking for