Author: jiwils
Date: 2009-01-03 22:17:17 -0500 (Sat, 03 Jan 2009)
New Revision: 7343
Modified:
core/branches/1.4.X/src/org/jboss/cache/loader/JDBCCacheLoader.java
Log:
Fix for JBCACHE-1452. Use of Sybase Driver sets null as LONGVARBINARY rather than BLOB.
Modified: core/branches/1.4.X/src/org/jboss/cache/loader/JDBCCacheLoader.java
===================================================================
--- core/branches/1.4.X/src/org/jboss/cache/loader/JDBCCacheLoader.java 2009-01-02
17:01:44 UTC (rev 7342)
+++ core/branches/1.4.X/src/org/jboss/cache/loader/JDBCCacheLoader.java 2009-01-04
03:17:17 UTC (rev 7343)
@@ -72,7 +72,7 @@
private static final Log log=LogFactory.getLog(JDBCCacheLoader.class);
private static final ThreadLocal connection = new ThreadLocal();
-
+
private String driverName;
private String drv;
@@ -271,7 +271,7 @@
}
finally
{
- lock.releaseLock(name);
+ lock.releaseLock(name);
}
}
@@ -293,7 +293,7 @@
finally
{
lock.releaseLock(name);
- }
+ }
}
/**
@@ -352,7 +352,7 @@
finally
{
lock.releaseLock(name);
- }
+ }
}
/**
@@ -431,7 +431,7 @@
finally
{
lock.releaseLock(name);
- }
+ }
}
/**
@@ -553,7 +553,7 @@
{
log.trace("openned tx connection: tx=" + tx + ", con=" +
con);
}
- }
+ }
try
{
@@ -744,10 +744,10 @@
}
}
}
-
+
Connection con = null;
Statement st = null;
-
+
try
{
con = cf.getConnection();
@@ -1000,11 +1000,14 @@
else
{
// a hack to handles the incomp. of SQL server jdbc driver prior to SQL
SERVER 2005
- if( driverName != null && (driverName.indexOf("SQLSERVER")
>= 0
- || driverName.indexOf("POSTGRESQL") >=
0))
- ps.setNull( 2, Types.LONGVARBINARY );
- else
- ps.setNull(2, Types.BLOB);
+ if( driverName != null && (driverName.indexOf("SQLSERVER")
>= 0
+ // POSTGRES
+ || driverName.indexOf("POSTGRESQL") >= 0
+ // SYBASE
+ || driverName.indexOf("JCONNECT") >= 0))
+ ps.setNull( 2, Types.LONGVARBINARY );
+ else
+ ps.setNull(2, Types.BLOB);
//ps.setNull(2, Types.LONGVARBINARY);
}
@@ -1250,13 +1253,13 @@
throw new IllegalStateException("Failed to load driver " + drv +
": " + e.getMessage());
}
}
-
+
private static String getDriverName(Connection con)
{
if (con == null) return null;
try{
DatabaseMetaData dmd = con.getMetaData();
- return dmd.getDriverName().toUpperCase();
+ return dmd.getDriverName().toUpperCase();
}
catch(SQLException e)
{
@@ -1264,7 +1267,7 @@
// required to fully support metadata.
throw new IllegalStateException(
"Error while getting the driver name " + ": " +
e.getMessage());
- }
+ }
}
private static String getRequiredProperty(Properties props, String name)
@@ -1576,16 +1579,16 @@
// allows a unit test using DummyContext
if (dataSource == null)
throw new IllegalArgumentException("dataSource cannot be null");
-
+
this.dataSource = dataSource;
}
public Connection prepare(Object tx)
{
// we don't need to set autocommit to false beause the DataSource object
- // is almost always has a connection pool associated with it and distributed
+ // is almost always has a connection pool associated with it and distributed
// transaction participation turned on which means autocommit is off by default
-
+
try
{
return getConnection();
Show replies by date