我正在尝试使用DB2JDBC Type4驱动程序配置DB2连接。但我收到此错误。
线程“主”中的异常com.ibm.db2.jcc.am.SqlInvalidAuthorizationSpecException:[jcc] [t4] [201] [11237] [3.64.104]发生了连接授权失败。原因:不支持安全机制。错误代码= -4214,SQLSTATE = 28000
我的代码是
public Connection getConnection() throws ClassNotFoundException, InstantiationException,
IllegalAccessException, SQLException{
Driver driver = (Driver) Class.forName ( "com.ibm.db2.jcc.DB2Driver" ).newInstance();
DriverManager.registerDriver(driver);
Connection connection = DriverManager.getConnection("jdbc:db2://hostname:portnumber
/DBName", "username","password" );
System.out.println( "From DAO, connection obtained " );
return connection;
}
Run Code Online (Sandbox Code Playgroud)
异常日志:
Exception in thread "main" com.ibm.db2.jcc.am.SqlInvalidAuthorizationSpecException:
[jcc][t4][201][11237][3.64.104] Connection authorization failure occurred.
Reason: Security mechanism not supported. ERRORCODE=-4214, SQLSTATE=28000
at com.ibm.db2.jcc.am.bd.a(bd.java:677)
at com.ibm.db2.jcc.am.bd.a(bd.java:60)
at com.ibm.db2.jcc.am.bd.a(bd.java:120)
at com.ibm.db2.jcc.t4.b.f(b.java:2389)
at com.ibm.db2.jcc.t4.b.a(b.java:1712)
at com.ibm.db2.jcc.t4.y.b(y.java:3612)
at com.ibm.db2.jcc.t4.y.a(y.java:477)
at com.ibm.db2.jcc.t4.y.a(y.java:117)
at …Run Code Online (Sandbox Code Playgroud) 假设我需要生成变量来保存用户的一些输入(我不知道它们有多少).如果不使用Array,ArrayList(和其他类型的列表和地图),可我的代码生成(可以说)String有相似的名字(变量X倍String var001,String var002,String var003,等)?如果是,请提供示例代码.
我知道一般的定义,但我需要更多关于如何一般地实现它们的细节和特定的PHP,以及我从中获得的功能究竟是什么?
我正在测试 Java (SE7) 如何int通过以下代码处理超过其最大值的 :
int index = 2147483647;//the maximum value of int
long size = 2147483648L; //More than the maximum value of int by 1
int safeCounter=0; //To prevent the infinite loop
while (index<size)
{
System.out.println("Index now is : "+index);//show the int value
index++; //increment the int value
safeCounter++; //increment the number of desired loops
if (safeCounter==3){
break;//to break the loop after 3 turns
}
}
Run Code Online (Sandbox Code Playgroud)
我得到的是:
现在的索引是:2147483647 现在的索引是:-2147483648 现在的索引是:-2147483647
因此,在对此感到困惑之后,(如果我不使用safeCounter它,它将在最大值和最小值之间永远保持下去int——并且不会抛出异常)我想知道如何ArrayList处理元素数量超过最大值 …
我知道JSON对象只不过是String.
我的问题是我有一个Object of Object,我想把它转换成Json格式.
示例:
Java Class ->
Class Person{
private String name;
private String password;
private int number;
}
Java list ->
Map<List<Long>,List<Person>> map=new HashMap<List<Long>,List<Person>>();
..and map has Some data filled in it.
Run Code Online (Sandbox Code Playgroud)
我想将该列表转换为
Json Format?
Run Code Online (Sandbox Code Playgroud)
我怎么能实现它?因为我想通过HttpClient发送它...如果不是另一种替代方式呢?
据我所知,有Gson API可用,但我不知道如何使用它或以其他有效的方式.
谢谢
我一直在寻找在调用方法(或方法链)时处理空对象的最佳选择.
我们的常见做法是检查条件:
if ( customObject != null ) {
customObject.callMe();
}
Run Code Online (Sandbox Code Playgroud)
使用扩展方法可以进一步改进:
Program customObject = null;
if (customObject.NotNull()) {
customObject.CallMe();
}
public static bool NotNull(this object o) {
return o == null;
}
Run Code Online (Sandbox Code Playgroud)
请注意:我通常会忽略!从我的编程实践.因此,明智地说对我来说扩展方法很好.
但是,在处理涉及Method链的时候,它变得非常复杂.
customObject.CallMe().CallMe2() ex...
Run Code Online (Sandbox Code Playgroud)
你怎么认为它可以在C#中处理,所以CallMe只有在customObject不为null时CallMe2调用它,并且仅在CallMe返回非null对象时才被调用.
当然我可以使用If条件或三元运算符.但是,我想知道vNext,C#5.0是否有一些东西可以提供.
HTML:
<div id="parent">
<div id="anim_div">:D</div>
</div>
Run Code Online (Sandbox Code Playgroud)
jQuery:
$('#anim_div').addClass('animation');
setTimeout(function(){
$('#parent').hide();
},1000);
setTimeout(function(){
$('#parent').show();
},2000);
Run Code Online (Sandbox Code Playgroud)
CSS:
#parent {
width:400px;
height:150px;
border-right:1px solid red;
}
#anim_div {
position:absolute;
}
.animation {
-webkit-animation:anim 4s;
}
@-webkit-keyframes anim {
0% {
left:0px;
}
100% {
left:400px;
}
}
Run Code Online (Sandbox Code Playgroud)
演示: http: //jsfiddle.net/o7bt7p3a/
仅通过 css隐藏和显示父元素后,有什么方法可以停止动画重复/重置?
我尝试使用WebsphereLiberty®上的选项(参考以下IBM®Knowledge Center)来设置JDBC驱动程序的securityMechanism属性,但是在启动Websphere Liberty(2015年7月测试版)时收到警告消息。TLS_CLIENT_CERTIFICATE_SECURITYCWWKG0032W
您能告诉我如何通过Websphere Liberty上securityMechanism的TLS_CLIENT_CERTIFICATE_SECURITY选项设置JDBC驱动程序的属性吗?
IBM Data Server Driver for JDBC和SQLJ支持证书认证
用于JDBC和SQLJ的IBM®数据服务器驱动程序支持对证书认证的客户机支持,以支持到DB2®for z /OS®版本10或更高版本的数据服务器的连接。
Websphere Liberty Server启动时的console.log
CWWKG0032W: Unexpected value specified for property
[securityMechanism], value = [18]. >Expected value(s) are:
[3][4][7][9][11][12][13][15][16].
Run Code Online (Sandbox Code Playgroud)
securityMechanism="18"是TLS_CLIENT_CERTIFICATE_SECURITY,我通过以下方式确认了该值:
\>javac -classpath .;db2jcc4.jar; JDBCCheck
\>java -classpath .;db2jcc4.jar; JDBCCheck
TLS_CLIENT_CERTIFICATE_SECURITY: 18
Run Code Online (Sandbox Code Playgroud)
JDBCCheck类:
class JDBCCheck{
public static void main(String args[]){
com.ibm.db2.jcc.DB2SimpleDataSource dataSource =
new com.ibm.db2.jcc.DB2SimpleDataSource();
System.out.println( "TLS_CLIENT_CERTIFICATE_SECURITY: "
+ dataSource.TLS_CLIENT_CERTIFICATE_SECURITY);
}
} …Run Code Online (Sandbox Code Playgroud) 我收到了这个WSDL,我遇到了XSD的问题.
我似乎无法在我的XSD文件中找到问题.
什么没约束?我怎么解决这个问题?
error: The prefix "xsd" for element "xsd:schema" is not bound.
Run Code Online (Sandbox Code Playgroud)
这是XSD文件的一部分:
<xsd:schema targetNamespace="http://www.informatica.com/wsdl/"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns="http://www.informatica.com/wsdl/"
xmlns:infatype="http://www.informatica.com/types/">
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/http/"/>
<xsd:element name="SHA003Bis_GetArticleDataResponse"
type="SHA003Bis_GetArticleDataResponseType"/>
<xsd:element name="SHA003Bis_GetArticleDataRequest"
type="SHA003Bis_GetArticleDataRequestType"/>
<xsd:complexType name="SHA003Bis_GetArticleDataRequestType">
<xsd:sequence>
<xsd:element name="SHA003Bis_GetArticleDataRequestElement">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Company" minOccurs="0" maxOccurs="1">
<xsd:simpleType>
<xsd:restriction base="xsd:integer"/>
</xsd:simpleType>
</xsd:element>
Run Code Online (Sandbox Code Playgroud)
这是WSDL的一部分:
<wsdl:definitions targetNamespace="http://www.informatica.com/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:n="http://www.informatica.com/wsdl/"
xmlns:infa="http://www.informatica.com/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<xsd:schema targetNamespace="http://www.informatica.com/wsdl/"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xmlns="http://www.informatica.com/wsdl/"
xmlns:infatype="http://www.informatica.com/types/">
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/http/"/>
<xsd:element name="SHA003Bis_GetArticleDataResponse"
type="SHA003Bis_GetArticleDataResponseType"/>
<xsd:element name="SHA003Bis_GetArticleDataRequest"
type="SHA003Bis_GetArticleDataRequestType"/>
<xsd:complexType name="SHA003Bis_GetArticleDataRequestType">
<xsd:sequence>
<xsd:element name="SHA003Bis_GetArticleDataRequestElement">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Company" …Run Code Online (Sandbox Code Playgroud) 当我在Eclipse中运行它时,我有一个项目可以很好地运行。但是,当我将其导出为可运行的Jar时,它从几天前就为我提供了该项目的旧版本。
我不知道为什么或如何导出据我所知不再存在的旧代码和文件。
我尝试执行Project> Clean,但是没有用
这是一个已知的月食错误吗?
有什么建议么?