TYPE_SCROLL_INSENSITIVE w/Access

I can't seem to find the answer for this; sorry if it's an obvious one. The one post I found (http://forum.java.sun.com/thread.jsp?forum=48&thread=398206) didn't seem very clear...
Anyway, when I try to make my statement TYPE_SCROLL_INSENSITIVE with Access, I get a "Function Sequence Error". If I make it TYPE_FORWARD_ONLY, it's ok. The code is as follows:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn = DriverManager.getConnection("jdbc:odbc:mydsnstring");
PreparedStatement ps = conn.prepareStatement("select * from userpw",
                                                       ResultSet.TYPE_SCROLL_INSENSITIVE,
                                                       ResultSet.CONCUR_UPDATABLE);
ResultSet results = ps.getResultSet();
System.out.println("yay");
results.close();
ps.close();
conn.close();
Also of note is that this code works find with MySQL.
Any help is greatly appreciated; thanks in advance.

I can't seem to find the answer for this; sorry if
it's an obvious one. The one post I found
(http://forum.java.sun.com/thread.jsp?forum=48&thread=3
8206) didn't seem very clear...
Anyway, when I try to make my statement
TYPE_SCROLL_INSENSITIVE with Access, I get a "Function
Sequence Error". If I make it TYPE_FORWARD_ONLY, it's
ok. The code is as follows:
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn =
DriverManager.getConnection("jdbc:odbc:mydsnstring");
PreparedStatement ps = conn.prepareStatement("select * from userpw",
ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_UPDATABLE);
ResultSet results = ps.getResultSet();
System.out.println("yay");
results.close();
ps.close();
conn.close();
ummmmmm... where is the execute?
you need to execute a statement to use getResultSet.
replace the line
ResultSet results = ps.getResultSet();with this
ResultSet results = ps.executeQuery();

Similar Messages

  • Sql exception access denied

    well as the topic says I get an access denied exception. This is when I try to connect to the database
    java.sql.SQLException: Access denied for user 'Java'@'localhost' (using password: YES)
    I get the same problem when I try to connect with the root user.
    this is the code I'm using, ignore the threads as they do not matter
    devil_server.java
    import java.io.*;
    import java.net.MalformedURLException;
    import java.net.*;
    import java.sql.*;
    import java.util.*;
    public class devil_server
    //variable types concerning userthreads
    static public int uid;
    static public int nou;
    static public ServerSocket skanal;
    public static Vector users = new Vector();
    public static Vector usernames = new Vector();
    public static String user;
    public static String pass;
         public static void main(String arg[])
         try {
              System.out.println("write the user used to access the mysql database with Devil Chat");
              user = Keyboard.readString(); //read mysql username from keyboard
              System.out.println("write the password used to access the mysql database with Devil Chat");
              String pass = Keyboard.readString(); //read password for user from keyboard
              uid = 0;
              nou = 0; //Number Of Users
              skanal = new ServerSocket(5555);
              new Thread(new devil_server_user(uid)).start();
              while(true)
                   if(uid>nou)
                        String buffer = "buffer";
                        String userl = "user";
                        users.add(buffer);
                        usernames.add(userl);
                        new Thread(new devil_server_user(uid)).start();
                        nou++;
            }//end while
              }/*end try*/ catch (Exception ex) {
               ex.printStackTrace();
              }//end catch
              //con.close
         } //end main
    }//end classdevil_server_user.java
    import java.io.*;
    import java.net.MalformedURLException;
    import java.net.*;
    import java.util.*;
    import java.sql.*;
    public class devil_server_user implements Runnable
    public devil_server_user (int uid){this.uid=uid;};
    public int uid;
    public Socket kanal;
    public InetAddress ip;
    public InputStream streamin;
    public OutputStream streamout;
    public BufferedReader bufferind;
    public PrintWriter printout;
    public String lastuserin;
    public String userinput;
    public String sip;
    public int isadmin;
    //variable types concerning mysql database connectivity
    public Statement stmt;
    //public Statement rstmt;
    public ResultSet rs;
    public Connection conn;
         public void run()
              try {
         System.out.println("Listening on port 5555");
         System.out.println("Waiting for clients");
         kanal = devil_server.skanal.accept();
         devil_server.uid++;
         ip = kanal.getInetAddress();
         sip = ip.toString();
         sip = sip.replace("/","");
         isadmin = 0;
         if(sip.equals("127.0.0.1"))
         isadmin = 1;
         } catch (Exception ex) {
         ex.printStackTrace();
         try {
         System.out.println("Incomming request: "+ ip);
         streamin = kanal.getInputStream();
         System.out.println("Input ready");
         streamout = kanal.getOutputStream();
         System.out.println("Output ready");
         devil_server.users.set(this.uid, printout = new PrintWriter(streamout));
         printout = (PrintWriter)devil_server.users.get(this.uid);
         bufferind = new BufferedReader(new InputStreamReader(streamin));
         catch (IOException e){
         e.printStackTrace();
        try { 
         Class.forName("com.mysql.jdbc.Driver").newInstance();
         conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/Java?user="+devil_server.user+"&password=s"+devil_server.pass);
         stmt = conn.createStatement();
         stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
         } catch (Exception e) {
         e.printStackTrace();
         //String request = bufferind.readLine();
         //System.out.println("message from "+ip+" : "+request);
         //printout.flush();
    //forbindelse
    try {
         userinput = (String)bufferind.readLine();
         } catch(Exception e) {
         e.printStackTrace();
         while(!userinput.startsWith("/name"))
         try {
              userinput = (String)bufferind.readLine();
                   } catch(Exception e) {
         e.printStackTrace();
         try
         stmt = conn.createStatement();
         stmt.executeUpdate("INSERT INTO devilchat_users (ip, username, isadmin) VALUES('"+sip+"',' "+userinput.substring(6)+"','"+isadmin+"')");
         new Thread(new devil_server_broadcast("/say "+userinput.substring(6)+" has joined devilchat")).start();
         devil_server.usernames.set(this.uid, userinput.substring(6));
         printout.println("/knock"); //knocks to the client
         printout.flush();
         userinput = (String)bufferind.readLine();
              } catch(Exception e) {
         e.printStackTrace();
         while(!userinput.startsWith("/knock"))
         try {
         userinput = (String)bufferind.readLine(); //waiting for client to knock back
              } catch(Exception e) {
         e.printStackTrace();
         printout.println("/ready"); //tells client it's ready to read userinput
         printout.flush();
         int spoken = 0;
         System.out.println(devil_server.usernames.get(this.uid)+": has connected");
         new Thread(new devil_server_usercheck()).start();
    //starter l�kke som checker for nye input fra useren
         while(true)
         try{
              userinput = (String)bufferind.readLine();
              if(!userinput.equals(lastuserin))
              if(userinput.startsWith("/name"))
              stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
              rs = stmt.executeQuery("SELECT * FROM devilchat_users WHERE uid='"+this.uid+"'");
              rs.absolute(this.uid);
              String oldname = rs.getString("username"); // get old name from database and save it in a string before applying the new name
              stmt = conn.createStatement();
              stmt.executeUpdate("UPDATE devilchat_users set username='"+userinput.substring(6)+"' WHERE uid ='"+this.uid+"'");
              //start a broadcast to tell the name has changed
              new Thread(new devil_server_broadcast("/namechange *** "+oldname+" has changed their name to "+userinput.substring(6)+" ***")).start();
              //change the username in the vector containing usernames
              devil_server.usernames.set(this.uid, userinput.substring(6));
              //start a new listcheck so the list can be updated
              new Thread(new devil_server_usercheck()).start();
              else if(userinput.startsWith("/say"))
              stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
              rs = stmt.executeQuery("SELECT * FROM devilchat_users WHERE uid='"+this.uid+"'");
              rs.absolute(this.uid);
              String sname = rs.getString("username");
              String say1 = userinput.substring(6);
              userinput = "/say "+sname+": "+say1;
              spoken++;
              stmt = conn.createStatement();
              stmt.executeUpdate("UPDATE devilchat_users set spoken='"+spoken+"' WHERE uid ='"+this.uid+"'");
              new Thread(new devil_server_broadcast(userinput)).start();
              else if(userinput.startsWith("/quit"))
              stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
              rs = stmt.executeQuery("SELECT * FROM devilchat_users WHERE uid='"+this.uid+"'");
              rs.absolute(this.uid);
              String name = rs.getString("username");
              printout.println("/quit "+name+" has left devilchat"); //tells client it's ready to read userinput
              printout.flush();
              devil_server.usernames.set(this.uid, "user");
              devil_server.users.set(this.uid, "buffer");
              new Thread(new devil_server_broadcast("/quit "+name+" has left devilchat")).start();
              conn.close();
              kanal.close();
              break;
              lastuserin = userinput;
         catch(Exception e) {
         e.printStackTrace();
    }this is the full exception handling
    java.sql.SQLException: Access denied for user 'Java'@'localhost' (using password
    : YES)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1056)
    at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:957)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3376)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3308)
    at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:894)
    at com.mysql.jdbc.MysqlIO.secureAuth411(MysqlIO.java:3808)
    at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:1256)
    at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2032)
    at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:729)
    at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:46)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Sou
    rce)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
    at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:302)
    at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java
    :283)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at java.sql.DriverManager.getConnection(Unknown Source)
    at devil_server_user.run(devil_server_user.java:71)
    at java.lang.Thread.run(Unknown Source)
    java.lang.NullPointerException
    at devil_server_user.run(devil_server_user.java:97)
    at java.lang.Thread.run(Unknown Source)
    I have tried the org driver too and I have tried (url, user, pass) and (url?user=user&password=pass)
    Edited by: Angelwinged_Devil on Mar 13, 2008 6:04 AM

    well it's pretty weird, because I'm trying to make some kind of pattern with the install file I made, although... the install file works and looks like this
    import java.io.*;
    import java.net.*;
    import java.sql.*;
    public class install
        public static void main(String[] args) {
            try {
                // The newInstance() call is a work around for some
                   //older java implementations
                   //org.gjt.mm.mysql.Driver or com.mysql.jdbc.driver
                Class.forName("org.gjt.mm.mysql.Driver").newInstance();
            } catch (Exception ex) {
                ex.printStackTrace();
              try {
              System.out.println("write the user used to access the mysql database with Devil Chat");
              String user = Keyboard.readString(); //read mysql username from keyboard
              System.out.println("write the password used to access the mysql database with Devil Chat");
              String pass = Keyboard.readString(); //read password for user from keyboard
              Connection conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/mysql", user, pass);
              Statement stmt = conn.createStatement();
              stmt.executeUpdate("CREATE DATABASE IF NOT EXISTS Java");
              System.out.println("Database has been created");
              Connection con = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/Java", user, pass);
              Statement nstmt = con.createStatement();
              nstmt.executeUpdate("CREATE TABLE IF NOT EXISTS devilchat_users ("+
              "uid int NOT NULL AUTO_INCREMENT, PRIMARY KEY(uid), "
              +"username varchar(25), isadmin bool, spoken int, ip varchar(15))");
              System.out.println("Table has been created");
              con.close();
              conn.close();
                   } catch (SQLException ex) {
        // handle any errors
        System.out.println("SQLException: " + ex.getMessage());
        System.out.println("SQLState: " + ex.getSQLState());
        System.out.println("VendorError: " + ex.getErrorCode() + "\n");
    }

  • MS Access woes

    Hi all,
    I am quite frustrated with running sql queries on an MS Access 2002 database.
    First a simple query such as
    'Select DISTINCT VariableName from DISTRIBUTIONDATA' returns all the rows in my database.
    I also tried 'Select DISTINCTROW VariableName from DISTRIBUTIONDATA' but to no avail.
    I tried executing the same query in MSAccess 2002, ofcourse it works perfectly fine. The other query that I so desperately wish to run is
    Select Count(*) AS Expr1 From (SELECT DISTINCT VariableName, DataGroupName from DistributionData WHERE SettingID='Regional' GROUP BY VariableName, DataGroupName)
    However it just does not seem to work. The java error that I get is
    java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver] Syntax error in FROM clause.
         at sun.jdbc.odbc.JdbcOdbc.createSQLException(JdbcOdbc.java:6958)
         at sun.jdbc.odbc.JdbcOdbc.standardError(JdbcOdbc.java:7115)
         at sun.jdbc.odbc.JdbcOdbc.SQLExecDirect(JdbcOdbc.java:3111)
    whereas I could not find much of an error in my from clause. The above query is what is being built and is printed out with a system.out statement.
    Infact even the subquery
    SELECT DISTINCT VariableName, DataGroupName from DistributionData WHERE SettingID='Regional' GROUP BY VariableName, DataGroupName
    from the above from clause runs on it's own, it simply does not return the correct number of records.
    Thanks in advance for your help...

    Firstly, I don't have much option, I have to use MS access.. i know it sucks.. but still...
    Secondly, Here's some of the code... ( and yeah I have tried n combinations of capitalization - doesn't help)
    Statement inputStmt = inputConnection.createStatement(
    ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_READ_ONLY);
    String inputQuery = "SELECT DISTINCT VariableName, DataGroupName FROM DistributionData WHERE SettingID='"
    + categories[i] + "' GROUP BY VariableName, DataGroupName";
    System.out.println( inputQuery );
    //get all datagroupnames and variablenames for this category
    ResultSet inputSet = inputStmt.executeQuery( inputQuery );
    // get the count of this result set for each category
    inputSet.last();
    int count1 = inputSet.getRow();
    System.out.println("For " +categories[i]+ " we have "+count1+" rows in inputdatabase");
    inputSet.beforeFirst();
    This is the output that it produces
    You chose to open this file: NationDB.mdb
    SELECT DISTINCT VariableName, DataGroupName FROM DistributionData WHERE SettingID='Regional' GROUP BY VariableName, DataGroupName
    For Regional we have 12 rows in inputdatabase.
    If I change the above query to simply SELECT GROUP BY VariableName from DistributionData ( don't pay too much attention to the capitalization) then it gives me a Syntax error. ..
    lastly, how do I define a query in Access and select from that. ??
    Thanks

  • SQL Issue with MS Access

    Hello;
    I have an SQL query:
    Select year, sum(group1) as A from table1 where name in ('test1', 'test2') group by year;
    When I run it through SQL editor in MS Access it returns the years and sum and a total of 5 rows.
    When I pass this command through Java: Connection.createStatement and executeQuery
    I can print the values and it prints 5 rows but after printing it hangs.
    When i get the size of result set :
    while(rs.next())
    resultSetSize ++;
    System.out.println(rs.getInt(1) + "\t" +resultSetSize);
    It shows the result set as size of 10, when i print the values it stops at 5. I am not sure where the issue is.
    I think since my where condition is have 2 values it might be causing problem.
    If I just put 1 value after my where condition, then the java code runs fine.
    Can anyone tell me what the issue is here or where am I going wrong?
    Thanks for your help.
    Edited by: yesmein on Apr 23, 2009 5:58 AM

    Thanks for the suggestion. I checked the code. Indeed I was not printing an exception. When I printed the exception this is what i get:
    Exception is: java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state
    hope this helps to guide me on how to solve this issue.
    Below is the code:
    public static void TestQuery()
    String query="SELECT year, sum(group1) as A FROM table1 WHERE name in ('test1', 'test2') ";
    Connection conn = ConnectDB1.getDBConnection(); //this gets the database parameters from a properties file
    Statement stat = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
    ResultSet rs = stat.executeQuery(query);
    int resultSetSize=0;
    while(rs.next())
    resultSetSize ++;
    System.out.println(rs.getInt(1) + "\t" +resultSetSize);
    rs.beforeFirst();
    System.out.println("Size of result set: " +resultSetSize);
    while(rs.next())
    System.out.println(rs.getInt(1) + "\t" + rs.getInt(2) );
    rs.close();
    stat.close();
    conn.close();
    System.out.println("End of program");
    catch (Exception e){System.out.println("Exception is: " +e);}
    }

  • Connecting to MS Access 2003

    I'm connecting to an Access database through the JDBC ODBC bridge as follows
    String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
    String url = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=" + location + ";Uid=" + username + ";Pwd=" + password + ";";
    The problem I'm having though, is when I try to set the fetch size (rs.setFetchSize(100)) of my result set I get an "Invalid Fetch Size" SQL exception. I'm pulling in a fairly large bit of data (about 10k rows) and I'm assuming setting the fetch size will speed things up (suggestions welcome here as well).
    I've done some searching and can't find whether or not Access supports this feature. Or if it does, can anyone recommend a driver that allows it?
    Thanks in advance.

    So I was able to come up with something that doesn't throw an error, although I'm not sure if it yields any performance benefits:
         statement = connection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);     
         statement.setMaxRows(fetchSize);
         statement.setFetchSize(fetchSize);
         rs = statement.executeQuery(query);
         rs.setFetchSize(fetchSize);
    I did a getMaxRows on my statement and noticed it defaulted to 0. Setting the max rows allowed me to set the fetch size without throwing a sql exception.

  • Username and password with Access and JDBC application

    Hello all,
    I have written an application which accesses a MS Access database. I have created a dialog which asks the user for a username and password. I then include the username and password to connect to the database. I have created groups and users in the Access database and have given each user different privaleges. However, when I run my application, any user can get any privelage. I am missing something. Thanks in advance.

    // ConnectToDatabase.java
    // Copyleft (c) 2001 RatKing
    // ��������������������������������Java Bean
    // E-mail: [email protected]
    // This can use in JSP or Java Application or Applet
    // AFTER you have setup the ODBC source in Windoz.
    package rat;
    import java.sql.*;
    import java.util.*;
    public class ConnectToDatabase{
    private String driverClass = "sun.jdbc.odbc.JdbcOdbcDriver"; // JDBC-ODBC Bridge Driver
    private String dbURL = "jdbc:odbc:yourdbname"; // the name of your ODBC Source's Database
    private String userName = "yourname"; // user ID
    private String password = "yourpassword"; // user password
    private Connection connection = null; // Connection to the Database
    private Statement statement = null; // Statement object
    public ConnectToDatabase () {
    // ������������������
    public Connection getConnection() throws ClassNotFoundException, SQLException {
    if(connection != null) {
    return connection;
    Class.forName(driverClass);
    connection = DriverManager.getConnection(dbURL, userName, password);
    return connection;
    } // getConnection()
    public void closeConnection() throws SQLException {
    if (connection != null) {
    // Makes all changes made since the previous commit/rollback permanent
    // and releases any database locks currently held by this Connection object.
    if (!connection.getAutoCommit())
    connection.commit();
    closeStatement();
    connection.close();
    connection = null;
    } // closeConnection()
    * If not connected to database...connect to database, create a statement,
    * and, return the Statement.
    protected void createStatement() throws SQLException, Exception {
    if(statement == null) {
    Connection connection = getConnection();
    statement = connection.createStatement();
    * This method executes a statement and returns true or false. Any type
    * of Statement may be executed by this command.
    public boolean execute(String sqlString) throws SQLException, Exception {
    if(statement == null){
    createStatement();
    boolean returnValue = statement.execute(sqlString);
    return returnValue;
    * This method executes the statement and returns a ResultSet from
    * execution of the query. Only a SELECT Statemet is applicable here.
    public ResultSet executeQuery(String sqlString) throws SQLException, Exception {
    if(statement == null){
    createStatement();
    ResultSet rs = statement.executeQuery(sqlString);
    return rs;
    * This method executes update statements and returns a count of
    * the updates. Only a INSERTS, DELETES, and UPDATES are applicable here.
    * In addition, SQL statements that return nothing such as SQL DDL statements
    * can be executed.
    public int executeUpdate(String sqlString) throws SQLException, Exception {
    if(statement == null){
    createStatement();
    int returnValue = statement.executeUpdate(sqlString);
    return returnValue;
    * This method closes the Statement.
    public void closeStatement() throws SQLException {
    if(statement != null){
    statement.close();
    statement = null;
    * If it is not connected to database, connect to database and
    * create a statement and returns the Statement
    * @param scrollType should be ResultSet.TYPE_FORWARD_ONLY
    * or ResultSet.TYPE_SCROLL_INSENSITIVE
    * or ResultSet.TYPE_SCROLL_SENSITIVE
    * @param updateType should be ResultSet.CONCUR_READ_ONLY or
    * ResultSet.CONCUR_UPDATABLE ;
    protected Statement getStatement(int scrollType, int updateType)
    throws SQLException, Exception {
    Connection connection = getConnection();
    // for cloudscape to work with scrollable resultsets, the autocommit
    // should be false.
    connection.setAutoCommit(false);
    Statement statement = connection.createStatement(scrollType,
    updateType);
    return statement;
    * If it is not connected to database, connect to database and
    * create a preparestatement and returns the Statement
    * @param sqlString queryString to make a statement
    * @param scrollType should be ResultSet.TYPE_FORWARD_ONLY
    * or ResultSet.TYPE_SCROLL_INSENSITIVE
    * or ResultSet.TYPE_SCROLL_SENSITIVE
    * @param updateType should be ResultSet.CONCUR_READ_ONLY or
    * ResultSet.CONCUR_UPDATABLE ;
    protected PreparedStatement getStatement(String sqlString,
    int scrollType,
    int updateType) throws SQLException,
    Exception {
    Connection connection = getConnection();
    // for cloudscape to work with scrollable resultsets, the autocommit
    // should be false.
    connection.setAutoCommit(false);
    PreparedStatement preparedStatement =
    connection.prepareStatement(sqlString, scrollType, updateType);
    return preparedStatement;
    * this method executes the statement and resuts the resultSet due to
    * execution of Statement.
    * only SELECT Statemet is applied here.
    public ResultSet executeQueryScrollInsensitiveReadOnly(String sqlString,
    Vector values) throws SQLException, Exception {
    PreparedStatement preparedStatement = getStatement(sqlString,
    ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_READ_ONLY);
    for (int i = 1; i <= values.size(); i++) {
    preparedStatement.setObject(i, values.elementAt(i - 1));
    // Execute a SQL statement that returns a single ResultSet.
    ResultSet rs = preparedStatement.executeQuery();
    return rs;
    * this method executes the statement and resuts the resultSet due to
    * execution of Statement. only SELECT Statemet is applied here.
    public ResultSet executeQueryScrollInsensitiveReadOnly(String sqlString)
    throws SQLException, Exception {
    Statement statement = getStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_READ_ONLY);
    // Execute a SQL statement that returns a single ResultSet.
    ResultSet rs = statement.executeQuery(sqlString);
    return rs;
    * this method executes the statement and returns the resultSet due to execution
    * of Statement. only SELECT Statemet is applied here.
    public ResultSet executeQueryScrollForwardOnly(String sqlString,
    Vector values) throws SQLException, Exception {
    PreparedStatement preparedStatement = getStatement(sqlString,
    ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
    for (int i = 1; i <= values.size(); i++) {
    preparedStatement.setObject(i, values.elementAt(i - 1));
    // Execute a SQL statement that returns a single ResultSet.
    ResultSet rs = preparedStatement.executeQuery();
    return rs;
    * this method executes the statement and returns the resultSet due to
    * execution of Statement. only SELECT Statemet is applied here.
    public ResultSet executeQueryScrollForwardOnly(String sqlString)
    throws SQLException, Exception {
    Statement statement = getStatement(ResultSet.TYPE_FORWARD_ONLY,
    ResultSet.CONCUR_READ_ONLY);
    // Execute a SQL statement that returns a single ResultSet.
    ResultSet rs = statement.executeQuery(sqlString);
    return rs;
    * Method executeQueryScrollSensitiveReadOnly
    * @param sqlString String
    * @param values Vector
    * @return ResultSet returns ResultSet due to statement execution
    * @throws Exception
    * @throws SQLException
    * @see
    public ResultSet executeQueryScrollSensitiveReadOnly(String sqlString,
    Vector values) throws SQLException, Exception {
    PreparedStatement preparedStatement = getStatement(sqlString,
    ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY);
    for (int i = 1; i <= values.size(); i++) {
    preparedStatement.setObject(i, values.elementAt(i - 1));
    // Execute a SQL statement that returns a single ResultSet.
    ResultSet rs = preparedStatement.executeQuery();
    return rs;
    * Method executeQueryScrollSensitiveReadOnly
    * @param sqlString
    * @return
    * @throws Exception
    * @throws SQLException
    * @see
    public ResultSet executeQueryScrollSensitiveReadOnly(String sqlString) throws SQLException, Exception {
    Statement statement = getStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
    ResultSet.CONCUR_READ_ONLY);
    // Execute a SQL statement that returns a single ResultSet.
    ResultSet rs = statement.executeQuery(sqlString);
    return rs;
    //////////////Other things maybe useful ///////////////////
    # Refer to Appendix A for more info on configuring the JDBC
    # driver via setting of the DRIVER_CLASS and DATABASE_URL properties
    #JDBC Driver Class
    # for ODBC Driver:
    #DRIVER_CLASS=sun.jdbc.odbc.JdbcOdbcDriver
    # for Oracle Driver
    #DRIVER_CLASS=jdbc.oracle.driver.OracleDriver
    # for CloudScape Driver equipped with J2EE reference implementation
    #DRIVER_CLASS=RmiJdbc.RJDriver
    # for CloudScape Driver equipped with BEA Weblogic Server
    DRIVER_CLASS=COM.cloudscape.core.JDBCDriver
    #Database URL
    # for ODBC URL
    #DATABASE_URL=jdbc:odbc:tShirts
    # for Oracle URL
    #DATABASE_URL=jdbc:oracle:thin:@localhost:1521:ORCL
    # for URL with CloudScape equipped with J2EE reference implementation
    #DATABASE_URL=jdbc:rmi:jdbc:cloudscape:beeshirtsdb
    # for URL with CloudScape equipped with BEA Weblogic Server
    DATABASE_URL=jdbc:cloudscape:D:\\weblogic\\eval\\cloudscape\\beeshirts
    #UserName to connect to database
    UserName=TSHIRTS
    #Password to connect to database
    Password=TSHIRTS
    #otherParameters
    SUB_PROPERTIES=
    #SQL Query
    SQL_QUERY_STATEMENT = SELECT * FROM TSHIRTS.CUSTOMER
    #SQL Update , if you run this program please change the id 129 to different value each time
    SQL_UPDATE_STATEMENT = INSERT INTO TSHIRTS.CUSTOMER VALUES ('129','Sam','Cheng','S','123 Sam St.', 'C3','Baltimore','MD','20222','4104444444' ,'[email protected]')
    #Join STATEMENT
    SQL_QUERY_STATEMENT_JOIN = SELECT TSHIRTS.CUSTOMER.*, TSHIRTS.ORDERS.* FROM TSHIRTS.CUSTOMER, TSHIRTS.ORDERS WHERE CUSTOMER.CUSTOMER_ID = ORDERS.CUSTOMER_ID_FK
    #OUTER JOIN for ORACLE
    #SQL_QUERY_STATEMENT_OUTER_JOIN = SELECT CUSTOMER.* FROM TSHIRTS.CUSTOMER,STATE WHERE CUSTOMER.STATE(+) = STATE.CODE(+)
    #OUTER JOIN for MSACCESS
    #SQL_QUERY_STATEMENT_OUTER_JOIN = SELECT C.* , S.* FROM CUSTOMER C OUTER JOIN STATE S on C.STATE = S.CODE
    #OUTER JOIN for MSACCESS and Cloudscape
    SQL_QUERY_STATEMENT_OUTER_JOIN = SELECT C.* , S.* FROM TSHIRTS.CUSTOMER C LEFT OUTER JOIN TSHIRTS.STATE S on C.STATE = S.CODE
    #SQL Statement with Like for MSACCESS
    #SQL_QUERY_STATEMENT_WITH_LIKE = SELECT CUSTOMER.* FROM CUSTOMER WHERE CUSTOMER.FIRST_NAME LIKE \'*R*\'
    #SQL Statement with Like for ORACLE and Cloudscape
    SQL_QUERY_STATEMENT_WITH_LIKE = SELECT * FROM TSHIRTS.CUSTOMER WHERE FIRST_NAME LIKE '%R%'
    #Prepared QUERY Statement
    PREPARED_SQL_QUERY_STATEMENT = SELECT * FROM TSHIRTS.CUSTOMER WHERE FIRST_NAME = ?
    PREPARED_SQL_QUERY_STATEMENT_VALUES = Roy
    #Prepared Insert
    PREPARED_SQL_INSERT_STATEMENT = INSERT INTO TSHIRTS.CUSTOMER VALUES(?,?,?,?,?,?,?,?,?,?,?)
    PREPARED_SQL_INSERT_STATEMENT_VALUES =130,John,Hiller,Miller,125 S St.,C6,Baltimore,MD,20100,4104444444,[email protected]
    #Prepared Update
    PREPARED_SQL_UPDATE_STATEMENT = UPDATE TSHIRTS.STATE SET STATE_NAME = 'California' WHERE CODE = ?
    PREPARED_SQL_UPDATE_STATEMENT_VALUES =CA
    #Data base schema name
    SCHEMA_NAME =TSHIRTS

  • Database Access delays-how to improve upon that?

    Hi friends,
    I have this simple class,which takes in query and returns the results.I don't know why the database access is so slow,and if i try to add my driver load statements into the constructor the java class starts throwing "null pointer exception"(Java Class code given below)..I don't know much about connection pool,can u just have a look at this simple class,and tell me if there's anything on which i can improve upon and where to add the(*.close() statements).The same query runs instantly if i make a php program.Urgent help needed...please help me guys.
    public class getResultSet{  private Connection con = null;  private Statement st = null;  private String dsn = "jdbc    b2j:net:xxx";  private String uname = "xxx";  private String pwd = "xxx";  private String query = "";  ResultSet results;   public void ResultS()throws Exception{      try{          Class.forName("com.ibm.db2.jcc.DB2Driver");          con = DriverManager.getConnection(dsn, uname, pwd);          st = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,                                   ResultSet.CONCUR_READ_ONLY);         }      catch (SQLException e) {          e.printStackTrace();          }     }     public ResultSet getResults(String query){            results = null;            try{               results = st.executeQuery(query);               }               catch(SQLException sqle){                 sqle.printStackTrace();               }            return results;     }   }

    Some comments on the code
    public class getResultSet{ // Class names should start with a capital letter and be nouns
    private Connection con = null;
    private Statement st = null; // Statements are transient and should probably not be a member variable
    private String dsn = "jdbc    b2j:net:xxx";  // dsn, user, pass should be final
    private String uname = "xxx"; 
    private String pwd = "xxx"; 
    private String query = "";  // Seems you're not using this
    ResultSet results;   // This really shouldn't be declared here
    public void ResultS()throws Exception{ // Method should start with a lower-case letter and be a verb/* The client code is supposed to call this, then the other method?
    Very fragile. I'm guessing NullPointerExceptions occur if ResultS
    is not called first. Have the other method call this one as necessary.
    try{        
    Class.forName("com.ibm.db2.jcc.DB2Driver");
    con = DriverManager.getConnection(dsn, uname,
    uname, pwd);
    st =
    st =
    =
    con.createStatementResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_READ_ONLY);
    ultSet.CONCUR_READ_ONLY);
    catch (SQLException e) {  
    e.printStackTrace();
    public ResultSet getResults(String query){      
    results = null;
    try{          
    results = st.executeQuery(query);
    catch(SQLException sqle){   
    sqle.printStackTrace();
    return results; // It's a bad idea to return ResultSets as that leaves resources open
    } // Where's the cleanup? You're leaving ResultSet, Statement, Connection open
    >It is probably slow because opening connections takes a long time. You may or may not need a connection pool depending on your app. Perhaps you can just open a connection at the beginning and leave it open until your app finishes. That should reduce the overhead and still be very simple.

  • Help with [Microsoft][ODBC Microsoft Access Driver]Error in row

    hi all,
    it seems i have the same problem updating a field in access database here is what my access table has:
    a field called userID of type String in Access 2000 on XP.
    i wrote the following code in java using Eclipse 3.1.1 ( latest) to update that field:
    String database= "jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)};DBQ=";
    String url= database + filename.trim() + ";DriverID=22;READONLY=true}";
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection con= DriverManager.getConnection( url,"","");
    con.setAutoCommit(false);
    Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
    stmt.executeQuery("SELECT Users.* FROM Users");
    ResultSet rs = stmt.getResultSet();
    rs.moveToInsertRow();
    rs.updateInt(1,"test");
    rs.updateRow();
    con.commit();
    rs.close();
    stmt.close()
    con.close();
    i get this error :[Microsoft][ODBC Driver Manager] Invalid cursor state
    if i use the same code with using re.next(); before rs.moveToInsertRow(); i get [Microsoft][ODBC Microsoft Access Driver]Error in row
    i get the errors right at : rs.updateRow();
    i dont know what exactly the problem is. why doesnt it get updated and complain about it.
    plz help

    I'm not sure which JDBC driver you are using.
    An access database, by default, has a username and
    password as "admin" and "" (ie, empty password).
    Actually MS Access has two methods for security. You
    are referring to one of them.
    If the password of admin is changed, you have to
    provide the name of the workgroup information file
    also( where it is stored) for making a connection.
    I am not sure about the ODBC bridge driver. What iam
    using is Atinav's aveConnet JDBC driver. It has
    provision for giving username and passwords through
    Workgroup information file. In addition to it youcan
    give the database password also.
    Interesting to note. The bridge for MS Access does
    not use that security method. And it will fail if you
    set up security using the groups/users adminstration.
    The only method it allows is via the "database
    password" method.Thank you for your response, but what User ID should I use when I use database password?
    openConnection(URL,"xxxx","database password")
    thanks again
    David Ling

  • Error: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]

    I am having a problem inserting/updateing date field of MS Access database with JDBC. I have tried several solutions. Serveral Field formats in the db and several methods with java. I will post my most recent attempt. I can read from the database I just can't write the date to the db, though I can write to any other field with a different datatype.
    Please don't bash me for using MS Access, it is my only option.
    Error: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Error in row
    if (rs != null){
    while ( rs.next() ) {
    Date tDate;
              //Timestamp tDate;
              //String tDate;
    tDate = rs.getDate("Week");
              //tDate = rs.getTimestamp("Week");
              //tDate = rs.getString("Week");
              java.sql.Date sqlDate = new java.sql.Date( Date.getTime() );
              //java.sql.Timestamp sqlDate = new java.sql.Timestamp( tDate.getTime()
    System.out.println("Date: " + tDate );
    //System.out.println("Date: " + sqlDate );
    //System.out.println("Date: " + rs.getDate ("Date") );
    // 2004-03-24 00:00:00.0 this is Timestamp output
         Cpu.moveToInsertRow();
    Cpu.updateDate("Date_Col",sqlDate );
         //Cpu.updateDate("Date_Col",tDate );
         //Cpu.updateTimestamp("Date_Col", sqlDate);
         Cpu.insertRow();
    Error: java.sql.SQLException: [Microsoft][ODBC Microsoft Access Driver]Error in row
    Please help..........

    I can insert a new row and add all the fields (includeing date (as string)), but I have to use SQL statements. I cannot get the result set functions to work.
    I can retieve a rs just fine and print all the contents of the rs.
    My problem is with rs.updateRow();
    my code is below,
    public class Cpu_Load_Total_Cpu{
    public static void main(String[] args){
    try {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String filename = "C:/dev/SHC/Cpu_Java/CFS_Health.mdb";
    String database = "jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";
    database+= filename.trim() + ";DriverID=22;READONLY=false}";
    Connection con = DriverManager.getConnection( database ,"","");
    Statement stmt = con.createStatement(
    ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_UPDATABLE);
         ResultSet Cpu = stmt.executeQuery("SELECT * FROM Cpu");
    if (Cpu != null){
         while ( Cpu.next() ) {
                   int tUsr, tSys, tWio, tIdle, tTotal_Cpu;
                   tUsr = Cpu.getInt("Usr");
                   tSys = Cpu.getInt("Sys");
                   tWio = Cpu.getInt("Wio");
                   tIdle = 100 - (tSys + tUsr + tWio);
                   tTotal_Cpu = tSys + tUsr + tWio;
                   Cpu.updateLong(8, tTotal_Cpu);
    //or Cpu.updateLong("Total_Cpu", tTotal_Cpu);
    // I get the same error as the post above
    // when I include the Cpu.updateRow(); call
                   Cpu.updateRow();
    // when excluded everything else runs fine, but
    // the db is not updated
    // as stated, everything prints to the screen or pipe when
    // updateRow is excluded
                   System.out.println("Usr: " + tUsr );
                   System.out.println("Sys: " + tSys );
                   System.out.println("Wio: " + tWio);
                   System.out.println("Total_Cpu: " + tTotal_Cpu);
                        con.commit();
                   stmt.close();
                   con.close();
    catch (Exception e) {
    System.out.println("Error: " + e);
    }

  • Random results with  random access query

    Hi,
    when I execute a random access query
    (fetchConfig.setResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE);
    fetchConfig.setFetchDirection(ResultSet.FETCH_UNKNOWN)) and iterate over the
    result set twice, the second time the objects are retrieved in a different
    order, also when I set the ordering of the objects. This only happens if the
    first loop touches the last item. If not, everything works fine. I am using
    MS Sql Server, microsoft driver, kodo 3.4
    regards,
    Christiaan

    Hi,
    I am using datastore identity. I do implement equals and hashcode in the
    super class, not sure whether that is of any impact. The order of the items
    look random to me, however it stays constant after the second loop. The same
    order is also produced when I re-start the test application. The output
    shows the index of the object I am retrieving, the description of the object
    (which is also the order in which the items are created) and their order
    attribute. The query sorts on the order attribute. As you can see the first
    loop is correct. I now and then have the situation where the last item in
    the first loop (retrieve 7) results in the first item (item nr 0) being
    retrieved. Same behaviour applies for both jtds and microsoft driver.
    first loop:
    retrieve 0: item nr: 0 order: 0
    retrieve 1: item nr: 1 order: 1
    retrieve 2: item nr: 2 order: 2
    retrieve 3: item nr: 3 order: 3
    retrieve 4: item nr: 4 order: 4
    retrieve 5: item nr: 5 order: 5
    retrieve 6: item nr: 6 order: 6
    retrieve 7: item nr: 7 order: 7
    second loop
    retrieve 0: item nr: 3 order: 3
    retrieve 1: item nr: 6 order: 6
    retrieve 2: item nr: 7 order: 7
    retrieve 3: item nr: 0 order: 0
    retrieve 4: item nr: 5 order: 5
    retrieve 5: item nr: 4 order: 4
    retrieve 6: item nr: 2 order: 2
    retrieve 7: item nr: 1 order: 1
    third loop
    retrieve 0: item nr: 3 order: 3
    retrieve 1: item nr: 6 order: 6
    retrieve 2: item nr: 7 order: 7
    retrieve 3: item nr: 0 order: 0
    retrieve 4: item nr: 5 order: 5
    retrieve 5: item nr: 4 order: 4
    retrieve 6: item nr: 2 order: 2
    retrieve 7: item nr: 1 order: 1
    "Marc Prud'hommeaux" <[email protected]> wrote in message
    news:[email protected]...
    Christiaan-
    My first guess is are you using application identity, and if so, are you
    correctly implementing the equals() and hashCode() method? Failure to do
    so may conceivably cause this problem.
    Otherwise, can you provide some details about how the results are our of
    order? It it exactly reverse or something, or are elements in random
    order?
    Christiaan wrote:
    Hi,
    when I execute a random access query
    (fetchConfig.setResultSetType(ResultSet.TYPE_SCROLL_INSENSITIVE);
    fetchConfig.setFetchDirection(ResultSet.FETCH_UNKNOWN)) and iterate over
    the result set twice, the second time the objects are retrieved in a
    different order, also when I set the ordering of the objects. This only
    happens if the first loop touches the last item. If not, everything works
    fine. I am using MS Sql Server, microsoft driver, kodo 3.4
    regards,
    Christiaan
    Marc Prud'hommeaux
    SolarMetric Inc.

  • Simple Access SQL problem but can't find any solution

    I have a simple java database connectivity to 3 table database to keep some records everything except one single querry line is not working and I could not figure out why.
    I put the code below I get error message is basically a Too few parameters expected 1 error. Every field name matches the ones database(I'm sure because I have other queries that use same fields in other methods) and it is simple al other queries are working fine except the one that I marked between stars. I put the method's necessary part below.
    Pls help meeeeeeeeeeeeeeee!!!
    int trans_no;
          Class.forName(JDBC_DRIVER);
          Connection DBConnection = DriverManager.getConnection(DATABASE, "admin"," ");
          Statement DBStatement = DBConnection.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
          ResultSet resultSet = DBStatement.executeQuery("SELECT TransactionNo FROM TransTable");
          resultSet.last();
          if(resultSet.getRow() == 0)
              trans_no = 1;
          else
          trans_no = resultSet.getInt(1)+1;
          String exit_time = exit_date.substring(0,8);
          String exit_day = exit_date.substring(11,exit_date.length());
          String receipt_time = receipt_date.substring(0,8);
          String receipt_day = receipt_date.substring(11,receipt_date.length());
             resultSet = DBStatement.executeQuery("SELECT RcptNo FROM RcptTable WHERE ReceiptTime = '"+receipt_time+"'")
             DBStatement.executeUpdate("INSERT INTO TransTable (TransactionNo, RcptNo, RcptDate, RcptTime, ExitDate, ExitTime, TotalAmount, Change) " +
          "VALUES ('"+trans_no+"', '"+"2"+"', '"+receipt_day+"', '"+receipt_time+"', '"+exit_day+"', '"+exit_time+"', '"+Amount+"', '"+Change+"')");//resultSet.getInt(1)

    "SELECT RcptNo FROM RcptTable WHERE ReceiptTime = '"+receipt_time+"'"
    In MS Access, this exception occurs when the column names specified in the query are not correct. Check the table definition and verify the column names.

  • Accessing rows in ResultSet

    Hello All,
    I have a ResultSet with 1000 rows. I know that we can use the next() to step through each row in the ResultSet but can anyone tell me how to access specific rows. For example 500th row etc.
    Thanks

    if u use absolute() or relative() make sure that you have to open a scroll cursor. this can be accomplished by (from the jdbc documentation):
    Statement stmt = con.createStatement(
    ResultSet.TYPE_SCROLL_INSENSITIVE,
    ResultSet.CONCUR_UPDATABLE);
    ResultSet rs = stmt.executeQuery("SELECT a, b FROM TABLE2");
    // rs will be scrollable, will not show changes made by others,
    // and will be updatable
    Cheers
    Lothar

  • Why self-defined access sequences of free goods can not work?

    Hi gurus,
    I have maintained access sequences of free goods self-defined.but when i creat the SO it does not work!
    when i used the standard access sequences ,it is OK .
    Can anybody tell me why?
    thanks in advance

    Dear Sandy,
    Go to V/N1 transaction select your self defined access sequence then go in to the accesses and fields and check all fields are activated.
    Make sure that these fields are flowing in your sales order.
    I hope this will help you,
    Regards,
    Murali.

  • Partner application access to portal login info

    How can an SSO partner application (Java) tell whether or not a user has logged in to Portal?
    I need to log activity in a public application servlet, so I'd like to log the user as PUBLIC if not logged in or as their actual userid.
    I don't seem to have access to this info until the user has visited a secure part of the app.
    Any pointers would be appreciated.
    Thanks
    Rob

    DIY answer ...
    The cludge I used to get round this was ...
    Make a PL/SQL item which displays a Login or Logout link as appropriate, based on the current userid from portal.wwctx_api.get_user.
    The login link goes to a secure portal page called FORCE_LOGIN, passing a URL parameter called nextPageURL which contains the URL of the next page to show after the login is complete. You can use portal.wwpro_api_parameters.get_value( '_pageid', 'a'); to help build the current page URL if you want to retun to the current page.
    The FOIRCE_LOGIN page contains a PL/SQL item which builds an IFRAME whos src is a URL to my app servlet ForceLoginServlet, passing on the nextPageURL parameter. Use portal.wwpro_api_parameters.get_value( 'nextPageURL', 'a'); to help with that.
    The ForceLoginServlet is a secure servlet (set up in web.xml) so that forces a silent authentication to my app. All the servlet does is display HTML to redirect back to the URL in nextPageURL.
    Horrible! But it does the job.
    Anyone who know a better way of doing this, please tell me.
    Rob

  • How to allow access to web service running under ApplicationPoolIdentity

    Hi All,
    I have a WCF web service hosted in IIS 7 (or maybe 7.5, whichever comes with Windows server 2008 R2) using DefaultAppPool running under ApplicationPoolIdentity per Microsoft's recommendation. The web service needs to call a stored procedure to insert data
    to a db. The web server is on a different VM than the database server. The db server is running SQL 2008 R2. Both VMs run Windows server 2008 R2.
    When the web service tries to connect to db, it encounters this exception:
    Exception in InsertToDb()System.Data.SqlClient.SqlException (0x80131904): Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
    Here's the connection string in web.config:
    Application Name=somewebservice;Server=somewebserver;Integrated Security=SSPI;Database=somedatabase;Connection Timeout=60"
    How should I configure SQL security to make this work?
    Thanks in advanced.

    Thanks for the link Dan. Maybe I'm the one who cause the confusion :)
    If I understand you(and Erland) correctly, you suggest using a custom, domain account for application pool identity. However, if we do that, our IT will need to maintain those accounts, and they don't  want that. So I'm choosing a built-in account called
    ApplicationPoolIdentity as the application pool identity, but it's not working. Network Service, on the other hand, works, but my boss wants us to follow MS's best practice.
    What's puzzling is that according to this: http://learn.iis.net/page.aspx/624/application-pool-identities/, both Network Service and ApplicationPoolIdentity uses machine account to access network resource (like db in this case), but in my case, Network Service
    works, but not ApplicationPoolIdentity.
    Hallo Stephen,
    with respect - it seems to me that only idiots are working at your IT ;)... It is absolutely useful to work with "service accounts" created within the domain. That's the only way to manage and control accounts!
    If you want to "pass through" the identity of the web user (SSO) you have to check whether the app pool is set to "allow impersonate". As far as I understand the ApplicationPoolIdentity-function the app pool will create a unique user named as the service.
    I assume that will not work with the connection to the sql server because this user is unknown.
    Local Service will not work because it's restriction is located to the local machine.
    Network Service will work because access to network resources will be available.
    So my recommendation is to use a dedicated service account or impersonation:
    http://msdn.microsoft.com/en-us/library/xh507fc5.aspx
    Uwe Ricken
    MCITP Database Administrator 2005
    MCITP Database Administrator 2008
    MCITS Microsoft SQL Server 2008, Database Development
    db Berater GmbH
    http://www-db-berater.de

Maybe you are looking for

  • Safari wont open to its homepage at login

    Hi all: I have Safari set to "Open at Login" and to open with a new window, to the home page. It does open at login, but does not open the new window. Anyone know why? It's Safari 5.1.7, and 10.6.8. (Firefox behaves correctly, by the way) Also, me mu

  • How to set the text of a cell in Numbers to vertical direction? Tks.

    Hi In Numbers, please tell me how to switch the text of a cell to vertical direction? Tks.

  • Question on Formula Creation in Numbers

    I am creating a form that involves two columns, both of which involve the same formulation. On the first I start with $200,000.00, which increases in increments of $50,000 up to $2,000,000. Is there a way to set up a stepper that would accomplish thi

  • Loading and running consecutive scripts in LabVIEW

    Hello,  I'd like to start this by saying that I'm very new to LabVIEW so I apologize for any questions that should seem obvious. Also, when replying please remember I'm not as familiar as I would like to be with LabVIEW in general. I have recently ha

  • I want to invoke an journal form with Specific journal i have je_header_id

    i made a custom form this form create journals in gl by gl_interface aftre creation i want to see my creation journlas by clil in the butoon in cutom form this button will invoke stander journal form and show olnly the journal i sand his id ( paramte