Subject | Why can I read but not write? |
---|---|
Author | maxtelfer |
Post date | 2004-03-23T10:45:26Z |
Hi all
I am using Windows XP, Tomcat 4.1.29 and Java.
The firebirdsql-full.jar file is in the conf folder.
I have performed a default installation of Firebird-1.5.0.4306-
Win32.exe.
1. I can both read and write to my database with isql OK.
2. Using both Driver and the Connection Pool example approaches,
I can read using SELECT but cannot write with UPDATE, etc.
An extract based on the sample code in Jaybird doco follows.
The output yields:
In RNDS 1 sql= etc
In RNDS 2 sql= etc
In RNDS str='its correct value'
In RNDS 3 sql= etc
Whither the line In RNDS 4 ??
Max
org.firebirdsql.pool.FBWrappingDataSource fbwds = new
org.firebirdsql.pool.FBWrappingDataSource();
fbwds.setDatabase("//localhost:3050/c:/program
files/Firebird/Firebird_1_5/bin/mydb.FDB");
fbwds.setUserName("sysdba");
fbwds.setPassword("masterkey");
fbwds.setIdleTimeoutMinutes(30);
fbwds.setPooling(true); // this turns on pooling for this data
source. Max and min must be set.
fbwds.setMinSize(5); // this sets the minimum number of connections
to keep in the pool
fbwds.setMaxSize(30); // this sets the maximum number of connections
that can be open at one time.
fbwds.setLoginTimeout(10);
// Get a database connection
Connection con = null;
Statement statement = null;
ResultSet rs = null;
String sql = "";
try
{
con = fbwds.getConnection();
statement = con.createStatement();
}
catch (SQLException e)
{
System.out.println("getting new fbwds connection failed!
Error: "+e+"\n");
}
sql = "select * from RosterHeaderDetails'";
System.out.println("In RNDS 1 sql=" + sql);
rs = statement.executeQuery(sql);
System.out.println("In RNDS 2 sql=" + sql);
String str = rs.getString("IncludeLogo");
System.out.println("In RNDS str=" + str);
sql = "UPDATE RosterHeaderDetails SET IncludeLogo = '1'";
System.out.println("In RNDS 3 sql=" + sql);
rs = statement.executeQuery(sql);
System.out.println("In RNDS 4 sql=" + sql);
con.close();
I am using Windows XP, Tomcat 4.1.29 and Java.
The firebirdsql-full.jar file is in the conf folder.
I have performed a default installation of Firebird-1.5.0.4306-
Win32.exe.
1. I can both read and write to my database with isql OK.
2. Using both Driver and the Connection Pool example approaches,
I can read using SELECT but cannot write with UPDATE, etc.
An extract based on the sample code in Jaybird doco follows.
The output yields:
In RNDS 1 sql= etc
In RNDS 2 sql= etc
In RNDS str='its correct value'
In RNDS 3 sql= etc
Whither the line In RNDS 4 ??
Max
org.firebirdsql.pool.FBWrappingDataSource fbwds = new
org.firebirdsql.pool.FBWrappingDataSource();
fbwds.setDatabase("//localhost:3050/c:/program
files/Firebird/Firebird_1_5/bin/mydb.FDB");
fbwds.setUserName("sysdba");
fbwds.setPassword("masterkey");
fbwds.setIdleTimeoutMinutes(30);
fbwds.setPooling(true); // this turns on pooling for this data
source. Max and min must be set.
fbwds.setMinSize(5); // this sets the minimum number of connections
to keep in the pool
fbwds.setMaxSize(30); // this sets the maximum number of connections
that can be open at one time.
fbwds.setLoginTimeout(10);
// Get a database connection
Connection con = null;
Statement statement = null;
ResultSet rs = null;
String sql = "";
try
{
con = fbwds.getConnection();
statement = con.createStatement();
}
catch (SQLException e)
{
System.out.println("getting new fbwds connection failed!
Error: "+e+"\n");
}
sql = "select * from RosterHeaderDetails'";
System.out.println("In RNDS 1 sql=" + sql);
rs = statement.executeQuery(sql);
System.out.println("In RNDS 2 sql=" + sql);
String str = rs.getString("IncludeLogo");
System.out.println("In RNDS str=" + str);
sql = "UPDATE RosterHeaderDetails SET IncludeLogo = '1'";
System.out.println("In RNDS 3 sql=" + sql);
rs = statement.executeQuery(sql);
System.out.println("In RNDS 4 sql=" + sql);
con.close();