version 1.21, 2004/06/10 13:19:18
|
version 1.24, 2004/06/22 10:33:53
|
Line 66 import com.fmi.jdbc.*;
|
Line 66 import com.fmi.jdbc.*;
|
*/ |
*/ |
public class DBBean |
public class DBBean |
{ |
{ |
|
private boolean useNormanToUnicodeMapper=false; |
Connection connection; |
Connection connection; |
String url = ""; |
String url = ""; |
DatabaseMetaData dbMetaData; |
DatabaseMetaData dbMetaData; |
Line 189 public class DBBean
|
Line 190 public class DBBean
|
{ |
{ |
// setup the properties |
// setup the properties |
java.util.Properties prop = new java.util.Properties(); |
java.util.Properties prop = new java.util.Properties(); |
prop.put("charSet", "Cp1256"); |
// prop.put("charSet", "MacCentralEurope"); |
prop.put("user", user); |
prop.put("user", user); |
prop.put("password", passwd); |
prop.put("password", passwd); |
System.out.println("url "+url); |
System.out.println("url "+url); |
if(url.indexOf("odbc")>=0) |
if(url.indexOf("fmpro")>=0) |
{ |
{ |
// Connect to the database |
// Connect to the database |
connection = DriverManager.getConnection(url, prop); |
connection = DriverManager.getConnection(url, prop); |
Line 1379 public class DBBean
|
Line 1380 public class DBBean
|
byte[] b = null; |
byte[] b = null; |
if (metaData instanceof ResultSetMetaDataExt) |
if (metaData instanceof ResultSetMetaDataExt) |
b = resultSet.getBytes(i); |
b = resultSet.getBytes(i); |
if(b!=null) |
/* if (b != null) |
{ |
{ |
java.io.ByteArrayInputStream stream =(java.io.ByteArrayInputStream)resultSet.getBinaryStream(i); |
java.io.ByteArrayInputStream stream =(java.io.ByteArrayInputStream)resultSet.getBinaryStream(i); |
// System.out.println(" stream "+resultSet.getBinaryStream(i)); |
// System.out.println(" stream "+resultSet.getBinaryStream(i)); |
Line 1398 public class DBBean
|
Line 1399 public class DBBean
|
} |
} |
byte[] bCopy=new byte[count]; |
byte[] bCopy=new byte[count]; |
System.arraycopy(b,0,bCopy,0,count); |
System.arraycopy(b,0,bCopy,0,count); |
// System.out.println(); |
|
b=bCopy; |
b=bCopy; |
} |
}*/ |
String utf8 = null; |
String utf8 = null; |
utf8 = (b == null) ? null : new String(b); |
utf8 = (b == null) ? null : new String(b); |
if (metaData instanceof ResultSetMetaDataExt) |
if (metaData instanceof ResultSetMetaDataExt) |
tableRow.addElement((b != null) ? Convert.normanToUnicode(utf8) : null); |
{ |
|
String rowElement = ""; |
|
if (b != null) |
|
{ |
|
rowElement = resultSet.getString(i); |
|
if(useNormanToUnicodeMapper) |
|
rowElement = Convert.normanToUnicode(rowElement); |
|
tableRow.addElement(rowElement); |
|
|
|
} else |
|
tableRow.addElement(null); |
|
} |
else |
else |
{ |
{ |
if(url.toLowerCase().indexOf("odbc")>=0) |
if(url.toLowerCase().indexOf("odbc")>=0) |
Line 1421 public class DBBean
|
Line 1432 public class DBBean
|
} |
} |
} catch (Exception e) |
} catch (Exception e) |
{ |
{ |
System.out.println("Hey I Got an error" + e); |
System.out.println("Hey I got an error" + e); |
e.printStackTrace(); |
e.printStackTrace(); |
} |
} |
// m_columnClasses.addElement(java.lang.String.class); |
// m_columnClasses.addElement(java.lang.String.class); |
Line 1508 public class DBBean
|
Line 1519 public class DBBean
|
metaData = (this.result==null) ?null:this.result.getMetaData(); |
metaData = (this.result==null) ?null:this.result.getMetaData(); |
return t; |
return t; |
} |
} |
|
/** |
|
* @return |
|
*/ |
|
public boolean isUseNormanToUnicodeMapper() |
|
{ |
|
return useNormanToUnicodeMapper; |
|
} |
|
|
|
/** |
|
* @param b |
|
*/ |
|
public void setUseNormanToUnicodeMapper(boolean b) |
|
{ |
|
useNormanToUnicodeMapper = b; |
|
} |
|
|
} |
} |
|
|