Trouble accessing the database

Hi, am new to java and I am having trouble accessing my database. I have the following code
import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.CallableStatement;
import java.sql.ResultSet;
private static boolean verifyInDB(String username, String password){
boolean allow = false;
try {
Driver d =(Driver)Class.forName("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();
conn = DriverManager.getConnection("jdbc:odbc:SITSDB");
queryStr = "SELECT username,\"password\" FROM WebAppUsers WHERE username=" + "'" + username + "'" + "AND password=" + "'"+ password + "'" + "AND archive = 'no'";
myQuery = conn.prepareCall(queryStr);
//myQuery.setString(1, username);
//myQuery.setString(2, password);
rs = myQuery.executeQuery();
if(rs.next())
allow = true;
catch (Exception e) {
System.out.println("Login::verifyInDB: Error Getting Connection: " + e.toString());
System.out.println("Login::verifyInDB: QUERY: " + queryStr);
e.printStackTrace();
finally{closeConn();}
return allow;
I'm almost positive the code it is right however I get an error trying to connect to the database
Login::verifyInDB: Error Getting Connection: java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'WebAppUsers'.
Login::verifyInDB: QUERY: SELECT username,"password" FROM WebAppUsers WHERE username='akabeera'AND password='avenash'AND archive = 'no'
java.sql.SQLException: [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name 'WebAppUsers'.
at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
at sun.jdbc.odbc.JdbcOdbc.SQLExecute(JdbcOdbc.java:3150)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute( JdbcOdbcPreparedStatement.java:214)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeQuery( JdbcOdbcPreparedStatement.java:89)
at com.siac.ManagementReports.Login.verifyInDB(Login.java:43)
at com.siac.ManagementReports.Login.verify(Login.java:27)
at org.apache.jsp.doLogin_jsp._jspService(doLogin_jsp.java:60)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
any suggestions is much appreciated
Message was edited by:
ssj_100

To be clear when you say the command works in query analyzer. Is this the exact string that you are running in query analyzer?
SELECT username,"password" FROM WebAppUsers WHERE username='akabeera'AND password='avenash'AND archive = 'no'This exact string (the SELECT) looks syntactically incorrect to me, but that doesn't mean your database SQL parser cannot handle it I guess (lack of spaces between quotes keywords), and I'm not sure about the double quotes, but I'm kind of an Oracle guy and all of this could be OK, it just seems messy if nothing else.
I would recommend using first, a type 4 driver if at all possible (not the JDBC/ODBC bridge), and second To avoid much of this messiness, you should whenever possible use a PreparedStatement rather then Statement for this type (and most types) of queries.

Similar Messages

  • The server principal "XYuser" is not able to access the database "Ydb" under the current security context

    SQL2005 on winserver 2003. I have a view in Xdb that accesses tables in 2 different databases (Xdb and Ydb) on the same server. I have mixed mode security. I have a SQL user (XYuser) that has read access to all tables and views on both databases, yet when I try to access the view using a C# windows application I get the following error:
    The server principal "XYuser" is not able to access the database "Ydb" under the current security context
    This same scenario works under SQL 2000. I looked through the postings and tried to set TRUSTWORTHY ON on both databases but that didn't help. I can access any other views or tables on the SQL 2005 server, just not the one that joins the tables cross databases. Any help is much appreciated... john

    This appears to be a Login/Database Mapping issue.  I was having this problem, but was able to resolve it as follows:
    Using the SQL Server management Studio:
    In the Object explorer, under the SERVER security folder (not the database security folder), expand Logins. 
    That is: ServerName -> Security -> Logins
    NOT: ServerName -> Databases -> DatabaseName -> Security -> Users
    Select the Login that is having the troubles.  Right click on the Login and select ‘Properties.’
    The ‘User Mapping’ page should list all databases on the server with a check mark on the databases that the Login has been mapped to.  When I was getting the error, the database in question was not checked (even though the Login was assigned as a User on the database itself).  Map the Login by checking the box next to the database name.  Set the default schema.  Then select the roles for the Login in the Database role membership list box.  I selected db_datareader and public.  After clicking OK to save the changes, the problem was resolved.
    In order to ‘Map’ the Login, the Login must not already be as User on the database, so you may have to go to the database security (ServerName -> Databases -> DatabaseName -> Security -> Users) and delete the Login from the list of database Users before mapping the Login to the database.

  • Not able to access the Database & Clusterware from OEM Console.

    hi,
    I had installed Oracle RAC 11g R2 in RHEL 5.3 Operating environment. I had installed my Oracle RAC with Enterprise Manager Console.
    Its with the defailt port 1158. After the installation when i try to access my EM Console, i was not able to access the Database and Clusterware from EM Console.
    When i access the EM console with url, I found with Startup and Perform Recovery option. But whereas my database is already startup and running.
    So when i click startup its saying database is already started. Since it is a prodution environment i dont want to go with Perform recovery option.
    Please tell me hw to attach files in this thread so that i can send the snap shot of the console for your reference.
    with regards
    A.Aravind
    Edited by: 795847 on Sep 21, 2010 10:40 PM

    hi,
    As mentioned due to not having the default listener port 1521, we are facing this problem.
    As meniotned i had changed the emoms.properties file and changed the port and my emctl page is opening.
    But am not able to access the other parameters like ASM, Servers, Clusters etc bcoz since in some file it is looking for 1521 default port.
    So is it better to go for emctl deconfig and config again or to change the port the files which required.
    If i do in what are the file the default port will be located related to emctl.
    with regards
    A.Aravind

  • How to use PDA module to access the database of PDA?

    I want to develop a program which  can access the database of PDA by the pda module. give me some advice!
      thanks!

    It may help you to know how I add JARs
    1. I open my Project (myProject)
    2. I Mount the JAR to the FileSystem (like mypackages.jar = which includes com.mus.de.myClass.java)
    3. I Mount the File to the FileSystem (like c:\..myfiles..\myProject)
    3.1 I add the File to my Project
    4. I select File | New -> Classes | Main
    4.1 I typed "import com.mus.de.myClass.java" to refer to this package.
    4.2 I called some of the public methods
    thats it
    Andreas

  • HT201210 Is anyone having trouble accessing the iTunes store?

    Is anyone having trouble accessing the iTunes store?

    The Complete Guide to Using the iTunes Store
    http://www.ilounge.com/index.php/articles/comments/the-complete-guide-to-using-t he-itunes-store/
    iTunes Store: Associating a device or computer to your Apple ID
    http://support.apple.com/kb/ht4627
    Can't connect to the iTunes Store
    http://support.apple.com/kb/TS1368
    iTunes: Advanced iTunes Store troubleshooting
    http://support.apple.com/kb/TS3297
    Best Fixes for ‘Cannot Connect to iTunes Store’ Errors
    http://ipadinsight.com/ipad-tips-tricks/best-fixes-for-cannot-connect-to-itunes- store-errors/
    iOS: Changing the signed-in iTunes Store Apple ID account
    http://support.apple.com/kb/ht1311
    Try this first - Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.
    This works for some users. Not sure why.
    Go to Settings>General>Date and Time> Set Automatically>Off. Set the date ahead by about a year.Then see if you can connect to the store.
     Cheers, Tom

  • Error in the module RSQL accessing the database interface

    I have written the following query.
    SELECT  a~no
             a~hist_no
             a~chk_stat
             a~chk_date
             a~user as chk_user
             b~name as chk_by
             into corresponding fields of table hist
             from zhist as a INNER JOIN zuser as b on
             auser = bbname
             where pspnr = v_pspnr
             and   chk_no = v_chk_no.
    I am getting the dump "Error in the module RSQL accessing the database interface".
    Please provide me the solution.
    Thanx,
    Selva.

    Hi,
    As i have analysed your query in that you are putting the data in the internal table 'hist' which is also a standard structure and if you check in SE11 'hist' is the standard structure for 'Tablespace History' and might be because of that it is causing the problem.
    Kindly check by changing the name of the internal table to tt_hist and then try.
    I think that will solve the problem.
    Regards,
    Harsh Goel

  • Trouble accessing a database in a deployed application

    I am having difficulty accessing a database on a deployed application.  I am using LV2009, and Windows XP.    I am interfacing with the database via ODBC.  The database is located in the "Shared Documents" folder.  I have no problem accessing the database when logged in as the administrator, but when i use the production login I cannot get to it (I can see it in explorer).  I have given the production login administrative privileges and still cannot access it.  I can save a notepad file to that folder when using the production login.  What do I not have set properly in the database setup?
    Thanks in advance.
    Jim
    Jim
    LV 2013

    Sorry I got the error code mixed up!
    // MessageId: DB_E_CANCELED
    // MessageText:
    //  Operation was canceled.
    #define DB_E_CANCELED                    ((HRESULT)0x80040E4EL)
    This would indicate that there was some operation like a login dialog or similar that was canceled. It could be that you have assigned a username and passowrd in Access to the database file. In that case you do need to specify the correct username and password in the DSN connection settings otherwise the ADO/ODBC driver wants to prompt you with a dialog for this information, but this has to be enabled with the "prompt? (f)" input to the DB Open Connection method. If that parameter is false, all the ADO library can do is to abort the connection.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • I want to access the database with user name and password without con. info/udl

    hi to all,
    im doing project related with database... normally i'll connect ***.udl file to open database.vi.
    now what is my question is I want to open the database with the user name with password.... y i need this because once i run the program the program should ask username and password to open database for write/read operation. if its wrong user name and password means program should be denied... 
    can any tell how to access the database toolkit with the username with password....
    im using labview 7.0... 
    i think my question is clear....waiting for reply thank you in advance...
    pls see this attachment.....
    Regards,
    N. Srinivasan
    Attachments:
    access.vi ‏37 KB

    i have already read that link in the discussion forum...but im still have some confussion in... i attached file is so like to give user name and password..?
    and one more things can tell wat to do in ODBC and MDB and in UDL for password lock.. each time i run the promgram it should ask password to acces the database.. 
     thank you a lot for your reply.. 
    it will be more more useful if u clear my doubts clearly....
    Regards,
    N. Srinivasan
    Attachments:
    user=pass.PNG ‏35 KB

  • Error saying "Error in the module RSQL accessing the database interface"

    Hi,
    there is a standard program available for retrieving the assets for the given cost centres on the selection screen.
    Our requirement is instead of cost centre we have to retrieve the assets for the given cost centre group.
    We have to find all the cost centres available on the given cost centre group and its child nodes.
    For all these cost centres we will be retriving the asset history data.
    So we copied the standard program into another Y program and made the changes to it.
    What's happening is if we give the top most Cose centre group node there are 16000 cost centres available . while retriving the asset history data for all these cost centres an runtime error occurs in a standard program saying
    "Error in the module RSQL accessing the database interface, " DBIF_RSQL_INVALID_RSQL ".
    The error occurs while executing the statement Fetch Next cursor in a standard Include program.
    <b>This happens only if we give huge range of data. If we give small range of data it
    works fine</b>.
    Can anyone help me in this by saying why it occurs and what will be the solution for this.
    Thanks.

    Hi camila,
    The huge range is part of the query string passed to the database.
    While an MP3 music gadget easily stores a gigabyte of data, ORACLE was able to increase the maxium size of a query string from 16 k to 32 k bytes in the last 5 years.
    <b>Unbelievable but true!</b>
    Just multiply the number of entries in the range with the field length and see where go go...
    Regards,
    Clemens

  • DBIF_RSQL_INVALID_RSQL  " Error in the module RSQL accessing the database i

    TYPES: BEGIN OF lty_bkpf,
               xblnr LIKE bkpf-xblnr,
             END OF lty_bkpf.
      DATA: li_bkpf TYPE STANDARD TABLE OF lty_bkpf
                    WITH HEADER LINE.
      RANGES: lr_xblnr FOR bkpf-xblnr,
              lr_xblnr1 FOR bkpf-xblnr,
               s_bukrs FOR bseg-bukrs.
    IF NOT lr_xblnr1[] IS INITIAL.
        SELECT xblnr
            FROM bkpf
            APPENDING CORRESPONDING FIELDS OF TABLE li_bkpf
            WHERE bukrs IN s_bukrs
            AND bstat = ''
            AND xblnr IN lr_xblnr1  
            AND blart EQ 'SA'.
      ENDIF.
    s_bukrs has a single value .
    lr_xblnr1 has 3000 entries and also with  wild characters.  ( I     CP   4903813253* ) .
    the SELECT statement is going into dump  with the message  : DBIF_RSQL_INVALID_RSQL
    " Error in the module RSQL accessing the database interface."
    please suggest me alternate code  to encounter this issue .
    thanks,
    Raghu V

    Moderator message - Please search before asking - post locked
    Rob

  • How to access the database jar file using the derby 10.2.1.6 database ?

    Hi,
    How to access the database jar file using the derby 10.2.1.6 database ?
    I have used like below. And i am getting the following the error:
    "org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot load JDBC driver class 'org.apache.derby.jdbc.EmbeddedDriver'
    at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1136)"
    My context.xml file looks like this:
    <Context crossContext="true">
    <Resource name="jdbc/derby" auth="Container"
    type="javax.sql.DataSource" driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
    url="jdbc:derby:jar(\CalypsoDemo\database.jar)samples"
    username="xxx" password="xxx" maxActive="20" maxIdle="10"
    maxWait="-1"/>
    </Context>
    What could be the reason.?
    Any suggestions will be appriciated.
    Thanks in Advance,
    Gana.

    ya, I have restarted. Can you please tell me whether the path which i am giving is right or not in the context file?
    Thanks,
    Gana.

  • I have a MacBook Air with OS X and am having trouble accessing the ADT Pulse Home Security System cameras.  The mobile (iPhone and iPad) apps allow access no problem, but I can't get a picture on the MacBook.  Have tried Safari and Firefox browsers.

    I have a MacBook Air with OS X and am having trouble accessing the ADT Pulse Home Security System cameras.  The mobile (iPhone and iPad) apps allow access no problem, but I can't get a picture on the MacBook.  Have tried Safari and Firefox browsers.  Anyone have any ideas?  Thanks.

    From a Catherine to Katherine -- Had the exact same problem!!  I had to enable Java twice - both in Safari and then on the MacBookAir itself.

  • How to make more than one person can access the database at one time

    how to make  more than one person can access the database at one time 

    Please post further f'up's in the Access forum.
    In short: for different reasons it is best practice that each user gets its own local copy of the database. This means that you need to split it into a front-end which only consists of the forms, queries, reports etc. Everything which doesn't need to be
    shared. And a back-end, which only stores the data.
    Take also a look at Allen Browne's article:
    Split your Access database into data and application.
    When you've splitted your database, you may often consider to use SQL Server as back-end. Here you may read Armen Stein's
    The Best of Both Worlds: Access-SQL Server Optimization.

  • Hi I am having trouble accessing the App store and I tunes on my IPad, it just keeps loading. How can I fix it please.

    I am having trouble accessing the Apps store and ITunes on my IPad. It just keeps loading, can someone please tell me what I've done wrong. Thanks

    I have never experienced that or read about it either but before you resort to restoring - and that may be what you have to end up doing - try the basics first.
    Restart the iPad by holding down on the sleep button until the red slider appears and then slide to shut off. To power up hold the sleep button until the Apple logo appears and let go of the button.
    Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider - let go of the buttons.
    Sometimes just restarting the iPad can really help. The resolution may end up being more complicated, but try the simple things and then move on.

  • A connection to the QuickTime server could not be established. This computer may be having trouble accessing the Internet or the server may be offline

    When I select “Update existing software in QuickTime Pro I get an error message saying “A connection to the QuickTime server could not be established. This computer may be having trouble accessing the Internet or the server may be offline”
    This has persisted for several weeks. Any help will be welcomed as I do not know how to contact QuickTime support via Apple.
    I am using Windows 7 64 bit.  
    Many thanks

    I was able to download and install the latest version of iTunes  (10.6.3.25) without a hitch. After the reboot I tried again to update my exisitng Quicktime Pro software as described in my original posting and got exactly the same error message.
    If it happens that there is no software to download because I am already running the latest version, surely a message to that effect would appear and not the one saying “A connection to the QuickTime server could not be established. This computer may be having trouble accessing the Internet or the server may be offline”
    Still seeking advice if possible
    Cheers

Maybe you are looking for

  • Wrong apple id for apps

    The Apple Id that I am using for the i-Tunes store is properly reflected in the phone as an email address.  When I try to update apps on the phone, I am prompted to enter a password.  I noticed on the login screen that the Apple ID has been truncated

  • Buying macbook and a printer

    So, Apple is making this special offer that when you buy a mac and a printer at the same time, you get up to $100 back via rebate. And I saw this printer that costs $99.95 (Epson Stylus Nx420). So, I'd like to know that if I buy mac + epson printer,

  • A right communication mechanism

    Hi, all, Here is a situation for a client/server application: the server coded in C++; a client is needed, but not browser since its UI is not rich enough. I'm thinking about to have Java client distributed and launched by Java Web Start. The rest of

  • Steve Jobs Probably Uses A Blackberry

    I have had it with Iphones! My 1st generation Iphone was great for the first year until it conveniently developed dead screen spots at month 14. The "Genious Bar" told me that because I was out of warranty I would have to pay $199 for a refurbished f

  • How to start working with a Development Component

    Hi Guys, Till now I was working with the local development of WD. I was the only one working so I created a local project and use to deploy to the J2EE Engine. Now we have got the full NWDI (Netweaver Dev Infrastructure). I want to know exactly how t