Hi ,
I am trying to select some data from jBase tables with JDBC ( AIX
5.3, jBase 5.12, Java5 32bit ).
I succed to load the driver and if the javaOBjEXServer is started I
also get a connection. But
if I wanna do something with that connection (i.e. select something) I
get a NULL pointer exception (though
the connection isn't NULL of course)
Strange thing is that DriverManager.getConnection doesn't throw an
exception even if I provide a user that doesn't
exist in the database - I still get a connection != NULL ...
The only way I managed to get an exception from getConnection is when
I shut down javaOBjEXServer.
Another thing very strange is that I set all the logging in
javaobjex.properties to 7 but the only log entry I get
is : 12/3/08 4:40 PM:58 :Init : OK
nothing else - no incomming connection requests, no nothing ...
conn.getMetaData doesn't seem to work either - see my little test prog
and its response below
so please help me Obewan, you're my only hope :-)
TestJBaseJDBC is :
import java.sql.*;
import java.io.*;
class TestJBaseJDBC {
public static void main(String[] args) throws Exception {
Connection conn = null;
try {
Class.forName("com.jbase.jdbc.driver.JBaseJDBCDriver");
}
catch(Exception x){
System.out.println( "Unable to load the driver class!" );
return;
}
System.out.println("since we did not get an exception: driver
should be loaded successfully!");
try {
conn = DriverManager.getConnection
("jdbc:jbase:thin:@frat24aix01:3570:AMARKERT","amarkert", "123456");
}
catch( Exception x ){
System.out.println( "Couldn.t get connection!" + x );
x.printStackTrace ();
return;
}
if(conn != null){
System.out.println("conn != null -> methinks we're
connected :-)");
DatabaseMetaData meta = conn.getMetaData();
if( meta != null ) {
System.out.println("Driver Name : "+meta.getDriverName
());
System.out.println("Driver Version :
"+meta.getDriverVersion());
}
} else {
System.out.println( "Unable to create a connection !" );
return;
}
System.out.println("unfuckingbeliefable, we have a connection
to JBase via JDBC !");
System.out.println("here comes the tricky part -> let's try to
select something :-)");
try {
Statement stmt = conn.createStatement();
ResultSet rset = stmt.executeQuery ("SELECT * FROM
F.TSA.STATUS");
while (rset.next())
{
String field_1 = rset.getString(1);
String field_2 = rset.getString(2);
System.out.println (field_1 + ", " + field_2);
}
stmt.close();
conn.close();
}
catch( SQLException x) {
System.out.println("exception :-(");
x.printStackTrace();
System.out.println("..........................");
String sErrorState = "Err Code: " + x.getErrorCode() +
" SQL State: " + x.getSQLState() + " mesg: " + x.getMessage
();
System.out.println(sErrorState);
System.out.println("..........................");
conn.close();
}
conn.close();
}
}
What I get is:
since we did not get an exception: driver should be loaded
successfully!
conn != null -> methinks we're connected :-)
Driver Name : null
Driver Version : null
unfuckingbeliefable, we have a connection to JBase via JDBC !
here comes the tricky part -> let's try to select something :-)
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.executeQuery
(JBaseJDBCSocketStatement.java:734)
at TestJBaseJDBC.main(TestJBaseJDBC.java:51)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---