Subject Firebird embedded halt on this code
Author valentinkolesnikov@yahoo.com
Hi!
I am trying to use embedded version of the Firebird.
My java program halts while executing "Create table" code.
Any idea ?

import java.sql.*;
// Original version of this file was part of InterClient 2.01
examples
//
// Copyright InterBase Software Corporation, 1998.
// Written by com.inprise.interbase.interclient.r&d.PaulOstler :-)
//
// Code was modified by Roman Rokytskyy to show that Firebird JCA-
JDBC driver
// does not introduce additional complexity in normal driver usage
scenario.
//
// An example of using a JDBC 2 Standard Extension DataSource.
// The DataSource facility provides an alternative to the JDBC
DriverManager,
// essentially duplicating all of the driver managerÒs useful
functionality.
// Although, both mechanisms may be used by the same application if
desired,
// JavaSoft encourages developers to regard the DriverManager as a
legacy
// feature of the JDBC API.
// Applications should use the DataSource API whenever possible.
// A JDBC implementation that is accessed via the DataSource API is
not
// automatically registered with the DriverManager.
// The DriverManager, Driver, and DriverPropertyInfo interfaces
// may be deprecated in the future.

public final class DataSourceExample2
{
static public void main (String args[]) throws Exception
{
// Create an Firebird data source manually;

org.firebirdsql.pool.FBWrappingDataSource dataSource =
new org.firebirdsql.pool.FBWrappingDataSource();

// Set the standard properties
dataSource.setDatabase
("c:/database/employee.gdb"); //localhost/3050:
dataSource.setDescription ("An example database of employees");

/*
* Following properties were not deleted in order to show
differences
* between InterClient 2.01 data source implementation and Firebird
one.
*/

//dataSource.setDataSourceName ("Employee");
//dataSource.setPortNumber (3060);
//dataSource.setNetworkProtocol ("jdbc:interbase:");
//dataSource.setRoleName (null);

// Set the non-standard properties
//dataSource.setCharSet
(interbase.interclient.CharacterEncodings.NONE);
//dataSource.setSuggestedCachePages (0);
//dataSource.setSweepOnConnect (false);

// this some kind of equivalent to dataSource.setNetworkProtocol
(String)
// possible values are "type4", "type2" and "embedded".
dataSource.setType("embedded"); //embedded

// SQL Role can be set like this:
//
// dataSource.setRoleName("USER");

// Character encoding for the connection is set to NONE
//dataSource.setEncoding("NONE");

// other non-standard properties do not have setters
// you can pass any DPB parameter
//
// dataSource.setNonStandardProperty("isc_dpb_sweep", null);
// dataSource.setNonStandardProperty
("isc_dpb_num_buffers", "75");

// Connect to the Firebird DataSource
try {
dataSource.setLoginTimeout (2);
java.sql.Connection c = dataSource.getConnection
("sysdba", "masterkey");
System.out.println ("got connection");
Statement statement = c.createStatement();
ResultSet resultset = statement.executeQuery("select * from "
+ "country");
//ResultSet resultset = statement.executeQuery("select *
from " + "hardware");
ResultSetMetaData resultsetmetadata = resultset.getMetaData();
//statement.executeUpdate("delete from " + s1);
// At this point, there is no implicit driver instance
// registered with the driver manager!
int j = resultsetmetadata.getColumnCount();
int ai[] = new int[j];
String s2 = "";
for(int k = 0; k < j; k++) {
s2 = s2 + "," + resultsetmetadata.getColumnName(k + 1);
}
System.out.println(s2);
statement.executeUpdate(""+
"CREATE TABLE \"HARDWARE2\" (\"ID\" INTEGER NOT
NULL, "+
" \"PARENT\" INTEGER NOT
NULL, "+
" \"ADDR\" INTEGER NOT
NULL, "+
" \"NICK\" VARCHAR(24) CHARACTER SET WIN1251 NOT NULL COLLATE
PXW_CYRL, "+
" \"LEGEND\" VARCHAR(64) CHARACTER SET WIN1251 COLLATE
PXW_CYRL, "+
" \"SENSE\" VARCHAR(12) CHARACTER SET WIN1251 COLLATE
PXW_CYRL, "+
" \"DTYPE\" VARCHAR(24) CHARACTER SET WIN1251 COLLATE
PXW_CYRL, "+
" \"INITVALUE\"
FLOAT, "+
" \"TAG_ID\" INTEGER NOT
NULL, "+
"UNIQUE
(\"NICK\"),
"+
"PRIMARY KEY (\"ID\"))");

statement.close();
c.close ();
}
catch (java.sql.SQLException e) {
e.printStackTrace();
System.out.println ("sql exception: " + e.getMessage ());
}
}
}