java sybase jdbc 连接问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16444534/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 22:58:19 来源:igfitidea点击:
sybase jdbc connection issue
提问by buttowski
i am just a beginner in sybase. am trying make a simple jdbc connection to my sybase server. using below code.
我只是 sybase 的初学者。我正在尝试与我的 sybase 服务器建立一个简单的 jdbc 连接。使用下面的代码。
i have jcon3.jar in my classpath too.
我的类路径中也有 jcon3.jar。
try {
Class.forName("com.sybase.jdbc3.jdbc.SybDataSource");
System.out.println("before connection");
Connection conn = DriverManager.getConnection("jdbc:sybase:Tds:localhost:1326/db","butt","clear");
System.out.println("after connection");
} catch (Exception e) {
e.printStackTrace();
}
i am not able achieve what i expect. below is the error i am getting.
我无法实现我的期望。下面是我得到的错误。
inside try
before connection
java.sql.SQLException: JZ00L: Login failed. Examine the SQLWarnings chained to this exception for the reason(s).
at com.sybase.jdbc3.jdbc.ErrorMessage.raiseError(Unknown Source)
at com.sybase.jdbc3.tds.Tds.for(Unknown Source)
at com.sybase.jdbc3.tds.Tds.a(Unknown Source)
at com.sybase.jdbc3.tds.Tds.login(Unknown Source)
at com.sybase.jdbc3.jdbc.SybConnection.a(Unknown Source)
at com.sybase.jdbc3.jdbc.SybConnection.a(Unknown Source)
at com.sybase.jdbc3.jdbc.SybConnection.<init>(Unknown Source)
at com.sybase.jdbc3.jdbc.SybConnection.<init>(Unknown Source)
at com.sybase.jdbc3.jdbc.SybDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at com.risk.JDBC.TestJdbc.main(TestJdbc.java:19)
SQL Error : State=[JZ00L] JZ00L: Login failed. Examine the SQLWarnings chained to this exception for the reason(s).
SQL Error : State=[JZ0IB] JZ0IB: The server's default charset of roman8 does not map to an encoding that is available in the client Java environment. Because jConnect will not be able to do client-side conversion, the connection is unusable and is being closed. Try using a later Java version, or try including your Java installation's i18n.jar or charsets.jar file in the classpath.
SQL Error : State=[JZ006] JZ006: Caught IOException: java.io.CharConversionException: java.io.UnsupportedEncodingException: hp-roman8
回答by
- Download Sybase's latest version of the driver.
- Include the Sybase driver's i18n.jar and/or charsets.jar.
- 下载 Sybase 最新版本的驱动程序。
- 包括 Sybase 驱动程序的 i18n.jar 和/或 charsets.jar。