MS access,servlets and jdbc-odbc

when i try to connect to ms access database using servlet i get unable to open registry key DriverId problem.
servlet successfully extracts the form data.Even jdbc code alone works fine, but when jdbc code is embeded in servlet I get the above error.I am using java web server 2.0 and a jdbc-odbc(type 1) driver.
Please help me.................!
I cannot proceed with my project without solving this problem.

You have not specified the exception class.
If it is java.security, try peeping into jws security directory, and set the access to your servlet directory.
I do not know this helped you or not.
regards

Similar Messages

  • J2EE and JDBC-ODBC bridge driver

    Hi all,
    in my application I want to access an ODBC database to get the data and put it into cloudscape. In my resources.properties I added the jdbc driver
    jdbcDriver.1.name=sun.jdbc.odbc.JdbcOdbcDriverand also added a datasource
    jdbcDataSource.5.name=jdbc/MyOdbc
    jdbcDataSource.5.url=jdbc\:odbc\:odbc-nameAfter starting j2ee 1.3.1 the server reports following error:
    Error in creating data source object: jdbc/MyOdbcWhat's going wrong? Thanks for your help.
    -chris

    additional information:
    The phenomenon happens only if I use J2SDK 1.4.0. Running the 1.3.1 the driver is loaded without any problems.
    Is it a security issue or am I not allowed to use 1.4 because it's too new?
    -chris

  • Ms Access problems with Jdbc Odbc!!!

    Hi again people,
    Im creating a GUI swing project connecting a database (MsAccess) to a dialog using the bridge driver,
    The GUI is coming up but im getting runtime errors and the data does not go to the fields, the dialog and connection are in two files:
    import java.awt.*;
    import java.awt.event.*;
    import java.sql.*; //SQL package for the statements
    import javax.swing.*;
    class DatabaseMan
         public ResultSet m_resultSet; //recordset resulting from SQL query
         public ResultSetMetaData m_rsmd; //used to get general info about the columns
         private int m_nNumberOfFields; //number of fields in a recordset
         private Connection conn;
         private Statement stmt;
         public DatabaseMan(String strSQLQuery)
              try
                   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");          
                   try               //establish connection to the database
                        //try to get connection to the database
                        conn = DriverManager.getConnection("jdbc:odbc:db1");
                        //this is not where we update the database so we make it read only
                        stmt = conn.createStatement( ResultSet.TYPE_SCROLL_INSENSITIVE,
                                                                     ResultSet.CONCUR_READ_ONLY);                                   
                        m_resultSet = stmt.executeQuery(strSQLQuery);
                   catch(SQLException exSQL)
                        System.err.println("\n\n\t\t ***SQLException has" +
                                                 "been caught ***\n\n");
                   while ( exSQL != null)
                        System.err.println("\nSQLState : " + exSQL.getSQLState() );
                   System.err.println("\nMessage : " + exSQL.getMessage() );
                             System.err.println("\nVendor code : "+ exSQL.getErrorCode() );
                             System.err.println("\n");
                             exSQL = exSQL.getNextException();
              catch( ClassNotFoundException e)
                   System.err.print("\n\n\tClassNotFoundException has"
                                       +" been caught");
                   System.err.println( e.getMessage());
              catch( java.lang.Exception ex )
                   ex.printStackTrace();
         public void CloseConnection() //close connection to database
              try
                        conn.close();
                        stmt.close();
                        m_resultSet.close(); //release the resources
                   catch (SQLException exSQL )
                        System.out.println("SQL Exception: " + exSQL.getMessage());
                        exSQL.printStackTrace(System.out);
         public int getNoFields()
              return m_nNumberOfFields;
    } //end of DatabaseMan.java
    import java.awt.*;
    import java.awt.event.*;
    import java.sql.*;
    import DatabaseMan;
    import javax.swing.*;
    class DBviewer extends JDialog implements ActionListener
         //JButtons to create toolbar
         private JButton m_buttonFirst;
         private JButton m_buttonNext;
         private JButton m_buttonPrevious;
         private JButton m_buttonLast;
         private JButton m_buttonClose;
         private JButton m_mainbuttonClose;
         //textfields to transfer the data from database
         private JTextField m_name;
         private JTextField m_age;
         private JTextField m_weight;
         private JTextField m_professionalism;
         private JTextField m_speed;
         private JTextField m_acceleration;
         private JTextField m_jump;
         private JTextField m_stamina;
         private JTextField m_bravery;
         private JTextField m_fitness;
         private JTextField m_experience;
         //labels to identify the textfields
         private JLabel m_labelname;
         private JLabel m_labelage;
         private JLabel m_labelweight;
         private JLabel m_labelspeed;
         private JLabel m_labelacceleration;
         private JLabel m_labelprofessionalism;
         private JLabel m_labeljump;
         private JLabel m_labelstamina;
         private JLabel m_labelbravery;
         private JLabel m_labelfitness;
         private JLabel m_labelexperience;
         DatabaseMan m_DatabaseMan;
         private String strSQLQuery1;
         private String type1 = new String("");
         public DBviewer(Frame parent, String caption, boolean bModal, String type)
              super(parent,caption,true);
              setSize(600,400);
              setLocation( new Point(150 , 150 )); //position it pops up on screen.
              setResizable(false);
              strSQLQuery1 = new String("");
              type1 = type;
              //SQL query to show the horse database
              if(type =="Horse")
                   strSQLQuery1 ="SELECT *" +
                                  "FROM HORSE";
                   buildHorseGUI();
              if(type =="Jockey")
                   strSQLQuery1 ="SELECT *" +
                                  "FROM JOCKEY"+
                                  " ORDER BY NAME";
                   buildJockeyGUI();                         
              if(type =="Course")
                   strSQLQuery1 ="SELECT *" +
                   "FROM RACECOURSE"+
                                  " ORDER BY NAME";
                   buildCourseGUI();
              m_DatabaseMan = new DatabaseMan(strSQLQuery1);
              /*try
              {//reset values with default move up to top later
                   if(m_DatabaseMan.m_resultSet.first())
                        transferData(type1);
              catch( SQLException exSQL)
                   System.out.println("SQL Exception: " + exSQL.getMessage());
                   exSQL.printStackTrace(System.out);
         public void buildHorseGUI() //construct the horse GUI
              buildDefaultGUI(); //build default buttons and toolbar
              m_labelname = new JLabel(" Horse Name:",JLabel.CENTER);
              m_labelname.setBackground(Color.blue);
              m_labelname.setForeground(Color.white);
              m_labelage = new JLabel("Age: ",JLabel.CENTER);
              m_labelage.setBackground(Color.blue);
              m_labelage.setForeground(Color.white);     
              m_labelweight = new JLabel("Weight(p): ",JLabel.CENTER);
              m_labelweight.setBackground(Color.blue);
              m_labelweight.setForeground(Color.white);
              m_labelspeed = new JLabel("Speed:",JLabel.CENTER);
              m_labelspeed.setBackground(Color.blue);
              m_labelspeed.setForeground(Color.white);
              m_labelacceleration = new JLabel("Acceleration:",JLabel.CENTER);
              m_labelacceleration.setBackground(Color.blue);
              m_labelacceleration.setForeground(Color.white);
              m_labelprofessionalism = new JLabel("Professionalism:",JLabel.CENTER);
              m_labelprofessionalism.setBackground(Color.blue);
              m_labelprofessionalism.setForeground(Color.white);
              m_labeljump = new JLabel("Jump:",JLabel.CENTER);
              m_labeljump.setBackground(Color.blue);
              m_labeljump.setForeground(Color.white);
              m_labelstamina = new JLabel("Stamina:",JLabel.CENTER);
              m_labelstamina.setBackground(Color.blue);
              m_labelstamina.setForeground(Color.white);     
              m_labelbravery = new JLabel("Bravery:",JLabel.CENTER);
              m_labelbravery.setBackground(Color.blue);
              m_labelbravery.setForeground(Color.white);
              m_labelfitness = new JLabel("Fitness:",JLabel.CENTER);
              m_labelfitness.setBackground(Color.blue);
              m_labelfitness.setForeground(Color.white);     
              m_labelexperience = new JLabel("Experience",JLabel.CENTER);
              m_labelexperience.setBackground(Color.blue);
              m_labelexperience.setForeground(Color.white);          
              //creation of textfields to hold the data
              //making them non-editable and b/ground of black with white text
              m_name = new JTextField(20);
              m_name.setEditable(false);
              m_name.setBackground(Color.black);
              m_name.setForeground(Color.white);
              m_age = new JTextField(2);
              m_age.setEditable(false);
              m_age.setBackground(Color.black);
              m_age.setForeground(Color.white);
              m_weight = new JTextField(3);
              m_weight.setEditable(false);
              m_weight.setBackground(Color.black);
              m_weight.setForeground(Color.white);
              m_speed = new JTextField(2);
              m_speed.setEditable(false);
              m_speed.setBackground(Color.black);
              m_speed.setForeground(Color.white);
              m_acceleration = new JTextField(2);
              m_acceleration.setEditable(false);
              m_acceleration.setBackground(Color.black);
              m_acceleration.setForeground(Color.white);
              m_professionalism = new JTextField(2);
              m_professionalism.setEditable(false);
              m_professionalism.setBackground(Color.black);
              m_professionalism.setForeground(Color.white);
              m_jump = new JTextField(2);
              m_jump.setEditable(false);
              m_jump.setBackground(Color.black);
              m_jump.setForeground(Color.white);
              m_stamina = new JTextField(2);
              m_stamina.setEditable(false);
              m_stamina.setBackground(Color.black);
              m_stamina.setForeground(Color.white);
              m_bravery = new JTextField(2);
              m_bravery.setEditable(false);
              m_bravery.setBackground(Color.black);
              m_bravery.setForeground(Color.white);
              m_fitness = new JTextField(2);
              m_fitness.setEditable(false);
              m_fitness.setBackground(Color.black);
              m_fitness.setForeground(Color.white);
              m_experience = new JTextField(2);
              m_experience.setEditable(false);
              m_experience.setBackground(Color.black);
              m_experience.setForeground(Color.white);
              //create a panel to hold this data
              Panel data = new Panel();
              data.setLayout(new GridLayout(0,4));
              data.setBackground(Color.blue);
              data.add(m_labelname);
              data.add(m_name);
              data.add(m_labelage);
              data.add(m_age);
              data.add(m_labelweight);
              data.add(m_weight);
              data.add(m_labelspeed);
              data.add(m_speed);
              data.add(m_labelacceleration);
              data.add(m_acceleration);
              data.add(m_labelprofessionalism);
              data.add(m_professionalism);
              data.add(m_labeljump);
              data.add(m_jump);
              data.add(m_labelstamina);
              data.add(m_stamina);
              data.add(m_labelbravery);
              data.add(m_bravery);
              data.add(m_labelfitness);
              data.add(m_fitness);
              data.add(m_labelexperience);
              data.add(m_experience);
              getContentPane().add(data, BorderLayout.CENTER);
         public void buildDefaultGUI() //construct the default components for GUI
              JToolBar wndToolBar = new JToolBar();
              wndToolBar.setBackground(Color.green);
              wndToolBar.setFloatable(false);
              m_buttonFirst = new JButton( new ImageIcon( "graphic/myFirst.gif" ) );
              m_buttonPrevious = new JButton(new ImageIcon( "graphic/myPrevious.gif" ) );
              m_buttonNext = new JButton(new ImageIcon( "graphic/myNext.gif" ) );
              m_buttonLast = new JButton(new ImageIcon( "graphic/myLast.gif" ) );
              m_buttonClose = new JButton(new ImageIcon( "graphic/myClose.gif" ) );
              m_mainbuttonClose = new JButton("CLOSE");
              // implement action listener
              m_buttonFirst.addActionListener(this);
              m_buttonPrevious.addActionListener(this);
              m_buttonNext.addActionListener(this);
              m_buttonLast.addActionListener(this);
              m_buttonClose.addActionListener(this);
              m_mainbuttonClose.addActionListener(this);
              //set the tool tips for each of the button
              m_buttonFirst.setToolTipText( "Display first record" );
              m_buttonPrevious.setToolTipText( "Display previous record" );
              m_buttonNext.setToolTipText( "Display next record" );
              m_buttonLast.setToolTipText( "Display last record" );
              m_buttonClose.setToolTipText( "Close this window and return to game" );
              m_mainbuttonClose.setToolTipText( "Close this window and return to game" );
              m_mainbuttonClose.setBackground(Color.green);
              //add these buttons to the toolbar
              wndToolBar.add( m_buttonFirst );
              wndToolBar.add( m_buttonPrevious );
              wndToolBar.add( m_buttonNext );
              wndToolBar.add( m_buttonLast );
              wndToolBar.addSeparator(); //separator in the toolbar
              wndToolBar.add( m_buttonClose );
              getContentPane().add(wndToolBar, BorderLayout.NORTH);
              getContentPane().add(m_mainbuttonClose, BorderLayout.SOUTH);
         public void buildCourseGUI() //construct the course GUI
              buildDefaultGUI();
         public void buildJockeyGUI() //construct the jockey GUI
              buildDefaultGUI();
         public void actionPerformed( ActionEvent evt)
              //button first record is pressed
              if( evt.getSource() == m_buttonFirst )
                   try
                        if( m_DatabaseMan.m_resultSet.first() )
                             transferData(type1);
                   catch (SQLException exSQL )
                        System.err.println( exSQL.toString() );
              //button next record is pressed
              if( evt.getSource() == m_buttonNext )
                   try
                        if(!m_DatabaseMan.m_resultSet.isLast())
                             if(m_DatabaseMan.m_resultSet.next())
                                  transferData(type1);
                   catch (SQLException exSQL )
                        System.err.println( exSQL.toString() );
              //previous button is pressed
              if( evt.getSource() == m_buttonPrevious )
                   try
                        if( !m_DatabaseMan.m_resultSet.first())
                             if(m_DatabaseMan.m_resultSet.previous())
                                  transferData(type1);
                   catch (SQLException exSQL )
                        System.err.println( exSQL.toString() );
              //last button is pressed
              if( evt.getSource() == m_buttonLast )
                   try
                        if(m_DatabaseMan.m_resultSet.last())
                             transferData(type1);
                   catch (SQLException exSQL )
                        System.err.println( exSQL.toString() );
              // close button(s) pressed
              if( evt.getSource() == m_buttonClose)
                   setVisible( false );
                   dispose(); //return the dialog window resources
                   m_DatabaseMan.CloseConnection();
              if( evt.getSource() == m_mainbuttonClose)
                   setVisible( false );
                   dispose(); //return the dialog window resources
                   m_DatabaseMan.CloseConnection();
         public void transferData(String type1) throws SQLException //return a String
              if(type1 =="Horse")
                   //transfer horse details
                   m_name.setText(m_DatabaseMan.m_resultSet.getString("NAME"));
                   m_professionalism.setText(m_DatabaseMan.m_resultSet.getString("PROFESSIONALISM"));
                   m_speed.setText(m_DatabaseMan.m_resultSet.getString("SPEED"));
                   m_stamina.setText(m_DatabaseMan.m_resultSet.getString("STAMINA"));
                   m_weight.setText(m_DatabaseMan.m_resultSet.getString("WEIGHT"));
                   m_experience.setText(m_DatabaseMan.m_resultSet.getString("EXPERIENCE"));
                   m_fitness.setText(m_DatabaseMan.m_resultSet.getString("FITNESS"));
                   m_jump.setText(m_DatabaseMan.m_resultSet.getString("JUMP"));
                   m_age.setText(m_DatabaseMan.m_resultSet.getString("AGE"));
                   m_bravery.setText(m_DatabaseMan.m_resultSet.getString("BRAVERY"));
                   m_acceleration.setText(m_DatabaseMan.m_resultSet.getString("ACCELERATION"));
              if(type1 =="Jockey")
                   m_name.setText(m_DatabaseMan.m_resultSet.getString("NAME"));
                   m_age.setText(m_DatabaseMan.m_resultSet.getString("AGE"));
              if(type1 =="Course")
                   //transfer course details not implemented yet
    } //end of class DBviewer
    I ve set up an odbc driver and the database has data in it but I still get this run time error an no data is transfered to the dialog box
    java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1525)
    at sun.jdbc.odbc.JdbcOdbcResultSet.reWordAsCountQuery(JdbcOdbcResultSet.java:6268)
    at sun.jdbc.odbc.JdbcOdbcResultSet.calculateRowCount(JdbcOdbcResultSet.java:6061)
    at sun.jdbc.odbc.JdbcOdbcResultSet.initialize(JdbcOdbcResultSet.java:150)
    at sun.jdbc.odbc.JdbcOdbcStatement.getResultSet(JdbcOdbcStatement.java:420)
    at sun.jdbc.odbc.JdbcOdbcStatement.executeQuery(JdbcOdbcStatement.java:250)
    at DatabaseMan.<init>(DatabaseMan.java:34)
    at DBviewer.<init>(DBviewer.java:83)
    at MainWindow.actionPerformed(MainWindow.java:266)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1450)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1504)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:378)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:250)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:216)
    at java.awt.Component.processMouseEvent(Component.java:3715)
    at java.awt.Component.processEvent(Component.java:3544)
    at java.awt.Container.processEvent(Container.java:1164)
    at java.awt.Component.dispatchEventImpl(Component.java:2593)
    at java.awt.Container.dispatchEventImpl(Container.java:1213)
    at java.awt.Component.dispatchEvent(Component.java:2497)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2451)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2216)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2125)
    at java.awt.Container.dispatchEventImpl(Container.java:1200)
    at java.awt.Window.dispatchEventImpl(Window.java:914)
    at java.awt.Component.dispatchEvent(Component.java:2497)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:339)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:131)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:98)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:85)
    Im really stuck!!! any suggestions? thanks in advance

    Thank you for your response and sorry for the length
    of code,
    Thats was my first idea that it was asking for
    or something I dont have but I checked my database and
    I dont have any unusually large data entries (most
    between 8-15 letters, the others are numbers) could it
    be something wrong with how I've entered the database
    in MsAccess, or am i barking up the wrong tree again!
    Many thanks
    RobI think you've misunderstood me. This has nothing to do with unusually large data entries, but rather the opposite. You are wrongly expecting data that is shorter than you think. When you call rs.getString(i) to retrieve a column value of a field, and you only want the first 5 characters in the column (instead of 10 or whatever the column size is), you would do something similar to the following:
    String column_value = rs.getString(1).subtstring(0,5);The above expects a String that is at least 5 characters. Your problem is when your column value returned is less than the specified substring index ( in this case 5 ) it will throw an exception. If you changed your code to this, the error will not occur:
    String column_value = rs.getString( 1 ).subtstring( 0, 5);
    if ( column_value.length() > 5 )
    column_value = column_value.substring( 0, 5 );
    }Jamie

  • Applets and JDBC-ODBC Bridge

    I have the following error when i try to run my program(I have used JFrame instead of JApplet ) :
    [Microsoft] [ODBC Driver Manager] Invalid cursor state
    I'm using VJ# and i read on oreilly's site that JDBC-ODBC bridge doesn't work with it, so how should i resolve the problem?
    could somebody suggest a better and easy-to-use Type 1 driver(which is free)

    Closing the statements defeats the purpose of prepared statements with my design. The whole point is to load them at startup and reuse them.
    Another driver is an option however where does one get one and are they free?
    I have implemented a temporary solution that I found in the archives. I have used a while statement to make sure that I have got to the end of the result set, however a nested if only looks for the first result. I am only retrieving one row from the database so only need the first. Logic says to me that rs.next() must have to evaluate to false. It is a bit messy but it works . . . so far.
    L

  • Com.mysql.jdbc.driver and jdbc:odbc bridge driver

    Hi All,
    I want to update mysql database from data in hashtable. My application already uses JDBC:OBDC bridge driver for retrieving data from excel sheet and putting in hashtable.
    For connecting to mysql i need to use com.mysql.jdbc.driver too in the same code.
    How to do that?
    my code uses.
    Read(String strFilePath,String strFileName)
               filepath = strFilePath;
               filename = strFileName;
                strDriver= "jdbc:odbc:Driver={MicroSoft Excel Driver (*.xls)}";Thanks

    Please stay with one thread:
    http://forum.java.sun.com/thread.jspa?threadID=5145466&tstart=0
    Please don't cross-post this way.

  • Problem with Stored Procedure and inout parameter and jdbc-odbc bridge

    create or replace procedure test_proc( para in out number) as
    begin
    if para = 1 then
    para := 11111;
    else
    para := 22222;
    end if;
    end;
    public static void main(String args[]) throws Exception{
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String url = "jdbc:odbc:test3";
    String uid = "scott";
    String pwd = "tiger";
    Connection conn = DriverManager.getConnection(url,uid,pwd);
    CallableStatement cstmt = conn.prepareCall("{call test_proc(?)}");
    cstmt.registerOutParameter(1,Types.INTEGER);
    cstmt.setInt(1,1);
    cstmt.execute();
    System.out.println("para = " + cstmt.getInt(1));
    cstmt.close();
    conn.close();
    I get the following errors:
    Exception in thread "main" java.lang.NumberFormatException:
    at java.lang.Integer.parseInt(Integer.java:426)
    at java.lang.Integer.<init>(Integer.java:540)
    at sun.jdbc.odbc.JdbcOdbcCallableStatement.getInt(JdbcOdbcCallableStatement.java:385)
    at test_proc.main(test_proc.java:11)
    How can i get the correct result: 1111
    Note: The Oracle jdbc driver can gets the correct result.
    Pls help me! Thanks!

    Hello,
    I presume you have created the stored procedure with an INOUT parameter?

  • Servlets and JDBC - Best Way to Create Connections?

    Hi,
    I have a very simple servlet that executes a query and returns the result for a true/false test.
    The connection is created when the servlet is initialized:
    public void init(ServletConfig config) throws ServletException {
    dbConnection(); //Creates datasource and connection objects
    super.init(config);
    The connection object is used in the doGet() method. This works fine except after periods of extended inactivity (24 - 48 hours) when the connection is dropped for some reason (network related I believe).
    My question is, can I (should I) create and close the connection in the doGet() method? Or am I asking for trouble if I get a large number of concurrent requests?
    If I shouldn't create and close the connection in the doGet() method, how can I ensure a connection is available when the doGet() method is called?
    Thanks in advance for any suggestions.
    Jim

    you write a class something like this :
    class myLogic {
    private static DataSource ds ;
    static {
    if(ds==null)
         ds = Look up from the context root (jdbc/dsMy);
    public boolean checkExists() throws Exception{
    Connection con = ds.getConnection();
         // put your logic here
    con.close();
    And you call that class from the doGet() of servlet

  • Servlets and JDBC

    I am new to the JDBC API, but I am trying to create a connection to Oracle 11i through JDBC in a Servlet's init() methid. The problem is that I don't seem to be entering my init() method. I get a NullPointerException when I attempt to reference the Connection object that is instatiated in the init() method. Here is my init() method:
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    try {
    //Loads the Oracle JDBC Driver
    Class.forName("oracle.jdbc.driver.OracleDriver");
    //Connect to the DataBase
    con = DriverManager.getConnection ("jdbc:oracle:thin:@63.121.58.32:1526:POAPN003",
    "xxrot", "xxrot");
    } catch(ClassNotFoundException e){}
    catch(SQLException e) {}
    If there is anything that you can see that I need to do to get the Connection created correctly, I would really appreciate the help. I have created the Connection con as an instance variable.

    I think that the main problem that I am having though is that the init() method isn't throwing the exceptions. When I try to create a Statement object in order to create some SQL, that is when I get the NullPointerException. Here is the code that I found thru debugging that gave me the exception.
    try {Statement stmt = con.createStatement();
    //if(v_Customer_no != null)
           //   rs = stmt.executeQuery("SELECT *");
        // else
             // rs = stmt.executeQuery("SELECT * FROM ROT_PRODUCT where Customer_ID="+ v_customer_id +
                                        //  "AND Inventory_Item_ID="+ v_product_id);
             }catch (Exception e) { System.out.println("Here is the first error"); }
    Since I commented out all of the code in this try block, I found that the exception had to be when I was creating the Statement from the Connection object. That is why I thought that the error may have occurred in the init() method where the Connection is first dealt with. Any other thoughts then? Thanks for the help.

  • Powershell to create link between Access database and an ODBC Pervasive database

    So, I have the following script (thanks to JRV!):
    function Link-ExternalODBCTable{
          Param(
             $accessFile,
             $tableName,
             $tableName2
         if(-not $tableName2){$tableName2=$tableName1}
         $access.DoCmd.TransferDatabase(
                 [microsoft.office.interop.access.AcDataTransferType]::acLink,
                'ODBC Database',
                $accessFile,
                [microsoft.office.interop.access.AcObjectType]::acTable,
                 $tableName,
                 $tableName2
    $testODBC='ODBC;DSN=A1013v2012'
     Add-Type -Assembly Microsoft.Office.Interop.Access
     $access = New-Object -ComObject Access.Application
     $Access.OpenCurrentDataBase("E:\MyDir\TagLink.mdb")
     Link-ExternalODBCTable $testODBC all_per
     $access.CloseCurrentDataBase()
    What I get is:
    Exception calling "TransferDatabase" with "6" argument(s): "ODBC--connection to 'A1013v2012' failed."
    When I try from the ODBC Administrator, it tests fine (Connection Successful!). This is a 32-bit ODBC connection, using the Pervasive ODBC Engine Interface. Same as we use for other ODBC connections to this database. It is a System DSN, as opposed to User
    or File.
    I tried to skinny this down to:
    Add-Type -Assembly Microsoft.Office.Interop.Access
     $Access = New-Object -ComObject Access.Application
     $Connected = $Access.OpenCurrentDataBase("E:\MyDir\TagLink.mdb")
     $access.DoCmd.TransferDatabase(
                 [microsoft.office.interop.access.AcDataTransferType]::acLink,
                'ODBC Database',
                'ODBC;DSN=A1013v2012',
                [microsoft.office.interop.access.AcObjectType]::acTable,
                 'all_per',
                 'all_per'
     $Disconnected = $Access.CloseCurrentDataBase()
    ...which yields the same error.
    Where am I going wrong here?
    mpleaf

    If I try that, I get a new message:
    Exception calling "TransferDatabase" with "6" argument(s): "Could not find installable ISAM."
    The article you reference, I believe, is for SQL connection, not Pervasive SQL. I know the DSN works fine. We use it for other things a LOT.
    I'm at a loss...and I can't seem to find the right combination...
    mpleaf
    The point is that newer Access does not appear to support DSNs on ODBC without an full ODBC driver.  If you go DSN-less you will include the provider.
    Pervasive has always been a pain.  They break all rules and always have.  If this is Intuit Pervasive then it is even worse.
    ¯\_(ツ)_/¯

  • Servlet and JDBC on linux

    Hi,
    I am running a servlet program on linux that retrieves some information from oracle database using jdbc.
    I can run a normal java application also on linux with a database connection:
    Class.forName("oracle.jdbc.OracleDriver");
    Connection con = DriverManager.getConnection("jdbc:oracle:oci:@dbname", "username", "pswd");
    For the same code above I have not been able to retrieve data from the same oracle database name.
    I do not understand why I can use jdbc in a normal java program, but not in a servlet program.
    Could someone please explain the problem to me?
    Thanks

    The alternative is to use the Sun rmic, which you'll find (probably) lives somewhere near javac, javap, javah et cetera.
    You are not using the sun rmic, as the stacktrace shows.
    Dont just tell us that your 'paths are all correct' - post the invocation of the compiler that causes the stacktrace, along with some environment, then you might get some more detailed help

  • Servlet and Database access

    This is my first database program using servlet. Also I use ECS to create the HTML document.
    I accept data from a HTML page and display on the screen as well as writing to a TABLE (in instantDB)
    Do I have to have the database connection in INIT() method ?
    -------------Here's the code ---------------------------------------------------
    public class work2_db extends HttpServlet {
    public void doPost(HttpServletRequest request,
              HttpServletResponse response)
    throws ServletException, IOException {
    response.setContentType("text/html");
    PrintWriter out = response.getWriter();
    String dbName = "db";
         String tableName = "survey";
         Connection conn = null;
         Statement stmt = null;
         System.out.print("\nLoading JDBC driver...\n\n");
         try {
         // InstantDB JDBC driver
         Class.forName("com.lutris.instantdb.jdbc.idbDriver");
         // MS Access, use default JDBC-ODBC driver
         // Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         } catch(ClassNotFoundException e) {
         e.printStackTrace();
         System.exit(1);
         try {
         System.out.print("Connecting to " + dbName + " database...\n\n");
         // InstantDB
         String url = "jdbc:idb:" + dbName;
         // InstantDB, specify the configuration file name in URL
         conn = DriverManager.getConnection(url + ".prp");
         // MS Access
         //conn = DriverManager.getConnection(url);
         System.out.println("Connected to and created database " + dbName);
         System.out.print("Accessing new " + tableName + " table...\n\n");
         stmt = conn.createStatement();
         } catch (SQLException se) {
         se.printStackTrace();
         System.exit(1);
    int id=0;
    //Go to the last record of the result set to get the next Survey ID
    String queryString = "SELECT * FROM " + tableName ;
         ResultSet rset = stmt.executeQuery(queryString);
         while (rset.next()) {
         id = rset.getInt("surveyid");
         id++; // This is the Survey ID for this new survey.
    rset.close();
    int service[] = {0,0,0,0,0,0};
    int level[] = {0,0,0,0,0};
    Body body = new Body();
    Html html = new Html()
    .addElement(new Head()
         .addElement(new Title("Survey Conformation")))
    .addElement(body);
    body.addElement(new H1("Thank you! Your Survey is accepted."));
    body.addElement(request.getParameter("salutation") + " " +
              request.getParameter("firstname") + " " +
              request.getParameter("lastname"))
    .addElement(new BR());
    body.addElement(request.getParameter("company"))
    .addElement(new BR());
    body.addElement(request.getParameter("street"))
    .addElement(new BR());
    body.addElement(request.getParameter("city") + " " +
              request.getParameter("state") + " " +
              request.getParameter("postal"))
    .addElement(new BR());
    body.addElement(request.getParameter("country"))
    .addElement(new BR());
    body.addElement("Email: " + request.getParameter("email"))
    .addElement(new BR())
    .addElement(new BR());
    body.addElement("You Travelled with us to : " +
              request.getParameter("destination"))
    .addElement(new BR());
    body.addElement("You used our following Services : ");
    body.addElement(new BR());
    String values[] = request.getParameterValues("service");
    if (values != null) {
    UL list = new UL();
    for (int i = 0; i < values.length; i++) {
         list.addElement(new LI(values));
         // setup category 1 feedback
         if (values[i] != null)
         service[i] = 1;
    body.addElement(list);
    body.addElement(new BR());
    body.addElement("Your satisfaction level : ");
         body.addElement(request.getParameter("level") + " " +
                   request.getParameter("good") + " " +
                   request.getParameter("better") + " " +
                   request.getParameter("best") + " " +
                   request.getParameter("very poor quality") + " " +
                   request.getParameter("none"))
    .addElement(new BR());
    body.addElement("You said we Can improve our Service as follows: " +
              request.getParameter("comments"));
    out.println(html.toString());
    //set up category level feed back
         if (request.getParameter("good") != null)
         level[1] = 1;
         else if (request.getParameter("better") != null)
         level[2] = 1;
         else if (request.getParameter("best") != null)
         level[3] = 1;
         else if (request.getParameter("very poor quality") != null)
         level[4] = 1;
         else if (request.getParameter("none") != null)
    level[5] = 1;
    //Now write the collected data into the database
    String insertString = "INSERT intO" + tableName+
    id + "," + service[1] + "," + service[2] + "," + service[3] + "," +
    + service[4] + "," + service[5] + "," + service[6] + "," +
    + level[1] + "," + level[2] + "," + level[3] + "," +
    + level[4] + "," + level[5] ;
    stmt.close();
    conn.close();
    -------------------------Compile Errors ---------------------------------------------------------------------------------
    I am getting following error for the exception handling. Can someone help me !!! PLEASE

    Hi JDKPSSH,
    Do I have to have the database connection in INIT() method ?not mandatory to have it in init() ( not INIT() ) method.
    I am getting following error for the exception handling. Can someone help me !!! PLEASE Check out by putting the following statements in try block
    stmt.close();
    conn.close();otherwise you get a compile time error.
    unreported exception java.sql.SQLException; must be caught or declared to be thrown
    Thanks,
    Sanath Kumar.

  • JSP connected to MS Access using JDBC-ODBC

    If I want to run a jsp file connected to a MS Access database using jdbc-odbc bridge.
    I thought that I should use the following code to make the connection:
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String database = "jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)}; DBQ=http://myComputerName:8080/examples/jsp/DatabaseTest/mydatabase.mdb;DriverID=22;READONLY=fals";
    sqlca = DriverManager.getConnection(database, "dba","sql");
    but Tomcat 4.1 produces many errors.
    The file runs fine when I determine the complete path and include the local drive (C://) of the database Like the following:
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    String database = "jdbc:odbc:Driver={Microsoft Access Driver(*.mdb)};
    DBQ=C:/Tomcat4.1/webapps/examples/jsp/DatabaseTest/mydatabase.mdb;DriverID=22;READONLY=fals";
    sqlca = DriverManager.getConnection(database, "dba","sql");
    Of course I do not want to use the second code because I want to use my computer as a host.
    I will appreciate any answer!

    Yes, using the DSN, it works fine.
    But, I think it will run from the drive C.
    I want to use my computer as a host. So, I think that I should include the name of the computer in the path.
    I do not know may I am confused.
    I appreciate your reply. Thanks!

  • Problem with locks while using iBATIS with MS Access through JDBC-ODBC brid

    Hello,
    I am attempting to use iBATIS to access MS Access file via JDBC-ODBC bridge.
    (I am using Spring's "SqlMapClientDaoSupport," but that is probably irrelevant)
    All this runs on Tomcat... First time DB gets accessed the LDB lock file is created. From there on the only way I can remove the lock file is to kill the JVM...
    Any help is greatly appreciated...

    And why is that a problem?

  • JDBC-ODBC Bridge to SPSS data files - Result Set Type is not supported

    Hello,
    As mentioned in the subject I am trying to read SPSS data files using the SPSS 32-Bit data driver, ODBC and the JDBC-ODBC Bridge.
    Using this SPSS Driver I manged to read the data directly into an MS-SQL Server using:
    SELECT [...] FROM
    OPENROWSET(''MSDASQL.1'',''DRIVER={SPSS 32-BIT Data Driver (*.sav)};DBQ=' SomePathWhereTheFilesAre';SERVER=NotTheServer'', ''SELECT 'SomeSPSSColumn' FROM "'SomeSPSSFileNameWithoutExt'"'') AS a
    This works fine!
    Using Access and an ODBC System DNS works for IMPORTING but NOT for LINKING.
    It is even possible to read the data using the very slow SPSS API.
    However, when it comes to JDBC-ODBC the below code does only work in part. The driver is loaded successfully, but when it comes to transferring data into the resultset object the error
    SQLState: null
    Result Set Type is not supported
    Vendor: 0
    occurs.
    The official answer from SPSS is to use .Net or to use their implementation with Python in their new version 14.0. But this is obviously not an option when you want to use only Java.
    Does anybody have experience with SPSS and JDBC-ODBC??? I have tried the possible ResultSet Types, which I took from:
    http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/ad/rjvdsprp.htm
    and none of them worked.
    Thank you in advance for your ideas and input & stay happy!
    Here the code without all the rest of the class arround it:
    // Module:  SimpleSelect.java
    // Description: Test program for ODBC API interface.  This java application
    // will connect to a JDBC driver, issue a select statement
    // and display all result columns and rows
    // Product: JDBC to ODBC Bridge
    // Author:  Karl Moss
    // Date:  February, 1996
    // Copyright: 1990-1996 INTERSOLV, Inc.
    // This software contains confidential and proprietary
    // information of INTERSOLV, Inc.
    public static void main1() {
      String url   = "jdbc:odbc:SomeSystemDNS";
      String query = "SELECT SomeSPSSColumn FROM 'SomeSPSSFileName'";
      try {
        // Load the jdbc-odbc bridge driver
        Class.forName ("sun.jdbc.odbc.JdbcOdbcDriver");
        DriverManager.setLogStream(System.out);
        // Attempt to connect to a driver.  Each one
        // of the registered drivers will be loaded until
        // one is found that can process this URL
        Connection con = DriverManager.getConnection (url);
        // If we were unable to connect, an exception
        // would have been thrown.  So, if we get here,
        // we are successfully connected to the URL
        // Check for, and display and warnings generated
        // by the connect.
        checkForWarning (con.getWarnings ());
        // Get the DatabaseMetaData object and display
        // some information about the connection
        DatabaseMetaData dma = con.getMetaData ();
        System.out.println("\nConnected to " + dma.getURL());
        System.out.println("Driver       " +
          dma.getDriverName());
        System.out.println("Version      " +
          dma.getDriverVersion());
        System.out.println("");
        // Create a Statement object so we can submit
        // SQL statements to the driver
        Statement stmt = con.createStatement(ResultSet.TYPE_FORWARD_ONLY ,ResultSet.CONCUR_READ_ONLY);
        // Submit a query, creating a ResultSet object
        ResultSet rs = stmt.executeQuery (query);
        // Display all columns and rows from the result set
        dispResultSet (rs);
        // Close the result set
        rs.close();
        // Close the statement
        stmt.close();
        // Close the connection
        con.close();
      }

    Thank you for your reply StuDerby!
    Actually the above script was before, as you suggested, leaving the ResultSetTeype default. This did not work...
    I am getting gray hair with SPSS - in terms of connectivity and "integratebility" none of their solutions offered is sufficient from my point of view.
    Variable definitions can only be read by the slow API, data can only be read by Python or Microsoft Products... and if you want to combine both you are in big trouble. I can only assume that this is a company strategy to sell their Dimensions Platform to companies versus having companies developping their applications according to business needs.
    Thanks again for any furthur suggestions and I hope, that some SPSS Developper will see this post!
    Cheers!!

  • Cannot access remote FoxPro dbf file using jdbc-odbc and system DSN

    Hi all,
    I have a foxpro database sitting on remote server (netware server). the dbf folder is shared and I can access it using windows explore on my weblogic server (windows 2003). I created a system dsn for that. I can access the database from the a stand alone java program using
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection surgConn = DriverManager.getConnection("jdbc:odbc:FoxDB", " ", " ");
    But when I use the same thing in my weblogic 8.1 application, I cannot access the database. I didn't config any data source in weblogic 8.1
    Why?
    When I try this on my own computer - windows 2000, weblogic 8.1 workshop. remote foxpro database dbf folder. it works.
    Any idea?
    Thanks very much

    Laura Ren wrote:
    Hi all,
    I have a foxpro database sitting on remote server (netware server). the dbf folder is shared and I can access it using windows explore on my weblogic server (windows 2003). I created a system dsn for that. I can access the database from the a stand alone java program using
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    Connection surgConn = DriverManager.getConnection("jdbc:odbc:FoxDB", " ", " ");
    But when I use the same thing in my weblogic 8.1 application, I cannot access the database.What exception do you get? WebLogic is just like any other Java App. That code
    should work OK (though I have a better way)... Be warned that the JDBC ODBC
    bridge is specifically dangerous. It is not threadsafe.
    Joe
    I didn't config any data source in weblogic 8.1
    Why?
    When I try this on my own computer - windows 2000, weblogic 8.1 workshop. remote foxpro database dbf folder. it works.
    Any idea?
    Thanks very much

Maybe you are looking for

  • Why can I not download and print PDF?

    Have tried Chrome and Firefox. Neither will downloador print a PDF file. They both did this morning.  Now won't.  What can I do?

  • Import messages from another mac

    I have a laptop pismo G3 running OS10.3. I want to import the mail messages I have on another mac which is running IS 10.4.11. Is this possbile? I tried to connect with the laptop and it would not let me choose the mailbox so then I copied the mailbo

  • Why Validator object does'nt work within a Component

    Hy I am a newbie an started an application where I created the main application and some components. It work fine except  one of the componnents In this component I need to validate an data entry. (checking if it is a valid number) I tried creating a

  • Error with PDF Generation

    I have been working on avery design and print online and i keep getting an error message because the pdf to be able to print is unable to be generated

  • What is the list of current Adobe CC apps as of 6/21/2014

    I recently went through the CC 2014 updates on my Desktop and Laptop. This left me with Adobe products from three different product versions (numbered, CC, CC 2014). I'm trying to remove any superfluous apps on my laptop where HD space is at a premiu