Issue Details (XML | Word | Printable)

Key: DERBY-149
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Kathey Marsden
Reporter: A B
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

Server hang when invalid string is bound to datetime columns.

Created: 19/Feb/05 06:37 AM   Updated: 04/Jan/06 08:05 AM
Return to search
Component/s: Network Server
Affects Version/s: None
Fix Version/s: 10.1.2.1, 10.2.1.6

Time Tracking:
Not Specified

Environment: Derby running with Network Server via JDBC universal driver.

Resolution Date: 11/Oct/05 12:56 PM


 Description  « Hide
When running against Derby Network Server with the JCC driver, attempts to bind an invalid date/time string to a date/time/timestamp parameter lead to a hang in either the JCC client or in the Network Server (not sure which).

The problem does NOT occur if the same thing is run against a DB2 server, which suggests the bug is in Network Server, not in the JCC driver. That said, though, the problem also does NOT happen if one uses an ODBC client to connect to Network Server, instead of a JDBC client--so perhaps it's a problem with JCC, after all...hard to say one way or the other...

Here's a simple program to reproduce the problem:

import java.sql.*;

public class go {

public static void main (String[] args) throws Exception {

Class.forName("com.ibm.db2.jcc.DB2Driver");
Connection c = DriverManager.getConnection(
"jdbc:derby:net://localhost:1527/ugh;create=true", "bah", "humbug");

Statement s = c.createStatement();
try {
s.execute("drop table dt");
} catch (SQLException se) {}

s.execute("create table dt (d date)");
PreparedStatement pSt = c.prepareStatement("insert into dt values (?)");

try {
pSt.setString(1, "oops"); // invalid date value.
pSt.execute();
} catch (SQLException se) {
System.out.println("Got " + se.getSQLState() + ": " + se.getMessage());
}
}

}

Of course, in order for the program to run, one must start the Network Server on port 1527 first.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
A B made changes - 19/Feb/05 07:03 AM
Field Original Value New Value
Description When running against Derby Network Server with the JCC driver, attempts to bind an invalid date/time string to a date/time/timestamp parameter lead to a hang in the client program.

The problem does NOT occur if the same thing is run against a DB2 server, which suggests the bug is in Network Server, not in the JCC driver. That said, though, the problem also does NOT happen if one uses an ODBC client to connect to Network Server, instead of a JDBC client--so perhaps it's a problem with JCC, after all...hard to say one way or the other...

Here's a simple program to reproduce the problem:

import java.sql.*;

public class go {

public static void main (String[] args) throws Exception {

Class.forName("com.ibm.db2.jcc.DB2Driver");
Connection c = DriverManager.getConnection(
"jdbc:derby:net://localhost:1527/ugh;create=true", "bah", "humbug");

Statement s = c.createStatement();
try {
s.execute("drop table dt");
} catch (SQLException se) {}

s.execute("create table dt (d date)");
PreparedStatement pSt = c.prepareStatement("insert into dt values (?)");

try {
pSt.setString(1, "oops"); // invalid date value.
pSt.execute();
} catch (SQLException se) {
System.out.println("Got " + se.getSQLState() + ": " + se.getMessage());
}
}

}

Of course, in order for the program to run, one must start the Network Server on port 1527 first.
When running against Derby Network Server with the JCC driver, attempts to bind an invalid date/time string to a date/time/timestamp parameter lead to a hang in either the JCC client or in the Network Server (not sure which).

The problem does NOT occur if the same thing is run against a DB2 server, which suggests the bug is in Network Server, not in the JCC driver. That said, though, the problem also does NOT happen if one uses an ODBC client to connect to Network Server, instead of a JDBC client--so perhaps it's a problem with JCC, after all...hard to say one way or the other...

Here's a simple program to reproduce the problem:

import java.sql.*;

public class go {

public static void main (String[] args) throws Exception {

Class.forName("com.ibm.db2.jcc.DB2Driver");
Connection c = DriverManager.getConnection(
"jdbc:derby:net://localhost:1527/ugh;create=true", "bah", "humbug");

Statement s = c.createStatement();
try {
s.execute("drop table dt");
} catch (SQLException se) {}

s.execute("create table dt (d date)");
PreparedStatement pSt = c.prepareStatement("insert into dt values (?)");

try {
pSt.setString(1, "oops"); // invalid date value.
pSt.execute();
} catch (SQLException se) {
System.out.println("Got " + se.getSQLState() + ": " + se.getMessage());
}
}

}

Of course, in order for the program to run, one must start the Network Server on port 1527 first.
Kathey Marsden made changes - 19/Sep/05 11:03 AM
Assignee Kathey Marsden [ kmarsden ]
Kathey Marsden made changes - 21/Sep/05 06:41 AM
Status Open [ 1 ] In Progress [ 3 ]
Kathey Marsden made changes - 11/Oct/05 12:56 PM
Fix Version/s 10.2.0.0 [ 11187 ]
Fix Version/s 10.1.2.0 [ 12310270 ]
Resolution Fixed [ 1 ]
Fix Version/s 10.1.1.2 [ 12310353 ]
Status In Progress [ 3 ] Resolved [ 5 ]
Kristian Waagan made changes - 04/Jan/06 08:05 AM
Status Resolved [ 5 ] Closed [ 6 ]