@@ -126,6 +126,7 @@ public class RubyJdbcConnection extends RubyObject {
126126 private IRubyObject adapter ; // the AbstractAdapter instance we belong to
127127 private volatile boolean connected = true ;
128128 private RubyClass attributeClass ;
129+ private RubyClass timeZoneClass ;
129130
130131 private boolean lazy = false ; // final once set on initialize
131132 private boolean jndi ; // final once set on initialize
@@ -135,6 +136,7 @@ public class RubyJdbcConnection extends RubyObject {
135136 protected RubyJdbcConnection (Ruby runtime , RubyClass metaClass ) {
136137 super (runtime , metaClass );
137138 attributeClass = runtime .getModule ("ActiveModel" ).getClass ("Attribute" );
139+ timeZoneClass = runtime .getModule ("ActiveSupport" ).getClass ("TimeWithZone" );
138140 }
139141
140142 private static final ObjectAllocator ALLOCATOR = new ObjectAllocator () {
@@ -2441,6 +2443,9 @@ protected void setStatementParameter(final ThreadContext context,
24412443 if (attributeClass .isInstance (attribute )) {
24422444 type = jdbcTypeForAttribute (context , attribute );
24432445 value = valueForDatabase (context , attribute );
2446+ } else if (timeZoneClass .isInstance (attribute )) {
2447+ type = jdbcTypeFor ("timestamp" );
2448+ value = attribute ;
24442449 } else {
24452450 type = jdbcTypeForPrimitiveAttribute (context , attribute );
24462451 value = attribute ;
0 commit comments