Trying to connect to DB2 database....get windows Application error message

Hello,
I have just started using JDBC and I am trying to connect to a DB2 db from my pc. The program I have written compiles ok but when I try to run the program I get a windows error:
java.exe - Application error
The instruction at "0x10009f62" referenced memory at "0x0000001c". The memory could not be "read".
Click OK to terminate the program.
Click CANCEL to debug the program.
I am using Windows2000 and DB2 v6.1.0 is installed on my laptop.
The program I am trying to run is as follows:
//Class to load jdbc driver and test connectivity to DB
import java.io.*;
import java.util.*;
import java.sql.*;
//Dynamic SQL application using jdbc
//example taken from Don Chamberlain's book, page 504
//Adjusted for reptest DB
public class Test{
//Register the jdbc driver
static{
try{
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
}//ends try
catch (Exception e){
System.out.println("Error registering the jdbc driver");
e.printStackTrace();
}//ends catch
}//ends static
public static void main(String args[]){
//try catch block, Create a Connection object and use it to connect to the DB and turn autocommit off
//The DB is identified by a URl that begins with "jdbc:db2" followed by the DB name
try{
String dbname = "dbname";
String userid = "uid";
String pw = "password";
String url = "jdbc:db2:" + dbname;
Connection con = DriverManager.getConnection(url, userid, pw);
con.setAutoCommit(false);
//Simple select statement
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT problem_id" + "FROM problems" + "WHERE problem_id = 2002219");
System.out.println(rs.getString(1));
}//end try
//General purpose exception
catch(Exception e){
System.out.println("Error");
e.printStackTrace();
}//ends outer catch
System.out.println("Successful");
}//ends main
}//ends class
I'd appreciate any help. Thanks , Ali

Hello,
This is because of the DB2Java.zip file, what i did is unzip the file into a temp folder then make a jar using jar -cvf DB2java.jar COM
(COM is important)now you can see jar file is created. you have to use this jar file in your classpath it works fine,
That's all it works for me.
Thanks for somebody placed in the java forum.
Cheers
Bala

Similar Messages

  • HT4623 when trying to connect to internet i get an internal error message.  All other devices but this phone connects fine.

    For some reason this i phone will not connect to our wireless internet.  All other iphones connect.  As well as computers.  I keep receiving an internal error 500 message.  Any help?

    I assume you are referring to an error message in Safari. When you look at the phone, are you seeing the wifi signal fan by your carrier name? If yes and you go into Settings, wifi and tap the blue arrow to the right of the network, are you seeing IP information? Have you ever been connected to this network in the past?

  • Cnat update itunes get windows installer error message

    When trying to update itunes get window installer error message. Running windows vista

    What's the precise text of the message, please? (There's a few different ones I can think of that you might be getting.)

  • My computer recently froze whilst updating Itunes, and has subsequently removed Itunes from my computer. When i have tried to reinstall the programme, i get the following error message "Invalid Drive:G:\" any ideas?

    My computer recently froze whilst updating Itunes, and has subsequently removed Itunes from my computer. When i have tried to reinstall the programme, i get the following error message "Invalid Drive:G:\" any ideas?

    Try the following user tip:
    "Invalid drive X:\" install errors

  • Error trying to connect to DB2 database....

    Am using the following code to connect to db2 database, but when run am getting error messgae as shown,
    try
         Class.forName("COM.ibm.db2.jdbc.net.DB2Driver").newInstance();
    catch(Exception exception)
    System.err.println("Unable to load driver.");
    exception.printStackTrace();
    try
         Connection connection = DriverManager.getConnection("jdbc:db2://xxx.xxx.xxx.xxx:port/dbname");
    error message.....
    Exception in thread "main" java.lang.NoClassDefFoundError:
    .....Any suggestions gratefully recieved....

    It does not matter whether your database server is running locally or on a remote server. Most of the times it will be on a remote server.
    But the driver and the related stuff must be in your local machine's classpath. Only then you can compile or run your application locally. Include db2 package in the classpath and then try to compile your program. You can search in this forum about setting the classpath details.
    Every fourth thread in this forum will be about classpath or related problems.
    Sudha

  • I have OSX 10.7 Lion I set up a separate email account for my wife.  Now when she tries to enter a website we get the following error message:  Java Script: Not Null validator already loaded.  The website never opens and it is difficult to get out of:

    I have OSX 10.7 Lion.  I set up a separate email account for my wife.  All of a sudden when she tries to enter and website from email we get the following error message.  JavaScript;  The notnull validator has already been loaded.  From there we can't seem to go any where.  When you hit OK it just keeps appearing and the only way to get out of it is to quit Safai.  If you try and got directly to Safari you get the same error message and can't go any further.  Please help.

    What you are experiencing is 100% related to Malware.
    Sometimes a problem with Firefox may be a result of malware installed on your computer, that you may not be aware of.
    You can try these free programs to scan for malware, which work with your existing antivirus software:
    * [http://www.microsoft.com/security/scanner/default.aspx Microsoft Safety Scanner]
    * [http://www.malwarebytes.org/products/malwarebytes_free/ MalwareBytes' Anti-Malware]
    * [http://support.kaspersky.com/faq/?qid=208283363 TDSSKiller - AntiRootkit Utility]
    * [http://www.surfright.nl/en/hitmanpro/ Hitman Pro]
    * [http://www.eset.com/us/online-scanner/ ESET Online Scanner]
    [http://windows.microsoft.com/MSE Microsoft Security Essentials] is a good permanent antivirus for Windows 7/Vista/XP if you don't already have one.
    Further information can be found in the [[Troubleshoot Firefox issues caused by malware]] article.
    Did this fix your problems? Please report back to us!

  • Acrobat Pro 8: When I print to pdf I get windows print error message

    This just started happening when I installed my acrobat professional 8.0 on my new computer (with Windows XP Pro). Everything works fine, but when I print a document to .pdf, I get that windows printer pop-up message that says that it was unable to print. As a consequence, I get a bunch of allegedly unprinted documents in my printer queue that I have to keep deleting. This is more an annoyance than anything else, but can anyone tell me how to stop this from happening??
    THanks.

    OK, I'm still not sure I'm getting this, but I printed to file, and then opened the prn file in Acrobat Distiller. The actual pdf file was not in the folder, but I could open it with distiller.
    The message below distiller said: tart Time: Tuesday, January 20, 2009 at 13:03:04
    Source: retainerpetitionreview.prn
    Destination: C:\Documents and Settings\Mark Markus\Desktop\retainerpetitionreview.pdf
    Adobe PDF Settings: C:\Documents and Settings\All Users\Application Data\Adobe\Adobe PDF\Settings\Standard.joboptions
    %%[ ProductName: Distiller ]%%
    %%[Page: 1]%%
    %%[Page: 2]%%
    %%[Page: 3]%%
    %%[LastPage]%%
    Distill Time: 00 Hour(s) : 00 Minute(s) : 00.265 Second(s)
    **** End of Job ****
    However, when I just print "regularly" (not, "to file") the pdf file is saved and generated, but I get that popup error message, which stays in my printer queue, saying that there was an error printing to LPT 1

  • Unable to install ICloud 4.0 on Win 8.1 PC. Get Windows Installer error message. But Windows installer works fine. Any solutions?

    I cannot install ICloud 4.0 on my Win8.1 PC because I get a recurring message that the Windows Installer has failed. The Windos installer works fine on other applications. So I suspect it is in the ICloud software. I have uninstalled Icloud 3.2 and deleted the apple internet services files but still no luck. Any ideas?

    The error message says "There is a problem with this Windows Installer package. A program run as part of the setup did not finish as expected. Contact your support personnel or package vendor"
    I am trying to update iCloud to 4.0 by installinh iCloud64.msi on Windows 8.1.

  • When connecting to a database, dreamweaver gives the error message [MySQL Error

    When I try to connect my MySQL database into dreamweaver, I insert all of the information (name, server, username, password), and when i click on select database, it reads:
    MySQL Error#:1045
    Access denied for user 'mresnik_mresnik'@'192.185.5.169' (using password: YES)
    I am 100% sure that The details entered including username and password are correct, as I have contacted hostgator.com and they have stated that they can connect, and they advised that it may be an issue with either my files or dreamweaver.
    Any help would be very much appreciated.

    Login.php code:
    <?php require_once('Connections/drama_database.php'); ?>
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    ?>
    <?php
    // *** Validate request to login to this site.
    if (!isset($_SESSION)) {
      session_start();
    $loginFormAction = $_SERVER['PHP_SELF'];
    if (isset($_GET['accesscheck'])) {
      $_SESSION['PrevUrl'] = $_GET['accesscheck'];
    if (isset($_POST['UserName'])) {
      $loginUsername=$_POST['UserName'];
      $password=$_POST['Password'];
      $MM_fldUserAuthorization = "userlevel";
      $MM_redirectLoginSuccess = "home.php";
      $MM_redirectLoginFailed = "loginfail.php";
      $MM_redirecttoReferrer = false;
      mysql_select_db($database_drama_database, $drama_database);
      $LoginRS__query=sprintf("SELECT username, password, userlevel FROM users WHERE username=%s AND password=%s",
      GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
      $LoginRS = mysql_query($LoginRS__query, $drama_database) or die(mysql_error());
      $loginFoundUser = mysql_num_rows($LoginRS);
      if ($loginFoundUser) {
        $loginStrGroup  = mysql_result($LoginRS,0,'userlevel');
        if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
        //declare two session variables and assign them
        $_SESSION['MM_Username'] = $loginUsername;
        $_SESSION['MM_UserGroup'] = $loginStrGroup;         
        if (isset($_SESSION['PrevUrl']) && false) {
          $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];   
        header("Location: " . $MM_redirectLoginSuccess );
      else {
        header("Location: ". $MM_redirectLoginFailed );
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;  
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    ?>
    <html>
    <title>Drama Database - Login</title>
    <head>
        <link href="images/favicon.ico" rel="icon" />
    </head>
    </html>
    <script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
    <link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
    <form ACTION="<?php echo $loginFormAction; ?>" id="loginform" name="loginform" method="POST">
    <!--visual -->
    <br>
    <br>
    <br>
    <div align="center">
      <!--ACS Logo -->
      <img src="images/logo_acs_egham.gif" width="387" height="59" /><br>
    <!--Drama Logo -->
    <br>
    <img src="images/bglogin.jpg" alt="Acs-Egham International School" width="246" height="153">
    <br>
    <!--Title -->
    <h2>Drama Database Login</h2>
    </center>
      </div>
      <table width="154" border="0" align="center">
        <tr>
          <td width="148">Username:<br />
            <span id="sprytextfield1">
            <label for="UserName"></label>
            <input type="text" name="UserName" id="UserName" />
          <span class="textfieldRequiredMsg">A value is required.</span></span></td>
        </tr>
        <tr>
          <td> </td>
        </tr>
        <tr>
          <td>Password:<span id="sprytextfield2"><br />
            <label for="Password"></label>
            <input type="password" name="Password" id="Password" />
          <span class="textfieldRequiredMsg">A value is required.</span></span></td>
        </tr>
        <tr>
          <td> </td>
        </tr>
        <tr>
          <td align="center"><input type="submit" name="LoginButton" id="LoginButton" value="Login" /></td>
        </tr>
        <tr>
          <td> </td>
        </tr>
      </table>
    </form>
    <script type="text/javascript">
    var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
    var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2");
    </script>

  • Trying to redownload Acrobat 7 Professional on Windows Vista:  error message

    The error message reads:  "Error 1304 Error writing to file C\Programs files\ Adobe\ Acrobat 7.0\ Active X\GbDetect.dll.  Verify that you have access to that directory"  Does anyone know how to deal with this message?

    Have you checked to see if Acrobat version 7 will even work with Windows Vista?
    HOW ADOBE PRODUCTS SUPPORT WINDOWS VISTA
    Acrobat 7 will not work with MS Office 2010. If you have MS Office 2010, you can not use any Acrobat product reliably to create PDFs. You will have to wait for the next version of Acrobat.

  • Trying to download Premier Elements and getting 64 bit error message

    I called support at first when problem downloading. They sent me a link for both Elements and Premier. Photoshop Elements worked. Premier I got it downloaded then at setup it says cannot use the installation for 64 bit. I have Windows 8 64 bit. Confused!  Anyone able to assist me?  I have a brain injury so please be specific. Thanks so much.

    Hi pamh8,
    The error you are facing ususally comes up when you try to install the software on a 32 bit computer.
    Please check your computer specifications and let me know the exact details.
    Also please let me know the exact error message (with screenshots if possible).

  • I get an Application Error message when installing TestStand 2.0

    When installing TestStand 2.0 on a Windows NT 4.0 Workstation, following message appears when installing Engine: Application Error - The instruction at "0x685876b3" referenced memory at "0x685876b3". The memory could not be read.

    Hello Eduardo,
    This is a strange behavior, and I guess I have a couple of comments. TestStand works fine with Windows NT 4.0 but it needs at least Service Pack 3 installed. So make sure you have the SP installed.
    In addition, make sure you use an administrator account when you install TestStand. Finally, you can try to install it on a different computer with the same OS just to make sure the CD is OK. If it works in the other computer, then there is something wrong with the original PC.
    Regards,
    Roberto Piacentini
    Applications Engineer
    National Instruments
    www.ni.com/support

  • I am trying to download itunes and keep getting a configure error message...anyone...help!

    I am trting to download itunes again and it comes up with a configure error message...anyone...help!

    Since this a problem pertaining to the iTunes application, you might have better luck posting this in the iTunes forum.
    https://discussions.apple.com/community/itunes
    B-rock

  • When my bank website tries to access my scanner I get an unspecified error message.

    In order to make an electronic deposit, I access my bank account, click on "edeposits" and the website attempts to find my scanner. For the first time yesterday (this has always worked fine in the past) Firefox stopped the operation and posted an "ERROR!" message with the Firefox symbol and stop sign.
    My bank says all is working fine on their end.

    I fixed it myself!

  • When closing Firefox, I get an application error message saying the instruction at "0x100f2eaa" referenced memory at "0x00000024", the memory could not be "read". Check on ok to terminate the program. What's up?

    Don't know that this is causing problems during utilization of Firefox but it's been happening for awhile. Seems to only pop up when I exit the internet.

    Hi Ayaz_Shaikh,
    What’s your host OS?
    Do you install Windows 10 Technical Preview in Hyper-V? Or some else virtualization products?
    Alex Zhao
    TechNet Community Support

Maybe you are looking for

  • Error while creating a system object for R3 in portal

    Hi, I am getting error while trying to create a system object in portal. Following are the details I used : Under WAS... Web AS Host Name :<XXXX>:8001 Web AS path: /sap/bc/bsp/sap/ Web AS protocol : http Under User management: Authentication Ticket T

  • With the latest version of itunes, are you able to search your library by purchase date?

    With the latest version of itunes, are you able to search your library by purchase date?  My prior itunes software had Name, Time, Artist, Album, Genre, Rating, Plays and Purchased.  With Version 11.0.3 of itunes, 'Purchased' is not a tabbed option t

  • HP OfficeJet Pro 8600 Will Not Print Wirelessly

    Hi.  I have read other threads on this forum with suggested fixes from HP employees and tried them.  I have run the tool which found no errors.  My firewall is off.  I have installed the latest Adobe and uninstalled then reinstalled the printer softw

  • Can't ping, email or access my domain -- on occasion.

    Very weird but I have no idea what is happening. We have two MacBook Pro's one 15 and one 13, both have mobile me and some pop email accounts with our own domains. Also have iphones that connect to the same network, all connecting to Airport Wireless

  • Depreciation values in previous closed fiscal year

    Hi, I want to apply new depreciation key for an asset, acquired previous year. Previous financial year is closed where prior fiscal year for fixed assets is still open. How should I apply changes. Thanks in advance.