🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #14800

can someone tell me what is wrong!!!??

#14800
From: ngumba nyika
Date: Tue, 03 Aug 1999 00:00
160 lines
5445 bytes
the following code is one i have been testing for 3-4 hours now and i
have already created the "dev4.gdb" database structure and i have
created columns and put data into them (experimental data). The columns
are CUSTFNAME, etc. I am running Interbase5 and the java ide is
JBuilder3 . The only error i receive is that the
"System.out.println(CUSTFNAME,.....)" line is faulty, more specifically
that JBuilder cannot find the method "println" in java.io.printStream.
I have tried everything ( well, almost). Please anyone help me before i
go mad.....i am on the edge of it all. Thanx in advance.
nyix






import java.sql.*;
import java.util.*;
import java.io.*;
/**
 * This class should be used to test that you can connect through JDBC
to your database.
 * Before testing if you can connect through TOPLink you MUST ensure
that you can connect
 * to JDBC outside TOPLink.  If you cannot connect through JDBC contact
your system administrator,
 * JDBC driver provider, or your Java IDE provider to figure out why.
 * <p>
 * Possible Reason Include:
 * <ul>
 * <li> You have not installed the JDBC driver correctly.
 * <li> You are using a JDBC-ODBC driver and have not install ODBC
correctly.
 * <li> Your IDE does not support the JDBC driver that you are using.
 * <li> You have not provided the correct connection information to the
driver.
 * </ul>
 */

public class JDBCConnectTest {

/**
 *      Test connecting to the database.
 * You should put your own connection information here and run this
class.
 */

public static void connect(JDBCConnectTest test)
{


        System.out.println("Starting to connect...\n");

        String driverClassName = test.getDriverClassName(); // Insert
your JDBC driver class name here.
        String databaseURL = test.getDatabaseURL(); // Insert your JDBC
URL here.
        Properties properties = test.getProperties();  // This should
contain any additional information your database requires.

        try     { // This ensures that the driver has been loaded and
registered.
                Class.forName(driverClassName);
    System.out.println("........found the driver\n");
        } catch (ClassNotFoundException exception) {
                throw new RuntimeException("Configuration error. Class "
+ driverClassName + " not found.");
        }

        Connection newConnection;
        try {
                newConnection = DriverManager.getConnection(databaseURL,
properties);
    System.out.println("Connection successful.");

    Statement select = newConnection.createStatement();
    ResultSet result = select.executeQuery("SELECT * FROM CUSTOMER");
    System.out.println("First Name Last Name Social Number Address
Telephone Money Owed");

    while(result.next())
      {
         String CUSTFNAME = result.getString(1);
         String CUSTLNAME = result.getString(2);
         int SOCIALSECURITYNUMBER = result.getInt(3);
         String ADDRESS =  result.getString(4);
         int TELEPHONE = result.getInt(5);
         int MONEYOWED = result.getInt(6);
        System.out.println(CUSTFNAME, CUSTLNAME, SOCIALSECURITYNUMBER,
ADDRESS, TELEPHONE, MONEYOWED);
      }


      select.close();
      newConnection.close();

        } catch (SQLException exception) {
                throw new RuntimeException("A database error occured at
login, " + exception.getMessage());
        }



        System.out.println("Starting to disconnect...");
        try {
                newConnection.close();
        } catch (SQLException exception) {
                throw new RuntimeException("A database error occured at
logout, " + exception.getMessage());
        }
        System.out.println("Disconnection successful.");
}
/**
 *      Insert your JDBC URL here.
 */

public String getDatabaseURL()
{
    //return "jdbc:odbc:Limo";
    //return "jdbc:oracle:oci8:@dev";
    return "jdbc:interbase://localhost/c:/interbase5/tutorial/dev4.gdb";

}
/**
 *      Insert your JDBC driver class name here.
 */

public String getDriverClassName()
{
  //return "sun.jdbc.odbc.JdbcOdbcDriver";
  //return "oracle.jdbc.driver.OracleDriver";
  return "interbase.interclient.Driver";
}
/**
 *      This should contain any additional information your database
requires.
 */

public Properties getProperties()
{
        Properties properties = new Properties();
        properties.put("user", "tutor");
        properties.put("password", "tutor");
        //properties.put("server", "192.168.5.200:1521");
        //properties.put("database", "dev");

        return properties;
}
/**
 *      Test connecting to the database.
 * You should put your own connection information here and run this
class.
 */

public static void main(String[] args)
{

        connect(new JDBCConnectTest());
}
}
Technical Details
Message-ID: <37A73517.CC285AFD@softhome.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,780fe5867aa8f72b,start
X-Google-Attributes: gidf74b3,public
From: ngumba nyika <nyix@softhome.net>
Subject: can someone tell me what is wrong!!!??
Date: 1999/08/03
Message-ID: <37A73517.CC285AFD@softhome.net>
X-Deja-AN: 508461072
Content-Transfer-Encoding: 7bit
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Reply-To: nyix@softhome.net
Newsgroups: borland.public.jbuilder.java.language