• Post Reply Bookmark Topic Watch Topic
  • New Topic

Strange situation on different computers.

Roman Hoyenko
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wrote the program, which works on one computer, but it doesn't work on another. Here it is:
package com.lucent.sturbridge.pofstart;
import java.sql.*;
import java.io.*;
import com.lucent.sturbridge.dataaccess.*;
public class Test1 {
public static void main(java.lang.String[] args)
long quant = -10;
DataAccess da =
new DataAccess(
PreparedStatement getLength =
da.getCon().prepareStatement("select length from pofdata where fiber = ?");
//da.getCon().prepareStatement("select * from pofdata");
getLength.setString(1, "GB1006292");
ResultSet rs = getLength.executeQuery();
while (rs.next())
System.out.println("getting result ...");
String s = rs.getString("LENGTH");
quant = Long.parseLong(s);
if (quant <= 0)
System.out.println("quant <= 0");
catch(Throwable e) {
This program gets the length on one comp. and prints "quant <= 0" on another. What's happening? May be comparison methods are not the same on different computers? (When I tried "select * from pofdata" it worked ok, so the connection to the database seems to be OK).
DataAccess is a small class which establishes connection to a database.
[This message has been edited by Roman Hoyenko (edited July 27, 2001).]
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!