Hi,

I am  trying to retrieve some data from jBase tables with JDBC. Driver
loaded successfully and if the javaOBjEXServer is started, connection also
established.The problem is I am unable to retrieve data from T24, the
following error occurs.

jsh r008 ~ -->set CLASSPATH=%JBCRELEASEDIR% \java\lib\jbasejdbc.jar;.
jsh r008 ~ -->javac JDBCTestJBase.java
jsh r008 ~ -->java JDBCTestJBase
Loading JDBC jBASE driver
Connecting to the local database
Connected
Statment created Successfully
Exception in thread "main" java.lang.NullPointerException
        at
com.jbase.jdbc.JBaseJDBCSocketConnection.checkEndOfResponse(JBaseJDBCSocketConnection.java:738)
        at
com.jbase.jdbc.JBaseJDBCSocketConnection.sendCommandCheckEndOfResponse(JBaseJDBCSocketConnection.java:750)
        at
com.jbase.jdbc.JBaseJDBCSocketConnection.compile(JBaseJDBCSocketConnection.java:755)
        at
com.jbase.jdbc.JBaseJDBCSocketConnection.execute(JBaseJDBCSocketConnection.java:771)
        at
com.jbase.jdbc.JBaseJDBCSocketStatement.execute(JBaseJDBCSocketStatement.java:507)
        at JDBCTestJBase.main(JDBCTestJBase.java:32)


I am using the following code for testing the connection


import java.sql.*;
import java.io.*;

public class JDBCTestJBase
{
    public static void main (String args [])
        throws SQLException, IOException
    {

      System.out.println ("Loading JDBC jBASE driver");

      try
      {
        Class.forName ("com.jbase.jdbc.driver.JBaseJDBCDriver");
      }
      catch (ClassNotFoundException e)
      {
        System.out.println ("Could not load the driver. Is your classpath
correct?");
        e.printStackTrace ();
      }

      System.out.println ("Connecting to the local database");

      Connection conn =
        
DriverManager.getConnection("jdbc:jbase:thin:@localhost:3570:MYACCOUNT","r008",
"p...@123");
        System.out.println("Connected");
      try
      {

        Statement stmt = conn.createStatement();
        System.out.println("Statment created Successfully");
        stmt.execute("SELECT * FROM TRAINING");
        System.out.println("Statement Executed");
        ResultSet rset = stmt.getResultSet();

        while (rset.next())
        {
          // Print the name out
          String desc =  rset.getString("DESCRIPTION");
          System.out.println (desc);

        }
        stmt.close();
        conn.close();

      }catch(SQLException se)
      {
          se.printStackTrace();
        System.out.println("..........................");

          String sErrorState = "Err Code: " + se.getErrorCode() +
              " SQL State: " + se.getSQLState() + " mesg: " +
se.getMessage();

          System.out.println(sErrorState);
        System.out.println("..........................");
        conn.close();
      }


    }
}

If I use the SQL command in T24, jshell prompt it is working fine.

jsh r008 ~ -->SQLSELECT * FROM TRAINING
@ID   DESCRIPTION
----- -----------------------------------
1     FIRST RECORD
2     SECOND RECORD
3     THIRD RECORD
4     FOURTH RECORD


If any one encountered the same problem, kindly suggest how to retrieve the
data from T24.


Thanks,
Mangai.

-- 
Please read the posting guidelines at: 
http://groups.google.com/group/jBASE/web/Posting%20Guidelines

IMPORTANT: Type T24: at the start of the subject line for questions specific to 
Globus/T24

To post, send email to [email protected]
To unsubscribe, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/jBASE?hl=en

Reply via email to