• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Strange situation on different computers.

 
Roman Hoyenko
Greenhorn
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;
try
{
DataAccess da =
new DataAccess(
"sun.jdbc.odbc.JdbcOdbcDriver",
"jdbcdbc:prod",
"jsievel",
"jsievel");
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);
System.out.println(quant);
}
if (quant <= 0)
{
System.out.println("quant <= 0");
}
}
catch(Throwable e) {
System.out.println(e);
}
return;
}
}
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).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic