免费注册 查看新帖 |

Chinaunix

广告
  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 16612 | 回复: 7
打印 上一主题 下一主题

jdbc连接oracle时如何指定字符集?在线等!!! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-02-04 11:26 |只看该作者 |倒序浏览
通过jdbc连接oracle时如何指定客户端的字符集?在线等!!!

论坛徽章:
0
2 [报告]
发表于 2005-02-04 14:12 |只看该作者

jdbc连接oracle时如何指定字符集?在线等!!!

帮帮忙呀!兄弟姐妹们!!!

论坛徽章:
0
3 [报告]
发表于 2005-02-05 00:10 |只看该作者

jdbc连接oracle时如何指定字符集?在线等!!!

If use the OCI JDBC to connect, "NLS_LANG" in client will be used.
If use the Thin JDBC to connect, you can use "request.setCharacterEncoding" to transfer the character set.

论坛徽章:
0
4 [报告]
发表于 2005-02-05 11:10 |只看该作者

jdbc连接oracle时如何指定字符集?在线等!!!

我试试
谢谢了先!!!

论坛徽章:
0
5 [报告]
发表于 2005-02-05 11:17 |只看该作者

jdbc连接oracle时如何指定字符集?在线等!!!

据小弟所知,只有jsp才有request.setCharsetEncoding这个东东,普通的java程序里怎么处理?

论坛徽章:
0
6 [报告]
发表于 2005-02-06 11:01 |只看该作者

jdbc连接oracle时如何指定字符集?在线等!!!

也是用NLS_LANG环境变量。

论坛徽章:
0
7 [报告]
发表于 2006-09-21 10:16 |只看该作者
能否在 Thin JDBC URL中指定?

格式是什么?

论坛徽章:
0
8 [报告]
发表于 2006-09-21 16:01 |只看该作者
看来想在url中指定是不现实的了
因为在oralce FAQ中提到


  1. How do I use the Properties argument?
  2. In addition to the URL, use an object of the standard Java Properties class as input. For example:

  3. java.util.Properties info = new java.util.Properties();
  4. info.put ("user", "scott");
  5. info.put ("password","tiger");
  6. info.put ("defaultRowPrefetch","15");
  7. getConnection ("jdbc:oracle:oci:@",info);

  8. The table below lists the connection properties that Oracle JDBC drivers support. Not all versions support all properties. The table below is the complete list for 10.1.0. If a property is not supported, it is silently ignored.

  9. Connection Properties Recognized by Oracle 10.1.0 JDBC Drivers Key  Value  Comment  
  10. user  String  The value of this property is used as the user name when connecting to the database.  
  11. password  String  The value of this property is used as the password when connecting to the database.  
  12. database  String  The value of this property is used as the SID of the database.  
  13. server  String  The value of this property is used as the host name of the database.  
  14. internal_logon  String  The value of this property is used as the user name when performing an internal logon. Usually this will be SYS or SYSDBA.  
  15. defaultRowPrefetch  int  The value of this property is used as the default number of rows to prefetch.  
  16. defaultExecuteBatch  int  The value of this property is used as the default batch size when using Oracle style batching.  
  17. processEscapes  boolean  If the value of this property is "false" then the default setting for Statement.setEscapeProccessing is false.  
  18. disableDefineColumnType  boolean  When this connection property has the value true, the method defineColumnType is has no effect. This is highly recommended when using the Thin driver, especially when the database character set contains four byte characters that expand to two UCS2 surrogate characters, e.g. AL32UTF8. The method defineColumnType provides no performance benefit (or any other benefit) when used with the 10.x.x Thin driver. This property is provided so that you do not have to remove the calls from your code. This is especially valuable if you use the same code with Thin driver and either the OCI or Server Internal driver.  
  19. DMSName  String  Set the name of the DMS Noun that is the parent of all JDBC DMS metrics.  
  20. DMSType  String  Set the type of the DMS Noun that is the parent of all JDBC DMS metrics.  
  21. AccumulateBatchResult  boolean  When using Oracle style batching, JDBC determines when to flush a batch to the database. If this property is true, then the number of modified rows accumulated across all batches flushed from a single statement. The default is to count each batch separately.  
  22. oracle.jdbc.J2EE13Compliant  boolean  If the value of this property is "true", JDBC uses strict compliance for some edge cases. In general Oracle's JDBC drivers will allow some operations that are not permitted in the strict interpretation of J2EE 1.3. Setting this property to true will cause those cases to throw SQLExceptions. There are some other edge cases where Oracle's JDBC drivers have slightly different behavior than defined in J2EE 1.3. This results from Oracle having defined the behavior prior to the J2EE 1.3 specification and the resultant need for compatibility with existing customer code. Setting this property will result in full J2EE 1.3 compliance at the cost of incompatibility with some customer code. Can be either a system property or a connection property.
  23. The default value of this property is "false" in classes12.jar and ojdbc14.jar. The default value is "true" in classes12dms.jar and ojdbc14dms.jar. It is true in the dms jars because they are used exclusively in Oracle Application Server and so J2EE compatibility is more important than compatibility with previous Oracle versions.

  24. oracle.jdbc.TcpNoDelay  boolean  If the value of this property is "true", the TCP_NODELAY property is set on the socket when using the Thin driver. See java.net.SocketOptions.TCP_NODELAY. Can be either a system property or a connection property.  
  25. defaultNChar  boolean  If the value of this property is "true", the default mode for all character data columns will be NCHAR.  
  26. useFetchSizeWithLongColumn  boolean  If the value of this property is "true", then JDBC will prefetch rows even though there is a LONG or LONG RAW column in the result. By default JDBC fetches only one row at a time if there are LONG or LONG RAW columns in the result. Setting this property to true can improve performance but can also cause SQLExceptions if the results are too big.  
  27. remarksReporting  boolean  If the value of this property is "true", OracleDatabaseMetaData will include remarks in the metadata. This can result in a substantial reduction in performance.  
  28. includeSynonyms  boolean  If the value of this property is "true", JDBC will include synonyms when getting information about a column.  
  29. restrictGetTables  boolean  If the value of this property is "true", JDBC will return a more refined value for DatabaseMetaData.getTables. By default JDBC will return things that are not accessible tables. These can be non-table objects or accessible synonymns for inaccessible tables. If this property is true JDBC will return only accessible tables. This has a substantial performance penalty.  
  30. fixedString  boolean  If the value of this property is "true", JDBC will use FIXED CHAR semantic when setObject is called with a String argument. By default JDBC uses VARCHAR semantics. The difference is in blank padding. With the default there is no blank padding so, for example, 'a' does not equal 'a ' in a CHAR(4). If true these two will be equal.  
  31. oracle.jdbc.ocinativelibrary  String  Set the name of the native library for the oci driver. If not set, the default name, libocijdbcX (X is a version number), is used.  
  32. SetBigStringTryClob  boolean  Setting this property to "true" forces PreparedStatement.setString method to use setStringForClob if the data is larger than 32765 bytes. Please note that using this method with VARCHAR and LONG columns may cause large data to be truncated silently, or cause other errors differing from the normal behavior of setString.  
  33. oracle.jdbc.StreamBufferSize  int  Set size of the buffer for the InputStream/Reader obtained from getXXXStream/getXXXReader. The default size is 16k. The size passed should be at least 4096 or else 4096 is assumed.  
  34. OCINewPassword  String  Pass the value of new password to be set during logon. This could be typically used for resetting the password when the password has expired or when the account is in the grace period.  
  35. oracle.jdbc.RetainV9BehaviorForLongBind  boolean  This is applicable only for the thin driver.
  36. Pass true to retain the V9 bind behavior for Long and potential long binds.
  37. false is the default behavior which would emulate the same behavior as in OCI driver.  
  38. oracle.jdbc.FreeMemoryOnEnterImplicitCache  boolean  Clear the define buffers before caching the statement when Implicit statement caching is enabled.
  39. Setting the value to true would enable the clearing of define buffers before caching of Statements in the Statement cache. false is the default value and this would behave in the same way as statement caching worked in prior releases.

  40. oracle.jdbc.ReadTimeout  int  Read timeout while reading from the socket. This affects thin driver only. Timeout is in milliseconds.


  41. Back to Top

  42. 根本就没有设置字符集的属性,而且属性不能直接在url中增加
复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP