public final class DataSourceExample
{
static public void main (String args[]) throws Exception
{
org.firebirdsql.pool.FBWrappingDataSource dataSource =
new org.firebirdsql.pool.FBWrappingDataSource();
dataSource.setDatabase ("localhost/3050:c:/database/test_charset.fdb");
dataSource.setDescription ("An example database of employees");
dataSource.setType("TYPE4");
dataSource.setEncoding("ISO8859_1");
try {
dataSource.setLoginTimeout (10);
java.sql.Connection c = dataSource.getConnection ("sysdba", "masterkey");
java.sql.Statement stmt = c.createStatement();
java.sql.ResultSet rs = stmt.executeQuery("SELECT * FROM test_charset");
while(rs.next())
System.out.println("a1 = " + rs.getString(1) + ", a2 = " + rs.getString(2));
stmt.close();
System.out.println ("got connection");
c.close ();
}
catch (java.sql.SQLException e) {
e.printStackTrace();
System.out.println ("sql exception: " + e.getMessage ());
}
}
}
source
share