SQL Syntax for Access database

This pertains to LV only due to the fact that LV requires a slightly different syntax for SQL statements for use with Access than what you will see in the Access Queries SQL view.  For instance, I discovered that if you use a  ?  for a character placeholder  (can be any single character) in Access, you need to use an  _  (underscore)  for this feature.  I also discoverd that you use a % sign instead of an *  (asterisk) for any number of characters.
The lat thing I am having trouble with is specifying a range of characters that could be in a certain position in the text field.  For instance, if the first character can be only an alpha between  A and Z, and the next two characters can be numbers anywhere from 1 to 12,  I would use   LIKE "[A-Z][1-12]*"      In LV, the double quotes are are replaced with single quotes but I cannot figure out what to replace the brackets with. 
The brackets do not return a syntax error but also do not return any results that should fit the pattern.
I have tried parenthesis, double quotes, using a TO in place of the dash, etc.
Any input on this is very much appreciated.
Doug
I guess sometimes writing the problem out helps one deduce the answer by taking a closer look at what has been tried and what has not.
So  LIKE "[A-Z][1-12]*"   in Access will be   LIKE ('[A-Z][01-12]%')  in LV.    I hadn't tried the pecent sign in place of the asterisk using the brackets.    Too bad this stuff isn't spelled out in detail somewhere.
Doug
"My only wish is that I am capable of learning each and every day until my last breath."

Thanks Danubio for the links.  The one for the SQL utility may be helpful as I go forward.
Mike,  yes I am using the connectivity toolkit.  It's what I cut my teeth on and up to this point, has not caused me any issues.   I rarely make changes after implementation but if I do, the use of typedef's keeps it pretty painless.  A brief read on the doc included in your referenced zip file confirms there are alternate methods to talks to the database tables  (I am not a one table programmer).  When time permits, I will do some trials and if warranted, will try some of your techniques at some point.  Simply not enough time currently.
As I posted intially, I actually solved my problem before there were any replies and included my solution in the first post.  Why there is a syntax difference going from LV to an mdb is an unknown to me but it exists nonetheless.
Thanks for the input on this
Doug
"My only wish is that I am capable of learning each and every day until my last breath."

Similar Messages

  • The syntax for accessing MS SQL db from JSP

    Can anybody help me with the syntax for accessing MS SQL db from JSP???
    This is what I do when I use MySQL:
    Class.forName( "org.gjt.mm.mysql.Driver" );
    Connection conn = DriverManager.getConnection(
         "jdbc:mysql:://um" ,
    What do I write when it is MS SQL and where do I install the driver
    BR Soren

    Can anybody help me with the syntax for accessing MS
    SQL db from JSP???
    This is what I do when I use MySQL:
    Class.forName( "org.gjt.mm.mysql.Driver" );
    Connection conn = DriverManager.getConnection(
    "jdbc:mysql:://um" ,
    What do I write when it is MS SQL and where do I
    install the driver
    BR Soren
    One way of doing this is to use ODBC. Here's an example:
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection conn = DriverManager.getConnection("jdbc:odbc:<odbc name>", "<login>", "<password>");

  • SQL mirroring for CMS database

    I don't think SQL mirroring for CMS database is supported. anybody has any information onthis?

    This is error ...
    Database-level error reported by JDBC driver while executing statement 'UPDATE
    CLIARC SET CLICL3 = 0 WHERE clicl1 = 10'. The JDBC driver returned the following error message: 'java.sql.SQLException: CLIARC en PROXL07 de tipo *FILE no encontrado. Causa . . . . . : CLIARC en PROXL07 tipo *FILE no se ha encontrado. Si se trata de una sentencia ALTER TABLE y el tipo es *N, no se ha encontrado una restricción o partición. Si no se trata de una sentencia ALTER TABLE y el tipo es *N, no se ha encontrado una función, procedimiento o desencadenante. Si no se ha encontrado una función, CLIARC es el programa de servicio que contiene la función. La función no se encontrará si el nombre externo y el nombre de uso no coinciden exactamente. Examine en las anotaciones de trabajo para ver si encuentra un mensaje que dé más detalles sobre el nombre de función que se está buscando y el nombre que no coincide. Recuperación . : Cambie el nombre y vuelva a intentar la petición. Si el objeto es un grupo de nodos, asegúrese de que el producto DB2 Multisystem está instalado en el sistema y cree un grupo de nodos con el mandato CL CRTNODGRP. Si no se ha encontrado la función externa, asegúrese de que las mayúsculas y minúsculas del EXTERNAL NAME en la sentencia CREATE FUNCTION coinciden exactamente con las mayúsculas y minúsculas del nombre exportado por el programa de servicio.'. For details, contact your database server vendor. 
    The sentences in using are following:
    Query Sql Statement: select clicl2  from proxl.cliarc where clicl1 = 10
    Update Sql Statement: UPDATE CLIARC SET CLICL3 = 0  WHERE clicl1 = 10
    Tks for your help anybody

  • Thin driver for Access Database

    Hi Guys,
    I want to know the exact thin JBBC driver for access database,
    For oracle we have "jdbc:oracle:thin:@host:port:sid" driver, I need the similar type of driver for Access,
    Where can I find
    Thanks

    let me be a bit more descriptive..
    there's no free, publicly available type 3 or 4 driver for Access.
    However, if you want to buy one, take a look at this URL: http://industry.java.sun.com/products/jdbc/drivers .
    It'll help you identify third-party vendors who sell what you're looking for...
    Larry

  • What is the proper SQL syntax for dates input as variable

    Hello,
    I am working on an ASP JavaScript page that requests totals
    from an Access database for a specific date range. I can write the
    SQL statement to query the DB and get the results I need using the
    WHERE statement below.
    ...WHERE LABOR_DATE BETWEEN #7/15/2006# AND #7/18/2006# GROUP
    BY [LABOR].[JOB_NUMBER_NAME]
    I have another page that I want to pass two variables in
    Dreamweaver specifying the date range varBeginDate and varEndDate
    and query the database using the date range input by the user.
    What is the correct syntax for replacing the actual dates in
    the example above with my variable values?

    Short answer - you can't. There's no automatic link between file paths and mounting servers. There are lots of valid reasons for this (e.g. preventing malicious links from automatically opening files from remote servers), but you can get there in a controlled environment.
    You can configure Automounts on any directory. That way whenever any application tries to access a particular path the OS will automatically mount the directory, but it needs to be told in advance which directories (and which servers) to mount.
    For example, if you'd configured your iTunes Library to be saved at /mnt/itunes and it's served from afp://mediaserver.your.net/path/to/itunes you would configure an automount to mount the AFP server at /mnt/itunes.
    Since its an automount, the OS wouldn't mount the server until some process tried to read /mnt/itunes.
    There are several ways of specifying automounts, and for each there are several tutorials online that walk you through the process. Try Mike Bombich's site for a starter.

  • Problems with Dynamical SQL Querys on Access Databases!

    This thread is for everyone who has the same problems like me.
    I tried to change SQL-Querys via Javascript to fill in my PDF sheet some data from my database.
    But whenever I want to change the Query, I never get some data back.
    The main problem was:
    THE ACCESS DATABASE
    Access has locked the database whenever I tried to run the Query.
    Now Iam using MySQL and everything is working fine.

    This thread is for everyone who has the same problems like me.
    I tried to change SQL-Querys via Javascript to fill in my PDF sheet some data from my database.
    But whenever I want to change the Query, I never get some data back.
    The main problem was:
    THE ACCESS DATABASE
    Access has locked the database whenever I tried to run the Query.
    Now Iam using MySQL and everything is working fine.

  • SQL command for two databases

    I am attempting to write a SQL command for a Crystal report that links tables from two different databases, both of them Progress databases.I keep getting syntax errors that the table from the other db (meaning not the one I opened in DB Expert) can't be found. If someone has experience with Progress or otherwise has any ideas it would be greatly appreciated.

    I'm not familiar with Progress, but does it have something like MS SQL's OPENQUERY using Linked Servers (which allows you to query a different DB server from the one you're connected to)?  If not, you'll probably have to use two different SQL Commands to base the report on, then use Crystal to link the returned data sets.  (I'm assuming "a different database" means "a different database server", not a different database on the same server instance...)
    HTH,
    Carl

  • Do we need run catbundle.sql file for new databases.

    dear all,
    i have doubt over execution of catbundle.sql or not?
    scenario:
    i have insatlled 10gr2 on rhel5 and applied patchset 4 (10.2.0.5) and applied Oracle® Database Patch 10248542 - 10.2.0.5.2 Patch Set Update
    after this i have create fresh database.
    now,
    in Oracle® Database Patch 10248542 - 10.2.0.5.2 Patch Set Update document it has specified in belwo section
    3.4 Post Installation Instructions for Databases Created or Upgraded after Installation of PSU 10.2.0.5.2 in the Oracle Home
    These instructions are for a database that is created or upgraded after the installation of PSU 10.2.0.5.2.
    You must execute the steps in Section 3.3.2, "Loading Modified SQL Files into the Database" for any new database only if it was created by any of the following methods:
    Using DBCA (Database Configuration Assistant) to select a sample database (General, Data Warehouse, Transaction Processing)
    Using a script that was created by DBCA that creates a database from a sample database
    Cloning a database that was created by either of the two preceding methods, and if the steps in Section 3.3.2, "Loading Modified SQL Files into the Database" were not executed after PSU 10.2.0.5.2 was applied
    Upgraded databases do not require any post-installation steps.
    so do we need to run catbundle here or not.
    since i have created fresh database after applying 10.2.0.5 PSU2 why does it required.
    opatch output:
    [oracle@RG615 ~]$ opatch lsinventory
    Invoking OPatch 10.2.0.5.1
    Oracle Interim Patch Installer version 10.2.0.5.1
    Copyright (c) 2010, Oracle Corporation. All rights reserved.
    Oracle Home : /prd/crm/swbcrmdb/usr/oracle/product/10.2.0/db_1
    Central Inventory : /prd/crm/swbcrmdb/usr/oracle/oraInventory
    from : /etc/oraInst.loc
    OPatch version : 10.2.0.5.1
    OUI version : 10.2.0.5.0
    OUI location : /prd/crm/swbcrmdb/usr/oracle/product/10.2.0/db_1/oui
    Log file location : /prd/crm/swbcrmdb/usr/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch2011-05-03_11-41-34AM.log
    Patch history file: /prd/crm/swbcrmdb/usr/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/opatch_history.txt
    Lsinventory Output file location : /prd/crm/swbcrmdb/usr/oracle/product/10.2.0/db_1/cfgtoollogs/opatch/lsinv/lsinventory2011-05-03_11-41-34AM.txt
    Installed Top-level Products (2):
    Oracle Database 10g 10.2.0.1.0
    Oracle Database 10g Release 2 Patch Set 4 10.2.0.5.0
    There are 2 products installed in this Oracle Home.
    Interim patches (1) :
    Patch 10248542 : applied on Tue May 03 07:32:29 BST 2011
    Unique Patch ID: 13292123
    Created on 25 Dec 2010, 23:11:24 hrs PST8PDT
    Bugs fixed:
    6402302, 9713537, 8350262, 9949948, 8394351, 10327179, 8546356, 9711859
    9714832, 9952230, 10248542, 8544696, 9963497, 9772888, 8664189, 10249537
    7519406, 9952270, 8277300, 9726739
    OPatch succeeded.

    Pl post the output of view DBA_REGISTRY_HISTORY - see MOS Doc 605795.1 (Introduction To Oracle Database catbundle.sql)
    Was the database created using DBCA or manually using scripts ?
    Srini

  • SQL Syntax for hour/date range in Query

    Hi
    I am trying to set up an query for sales order documents procesed in the last 30 minutes to be set as an alert to be run every 30 minutes to the sales manager.  I am having difficulty getting the syntax for the last 30 minutes
    Any suggestions?
    David

    hi,
    I'm not sure query is correct,but u can modify it futher to get correct one.
    SELECT T0.DocNum, T0.DocDate, T0.CardName, T0.DocTotal FROM ORDR T0 WHERE DateDiff(dd, T0.DocDate ,getdate()) = 0 and
    DateDiff(Minute,T0.DocTime,' ') <= 30
    Jeyakanthan

  • Access vs. SQL Server for online database

    I have a client who insisted on using Access for his online
    database because he wanted to be able to download it quickly and
    easily to be able to manipulate data on his end. However, after
    importing about 20 thousand records into his existing database,
    he's not happy with the speed at which it's now processing searches
    - the search criteria and underlying queries are very complicated
    to begin with. We had the SQL Server discussion previously, but he
    wanted to keep it in Access. So, my question is...how much faster
    can SQL Server process data over Microsoft Access? Will the results
    be significant enough to justify converting the database to SQL
    Server? Would his data process faster if he was on a dedicated
    server instead of a shared server? Thanks!

    If you can get away with using 3 digit zip code areas for
    some of your partners, that might cut down on the total number of
    records in your database. Also, in addition to indexing, indexing,
    indexing, be aware that the "distinct" keyword is a pretty big
    resource hog as well. Might be best to stay away from that one.
    Not sure if I remember if Access supports stored procedures
    or not, but any queries that you can precompile on the database
    side will speed things up a bit.
    Of course, you could just explain to him that downloading a
    20,000 record access file, waiting for it to finish, editing it,
    uploading it back to the server, and waiting for it to finish is
    not exactly a very effective work flow. You could switch everything
    over to MS SQL and then just give him a bound data grid into the
    data in CF if he really wants to manipulate the records like that.
    But then again, I know how these things go. My
    condolences.

  • SQL syntax for expert little help Access 2013

    Hi
    working example SQL local machine
    strData= "SELECT DISTINCT Detail, FamCode as Fam FROM Mat_Family ORDER BY FamCode" 
    cmbMatFam.RowSource=strData                                                                                                                                                                             
    working example SQL server machine (other computer)           
    Public Const ServerConnectionWith_RawMaterial_LV
    As  String=  
     "[ODBC;Description=Live;DRIVER=SQLServer;SERVER=SERVER;UID=Name;PWD=Password;DATABASE=RawMaterial_LV]." 
    strData= "SELECT DISTINCT Detail, FamCode as Fam FROM " &
    ServerConnectionWith_RawMaterial_LV & "Mat_Family ORDER BY FamCode"
    cmbMatFam.RowSource = strData
    working example SQL local machine
     strData = "SELECT Material_M.M_Code, Material_M.Family_Code, ISNULL(z_TotalBars.Bars, 0) AS tBars, ISNULL(z_TotalRes.rBars, 0) AS rBars, "
          strData = strData & "ISNULL(z_TotalBars.Bars, 0) - ISNULL(z_TotalRes.rBars, 0) AS Bal, Material_M.Material_Fam, Material_M.Type, Material_M.Series, "
          strData = strData & "Material_M.Specific, Material_M.Hardness, Material_M.BarLength, Material_M.Density, Material_M.cPound_Ft, Material_M.cPrice_Pound,"
          strData = strData & "Material_M.cPound_Bar, Material_M.cPrice_Bar, Material_M.cPrice_Date , Material_M.Description "
          strData = strData & "FROM Material_M LEFT OUTER JOIN z_TotalRes ON Material_M.M_Code = z_TotalRes.M_Code LEFT OUTER JOIN "
          strData = strData & "z_TotalBars ON Material_M.M_Code = z_TotalBars.M_Code "
          strData = strData & "WHERE (Material_M.Family_Code = '" & cmbMatFam.Column(1) & "') AND (ISNULL(z_TotalBars.Bars, 0) > 0)"
      Form_frmMaterialLookup.RecordSource = strData
    NOT working example SQL server machine (other computer)  ??????
     strData = "SELECT Material_M.M_Code, Material_M.Family_Code, ISNULL(z_TotalBars.Bars, 0) AS tBars, ISNULL(z_TotalRes.rBars, 0) AS rBars, "
          strData = strData & "ISNULL(z_TotalBars.Bars, 0) - ISNULL(z_TotalRes.rBars, 0) AS Bal, Material_M.Material_Fam, Material_M.Type, Material_M.Series, "
          strData = strData & "Material_M.Specific, Material_M.Hardness, Material_M.BarLength, Material_M.Density, Material_M.cPound_Ft, Material_M.cPrice_Pound, "
          strData = strData & "Material_M.cPound_Bar, Material_M.cPrice_Bar, Material_M.cPrice_Date , Material_M.Description "
          strData = strData & "FROM  " &
    ServerConnectionWith_RawMaterial_LV
    & "Material_M LEFT OUTER JOIN z_TotalRes ON Material_M.M_Code = z_TotalRes.M_Code LEFT OUTER JOIN "
          strData = strData & "z_TotalBars ON Material_M.M_Code = z_TotalBars.M_Code "
          strData = strData & "WHERE (Material_M.Family_Code = '" & cmbMatFam.Column(1) & "') AND (ISNULL(z_TotalBars.Bars, 0) > 0)"
      Form_frmMaterialLookup.RecordSource = strData
    Error Message
      Syntax error (missing operator) in query expression 'Material_M.MCode= z_TotalRes.M_Code LEFT OUTHER JOIN z_TotalBars ON Material_M.M_Code = z_TotalBars.M_Cod
    Usually I just add                   "
    & ServerConnectionWith_RawMaterial_LV & "                                              
    to a SQL statement and it works,but not this time
    (Tables  Material_M,         z_TotalRes,             z_TotalBars             are in RawMaterial_LV
    Database)
    Appreciate any suggestion Thanks

    parenthesis did the job, now adding
    "WHERE (ISNULL(z_TotalBars.Bars, 0) > 0) AND (Material_M.Family_Code = 'BZ')"
    Tested working Query
    SELECT Material_M.M_Code, Material_M.Family_Code, Material_M.Material_Fam, Material_M.Type,
    Material_M.Series,
    Material_M.Specific, Material_M.Hardness, Material_M.BarLength, Material_M.Density,
    Material_M.cPound_Ft, Material_M.cPrice_Pound,
    Material_M.cPound_Bar, Material_M.cPrice_Bar, Material_M.cPrice_Date
    , Material_M.Description
    FROM
    ([ODBC;Description=Live;DRIVER=SQL Server;SERVER=DSERVER;UID=Super;PWD=Deco2014$;DATABASE=RawMaterial_LV].Material_M
    LEFT OUTER JOIN
    [ODBC;Description=Live;DRIVER=SQL Server;SERVER=DSERVER;UID=Super;PWD=Password;DATABASE=RawMaterial_LV].z_TotalRes
    ON Material_M.M_Code = z_TotalRes.M_Code)                                                                                            
    LEFT OUTER JOIN
    [ODBC;Description=Live;DRIVER=SQL Server;SERVER=DSERVER;UID=Super;PWD=Password;DATABASE=RawMaterial_LV].z_TotalBars
    ON Material_M.M_Code = z_TotalBars.M_Code
    Not working Query
    SELECT Material_M.M_Code, Material_M.Family_Code, Material_M.Material_Fam, Material_M.Type,
    Material_M.Series,
    Material_M.Specific, Material_M.Hardness, Material_M.BarLength, Material_M.Density,
    Material_M.cPound_Ft, Material_M.cPrice_Pound,
    Material_M.cPound_Bar, Material_M.cPrice_Bar, Material_M.cPrice_Date
    , Material_M.Description
    FROM
    ([ODBC;Description=Live;DRIVER=SQL Server;SERVER=DSERVER;UID=Super;PWD=Deco2014$;DATABASE=RawMaterial_LV].Material_M
    LEFT OUTER JOIN
    [ODBC;Description=Live;DRIVER=SQL Server;SERVER=DSERVER;UID=Super;PWD=Password;DATABASE=RawMaterial_LV].z_TotalRes
    ON Material_M.M_Code = z_TotalRes.M_Code)                                                                                            
    LEFT OUTER JOIN
    [ODBC;Description=Live;DRIVER=SQL Server;SERVER=DSERVER;UID=Super;PWD=Password;DATABASE=RawMaterial_LV].z_TotalBars
    ON Material_M.M_Code = z_TotalBars.M_CodeWHERE (ISNULL(z_TotalBars.Bars, 0) > 0) AND (Material_M.Family_Code = 'BZ')
    Message Error
    Wrong number of arguments used with function in query expression '(ISNULL(z_TotalBars.Bars, 0) > 0) AND (Material_M.Family_Code = 'BZ')
    Works this way
    WHERE (z_TotalBars.Bars > 0) AND (Material_M.Family_Code = 'BZ')

  • Using SSIS for Access Database

    I have a Database in Access and I want extract data from this database into SQL Server 2008 R2 using SSIS. Then i want to use Analysis Services for Facts and Dimension Tables. Then i want to load the extracted data into a web application and want to use
    Reporting Services for reports. Can anybody help me in SSIS and Analysis Services and Reporting Services?

    Ok just help me, I want to extract data from single table of access given below and then i want to make facts and dimension tables . Kindly help me in populating these fact and dimension tables using Analysis Services.
    ConsumerID
    ReferenceNo
    OldAccountNo
    Name
    RelationWith
    RelationwithName
    Address
    ConnectionDate
    RegionType
    Circle
    Division
    SubDivision
    Feeder
    GridStation
    Company
    Tariff
    Load
    PresentReading
    PreviousReading
    UnitsConsumed
    CostofElectricity
    ElectricityDuty
    PTVFee
    GST
    IncomeTax
    ExtraTax
    FurtherTax
    NJSurcharge
    FPAMonth
    FPA
    GSTonFPA
    ITonFPA
    EDonFPA
    Arrears
    Installment
    Subsidies
    TotalFPA
    CurrentBill
    LPSurcharge
    PayableWithinDueDate
    PayableAfterDueDate
    BillingMonth
    DueDate
    1
    1242
    4242
    Nasir
    S/o
    Mohiuddin
    Hyderabad
    01-Jan-07
    Urban
    Hyderabad-I
    Garikhata
    Garikhata
    JAMSHORO 1
    66KV DIGRI
    HESCO
    A2(a)
    4
    7000
    5000
    2000
    32000
    480
    60
    5521.6
    200
    Jul-08
    45
    7.65
    0.675
    53
    38262
    3248
    38315
    41563
    Jan-09
    03-Jan-09
    2
    1234
    1234
    Kashif
    S/o
    Mohsin
    Jamshoro
    01-Jan-09
    Urban
    Hyderabad-II
    Garikhata
    Garikhata
    AMRI (SHAL.) 1
    66KV TANDO GHULAM ALI
    HESCO
    A1(a)
    1.75
    451
    400
    51
    295.29
    4.42935
    35
    50.9522895
    5.1
    Jul-08
    45
    7.65
    0.675
    53
    391
    30
    444
    474
    Jan-09
    03-Jan-09
    3
    1235
    1235
    Afzal
    S/o
    Mohsin1
    Jamshoro
    01-Jan-09
    Urban
    Hyderabad-II
    M.P.Khas .
    Liaquat Colony
    HALA ROAD 3
    132KV SAMARO
    HESCO
    A1(a)
    1.8
    250
    50
    200
    1622
    24.33
    35
    279.8761
    20
    Jul-08
    45
    7.65
    0.675
    53
    1981
    165
    2034
    2199
    Jan-09
    03-Jan-09
    4
    1236
    1236
    Akbar
    S/o
    Basit
    jamshoro
    01-Jan-10
    Urban
    Hyderabad-I
    Digri
    Hali Road
    HALA ROAD 11
    132KV JHIMPIR
    HESCO
    A1(a)
    1.95
    801
    500
    301
    3711.33
    55.66995
    35
    640.3899915
    30.1
    Jul-08
    45
    7.65
    0.675
    53
    4472
    377
    4525
    4902
    Jan-09
    03-Jan-09
    5
    1237
    1237
    Qaisar
    S/o
    Nazeer
    Hyderabad
    01-Jan-08
    Urban
    Hyderabad-I
    Kotri
    Samaro
    HYD N.P.T.S. 11
    132KV MIRPUR KHAS
    HESCO
    A1(a)
    2
    750
    700
    50
    289.5
    4.3425
    35
    49.953225
    5
    Jul-08
    45
    7.65
    0.675
    53
    384
    29
    437
    466
    Jan-09
    03-Jan-09

  • Cannot connect and run query for Access database

    Hi,
    I have a html file and a servlet file which contains code to connect to a database. I also have a sales database with customer table along with other tables in Access. I have created a DSN in Windows named sales which connects to the sales database. Now, when I am running the html form, the servlet does not run the query "Select * from Customer". It seems it cannot make any connection to the database.
    Any help is appreciated. I am very new to JDBC technology. Thanks.
    HTML FORM CODE:
    <html>
    <head><title>Sales</title></head>
    <body>
    <form action="http://localhost:8100/servlet/SalesServlet" method=POST>
    <strong>Select:</strong>
    <textarea cols=50 rows=8 name=select></textarea><p>
    <input type=submit value="Query">
    <input type=reset>
    </form></body></html>
    SALESSERVLET CODE:
    //Copyright (c) 2000, Art Gittleman
    //This example is provided WITHOUT ANY WARRANTY either expressed or implied.
    /* Queries the Sales database. Needs to be modified
    * to use metadata to correctly output the result set.
    import java.io.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.sql.*;
    import sun.jdbc.odbc.JdbcOdbcDriver;
    public class SalesServlet extends HttpServlet {
    Connection con;
    Statement stmt;
    public void init(ServletConfig sc) throws ServletException {
    super.init(sc);
    try{
    new JdbcOdbcDriver();
    String url = "jdbc:odbc:Sales";
    String user = "";
    String password = "";
    con = DriverManager.getConnection(url, user, password);
    stmt = con.createStatement();
    }catch (Exception e) {
    e.printStackTrace();
    System.exit(1);
    public void doGet(HttpServletRequest req,
    HttpServletResponse resp)
    throws ServletException, IOException {
    resp.setContentType("text/html");
    PrintWriter out = resp.getWriter();
    try{
    String query = req.getParameter("select");
    ResultSet rs = stmt.executeQuery(query);
    ResultSetMetaData rsMetaData = rs.getMetaData();
    int cols = rsMetaData.getColumnCount();
    while(rs.next()) {
    String s = "";
    for(int i=1; i<=cols; i++)
    s += rs.getString(i) + ' ';
    s += "<br>";
    out.println(s);
    }catch(Exception e) {
    e.printStackTrace();
    out.close();
    public void doPost(HttpServletRequest req,
    HttpServletResponse resp)
    throws ServletException, IOException {
    doGet(req,resp);
    }

    String url = "jdbc:odbc:Sales";
    String user = "";
    String password = "";
    con = DriverManager.getConnection(url, user, password);This might be causing your problem, but not sure. Since you don't need a username or password for the ODBC connection, you can just use
    con = DriverManager.getConnection(url);
    The username and password aren't needed, so you can just use the above call instead. Perhaps the ODBC is trying to find a user called "" with a password "" and puking on itself, who knows... but you should post whatever exceptions or specific problems you're having that make you think you're not connecting.

  • Is this syntax for oracle database?

    Does the syntax below indicates that the developer is using oracle database?
    PreparedStatement updt = db.prepareStatement("insert into tablename values (?, ?, ?, ?, ?)");
    updt.setInt(1, number);
    updt.setInt(2, 1);
    updt.setString(3, staffName);
    updt.setString(4, description);
    updt.setDate(5, today);

    Oh...
    but when I use microsoft access, it didn't seems to work
    error is:
    SQL data type out of array
    the PreparedStatement and it's associate syntax don't work with ODBC?

  • Facing permission problem for accessing database

    {color:#0000ff}Hello All,
    I have just started in this forum. I am very new to j2me and facing problem and I need your help.
    I had successfully signed the application and it was working properly on device. Next I added login module in my application where I am accessing a PHP from server which is having MySQL DB connection for usercheck. When I try with unsigned jar it works properly and when I try using signed jar it is showing me wrong username/password. I think it is midlet permission problem.
    It would be very nice if someone can tell me what might be the possibilities that it is going wrong.
    Thank you.
    Regards,
    -Anuradha{color}.

    Signing MIDlet has nothing to do with how data is send over the network. So please be sure that your signed MIDlet is not corrupting your data.
    If you are receiving correct username / password at server side, then its server's responsibility to validate it Your MIDlet has posted the parameters right way.
    I would suggest you to check following things
    1) Check if server is validating the username / password.
    2) What response does server sends you back after validating username / password. Check on both ends.
    3) Check how your midlet processing the response from the server.
    4) Do you get any exceptions?
    but I am doing database connection through php which is on server, I hope it is not wrong way of doing it.Doesn't matter what technology is used at server side to connect to the database.

Maybe you are looking for