Subject | Select fails using DataSource example |
---|---|
Author | chspr3 |
Post date | 2003-07-12T22:52:22Z |
Hello,
I have installed FirebirdSS-1.0.0.809-Solaris-X86 on a laptop running
Solaris 8 x86.
I can connect and select from the example database using isql. I have
also installed the Jaybird JDBC driver. I am trying to use the
DataSource
example
to perform a similar test select from the database.
I have compile errors as follows with the FBConnectionRequestInfo :-
chspr3@toughbook:> build_run
Compiling...
DataSourceExample.java:48: No variable isc_dpb_lc_ctype defined in
interface
org.firebirdsql.gds.GDS.
cri.setProperty(GDS.isc_dpb_lc_ctype, "NONE");
^
DataSourceExample.java:49: No variable isc_dpb_num_buffers defined in
interface org.firebirdsql.gds.GDS.
cri.setProperty(GDS.isc_dpb_num_buffers, 1);
^
DataSourceExample.java:50: No variable isc_dpb_sql_dialect defined in
interface org.firebirdsql.gds.GDS.
cri.setProperty(GDS.isc_dpb_sql_dialect, 3);
^
3 errors
If I comment the code out that causes the above errors I get the
following
errors when
I run the code :-
chspr3@toughbook:> build_run
Compiling...
Running...
Starting...
Create dataSource...
Set Properties...
Connect...
log4j:ERROR No appenders could be found for category
(org.firebirdsql.jgds.GDS_Impl).
log4j:ERROR Please initialize the log4j system properly.
Connected
Select...
Select Failed!
org.firebirdsql.jdbc.FBSQLException: GDS Exception. Dynamic SQL Error
SQL error code = -901
feature is not supported
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Exception.java:42)
at java.sql.SQLException.<init>(SQLException.java:82)
at
org.firebirdsql.jdbc.FBSQLException.<init>(FBSQLException.java:48)
at
org.firebirdsql.jdbc.FBStatement.executeQuery(FBStatement.java:118)
at DataSourceExample.main(DataSourceExample.java:76)
at org.firebirdsql.gds.GDSException: Dynamic SQL Error
SQL error code = -901
feature is not supported
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at org.firebirdsql.gds.GDSException.<init>
(GDSException.java:108)
at org.firebirdsql.jgds.GDS_Impl.readStatusVector(Compiled
Code)
at org.firebirdsql.jgds.GDS_Impl.receiveResponse
(GDS_Impl.java:1651)
at
org.firebirdsql.jgds.GDS_Impl.isc_dsql_prepare(GDS_Impl.java:1162)
at
org.firebirdsql.jca.FBManagedConnection.prepareSQL
(FBManagedConnection.java:
767)
at
org.firebirdsql.jdbc.FBConnection.prepareSQL(FBConnection.java:1107)
at
org.firebirdsql.jdbc.FBStatement.prepareFixedStatement
(FBStatement.java:942)
at
org.firebirdsql.jdbc.FBStatement.internalExecute(FBStatement.java:930)
at
org.firebirdsql.jdbc.FBStatement.executeQuery(FBStatement.java:102)
at DataSourceExample.main(DataSourceExample.java:76)
sql exception: GDS Exception. Dynamic SQL Error
SQL error code = -901
feature is not supported
Close connection...
Connection closed
DONE
chspr3@toughbook:>
Any help would be appreciated. Also is there any documentation to
understand
the error codes?
My CLASSPATH is as follows :-
/opt/interbase/jdbc/firebirdsql-full.jar:
/opt/interbase/jdbc/lib/jaas.jar:
/opt/interbase/jdbc/lib/log4j-core.jar:
/opt/interbase/jdbc/lib/mini-concurrent.jar:
/opt/interbase/jdbc/lib/mini-j2ee.jar:.
My Code is as follows :-
import org.firebirdsql.jdbc.FBWrappingDataSource;
import org.firebirdsql.jca.FBConnectionRequestInfo;
import org.firebirdsql.gds.GDS;
import java.sql.*;
public final class DataSourceExample
{
public static void main (String args[]) throws Exception
{
System.out.println ("Starting...");
// Create an Firebird data source manually;
System.out.println ("Create dataSource...");
FBWrappingDataSource dataSource = new FBWrappingDataSource();
// Set the standard properties
System.out.println ("Set Properties...");
dataSource.setDatabase
("localhost/3050:localhost:/opt/interbase/examples/employee.gdb");
dataSource.setDescription ("An example database of employees");
/*
* This is an example how to use FBConnectionRequestInfo to specify
* DPB that will be used for this data source.
*/
/** COMMENT OUT FOR NOW AS GIVES COMPILE ERRORS
System.out.println ("Set Connect Request Info...");
FBConnectionRequestInfo cri = dataSource.getConnectionRequestInfo
();
cri.setProperty(GDS.isc_dpb_lc_ctype, "NONE");
cri.setProperty(GDS.isc_dpb_num_buffers, 1);
cri.setProperty(GDS.isc_dpb_sql_dialect, 3);
dataSource.setConnectionRequestInfo(cri);
*** COMMENT OUT FOR NOW AS GIVES COMPILE ERRORS */
// Connect to the Database
System.out.println ("Connect...");
Connection c = null;
try {
dataSource.setLoginTimeout (10);
c = dataSource.getConnection ("sysdba", "masterkey");
// At this point, there is no implicit driver instance
// registered with the driver manager!
System.out.println ("Connected");
}
catch (SQLException e) {
System.out.println ("Connect Failed!");
e.printStackTrace();
System.out.println ("sql exception: " + e.getMessage ());
}
// Do a select
System.out.println ("Select...");
try {
int cust_no = 0;
String sql = "select cust_no from customer where cust_no=1001";
Statement sment = c.createStatement();
ResultSet rs = sment.executeQuery(sql);
if (rs.next()) {
cust_no = rs.getInt("cust_no");
System.out.println ("Cust_No=" + cust_no);
}
rs.close();
sment.close();
}
catch (SQLException e) {
System.out.println ("Select Failed!");
e.printStackTrace();
System.out.println ("sql exception: " + e.getMessage ());
}
// Close the connection
System.out.println ("Close connection...");
try {
c.close ();
System.out.println ("Connection closed");
}
catch (SQLException e) {
System.out.println ("Close Failed!");
e.printStackTrace();
System.out.println ("sql exception: " + e.getMessage ());
}
}
}
Thanks
Steven
I have installed FirebirdSS-1.0.0.809-Solaris-X86 on a laptop running
Solaris 8 x86.
I can connect and select from the example database using isql. I have
also installed the Jaybird JDBC driver. I am trying to use the
DataSource
example
to perform a similar test select from the database.
I have compile errors as follows with the FBConnectionRequestInfo :-
chspr3@toughbook:> build_run
Compiling...
DataSourceExample.java:48: No variable isc_dpb_lc_ctype defined in
interface
org.firebirdsql.gds.GDS.
cri.setProperty(GDS.isc_dpb_lc_ctype, "NONE");
^
DataSourceExample.java:49: No variable isc_dpb_num_buffers defined in
interface org.firebirdsql.gds.GDS.
cri.setProperty(GDS.isc_dpb_num_buffers, 1);
^
DataSourceExample.java:50: No variable isc_dpb_sql_dialect defined in
interface org.firebirdsql.gds.GDS.
cri.setProperty(GDS.isc_dpb_sql_dialect, 3);
^
3 errors
If I comment the code out that causes the above errors I get the
following
errors when
I run the code :-
chspr3@toughbook:> build_run
Compiling...
Running...
Starting...
Create dataSource...
Set Properties...
Connect...
log4j:ERROR No appenders could be found for category
(org.firebirdsql.jgds.GDS_Impl).
log4j:ERROR Please initialize the log4j system properly.
Connected
Select...
Select Failed!
org.firebirdsql.jdbc.FBSQLException: GDS Exception. Dynamic SQL Error
SQL error code = -901
feature is not supported
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Exception.java:42)
at java.sql.SQLException.<init>(SQLException.java:82)
at
org.firebirdsql.jdbc.FBSQLException.<init>(FBSQLException.java:48)
at
org.firebirdsql.jdbc.FBStatement.executeQuery(FBStatement.java:118)
at DataSourceExample.main(DataSourceExample.java:76)
at org.firebirdsql.gds.GDSException: Dynamic SQL Error
SQL error code = -901
feature is not supported
at java.lang.Throwable.fillInStackTrace(Native Method)
at java.lang.Throwable.fillInStackTrace(Compiled Code)
at java.lang.Throwable.<init>(Compiled Code)
at java.lang.Exception.<init>(Compiled Code)
at org.firebirdsql.gds.GDSException.<init>
(GDSException.java:108)
at org.firebirdsql.jgds.GDS_Impl.readStatusVector(Compiled
Code)
at org.firebirdsql.jgds.GDS_Impl.receiveResponse
(GDS_Impl.java:1651)
at
org.firebirdsql.jgds.GDS_Impl.isc_dsql_prepare(GDS_Impl.java:1162)
at
org.firebirdsql.jca.FBManagedConnection.prepareSQL
(FBManagedConnection.java:
767)
at
org.firebirdsql.jdbc.FBConnection.prepareSQL(FBConnection.java:1107)
at
org.firebirdsql.jdbc.FBStatement.prepareFixedStatement
(FBStatement.java:942)
at
org.firebirdsql.jdbc.FBStatement.internalExecute(FBStatement.java:930)
at
org.firebirdsql.jdbc.FBStatement.executeQuery(FBStatement.java:102)
at DataSourceExample.main(DataSourceExample.java:76)
sql exception: GDS Exception. Dynamic SQL Error
SQL error code = -901
feature is not supported
Close connection...
Connection closed
DONE
chspr3@toughbook:>
Any help would be appreciated. Also is there any documentation to
understand
the error codes?
My CLASSPATH is as follows :-
/opt/interbase/jdbc/firebirdsql-full.jar:
/opt/interbase/jdbc/lib/jaas.jar:
/opt/interbase/jdbc/lib/log4j-core.jar:
/opt/interbase/jdbc/lib/mini-concurrent.jar:
/opt/interbase/jdbc/lib/mini-j2ee.jar:.
My Code is as follows :-
import org.firebirdsql.jdbc.FBWrappingDataSource;
import org.firebirdsql.jca.FBConnectionRequestInfo;
import org.firebirdsql.gds.GDS;
import java.sql.*;
public final class DataSourceExample
{
public static void main (String args[]) throws Exception
{
System.out.println ("Starting...");
// Create an Firebird data source manually;
System.out.println ("Create dataSource...");
FBWrappingDataSource dataSource = new FBWrappingDataSource();
// Set the standard properties
System.out.println ("Set Properties...");
dataSource.setDatabase
("localhost/3050:localhost:/opt/interbase/examples/employee.gdb");
dataSource.setDescription ("An example database of employees");
/*
* This is an example how to use FBConnectionRequestInfo to specify
* DPB that will be used for this data source.
*/
/** COMMENT OUT FOR NOW AS GIVES COMPILE ERRORS
System.out.println ("Set Connect Request Info...");
FBConnectionRequestInfo cri = dataSource.getConnectionRequestInfo
();
cri.setProperty(GDS.isc_dpb_lc_ctype, "NONE");
cri.setProperty(GDS.isc_dpb_num_buffers, 1);
cri.setProperty(GDS.isc_dpb_sql_dialect, 3);
dataSource.setConnectionRequestInfo(cri);
*** COMMENT OUT FOR NOW AS GIVES COMPILE ERRORS */
// Connect to the Database
System.out.println ("Connect...");
Connection c = null;
try {
dataSource.setLoginTimeout (10);
c = dataSource.getConnection ("sysdba", "masterkey");
// At this point, there is no implicit driver instance
// registered with the driver manager!
System.out.println ("Connected");
}
catch (SQLException e) {
System.out.println ("Connect Failed!");
e.printStackTrace();
System.out.println ("sql exception: " + e.getMessage ());
}
// Do a select
System.out.println ("Select...");
try {
int cust_no = 0;
String sql = "select cust_no from customer where cust_no=1001";
Statement sment = c.createStatement();
ResultSet rs = sment.executeQuery(sql);
if (rs.next()) {
cust_no = rs.getInt("cust_no");
System.out.println ("Cust_No=" + cust_no);
}
rs.close();
sment.close();
}
catch (SQLException e) {
System.out.println ("Select Failed!");
e.printStackTrace();
System.out.println ("sql exception: " + e.getMessage ());
}
// Close the connection
System.out.println ("Close connection...");
try {
c.close ();
System.out.println ("Connection closed");
}
catch (SQLException e) {
System.out.println ("Close Failed!");
e.printStackTrace();
System.out.println ("sql exception: " + e.getMessage ());
}
}
}
Thanks
Steven