Mssql的大小写一定没错,否则,获得不到对象。 你觉得我的初始化哪里错了? 配置过程: l 在“资源”中点“JDBC 提供程序”。 l 点“新建”,创建一个新的JDBC连结。 l 我选的驱动是:IBM提供的MSSQL驱动。 l 建立完JDBC连结后。点击左侧的“安全性”,点击“JAAS配置”,点击“J2C 认证数据”。 l 点击“新建”,建立一个认证。用户标识:就是登陆数据库的用户名。密码就是登陆数据库的密码。 l 接着,配置数据源。 l 点击进入刚才建立的JDBC,在其他属性中,点击进入“数据源”,新建一个数据源。 l 输入名字、JNDI名。“组件受管认证别名”和“容器受管的认证别名”中选择刚才建立的J2C 认证数据。“映射 - 配置别名”中选“DefaultPrincipalMapping”,点“确定”。 l 在“定制属性”中修改各种属性值。 “databaseName”:数据库名 “serverName ”:数据库所在的服务器名/IP “portNumber ”:数据库端口 l 在数据源列表中,有个“测试连接”,点击测试,OK!成功!
我是在一台机子上的。 现在解决了问题 : http://expert.csdn.net/Expert/topic/2949/2949579.xml?temp=.3253748但又出来新的问题: 本来可以获得OBJECT,现在不行,无法通过安全检验 ,包错: com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object. Root exception is java.lang.Exception: Failed security check. Client is not permitted to create connection factory Mssql我什么都没改过阿,怎么会这样? 应该如何验证呢? 谁能帮我?
既然 Context context = new ConnWebsphere().getContex("corbaloc:iiop:guess:2809"); 确认你的websphere的IIOP端口是否开了2809,如果有别的IIOP端口可以换个试试还有是否该这么写: Context context = new ConnWebsphere().getContext("corbaloc:iiop://guess:2809");
to kinzey34(无声之舞): Context context = new ConnWebsphere().getContext("corbaloc:iiop://guess:2809"); 是不对的。 包错: javax.naming.ConfigurationException: Malformed provider URL: corbaloc:iiop:://guess:2809. Root exception is org.omg.CORBA.BAD_PARAM: empty port vmcid: OMG minor code: 9 completed: No我是已经得到对象了,只是转型失败。
to CoolAbu(阿卜-Never Stop) : 一开始,我在java中将所有WEBSPHERE的包都打进去了。报这个安全的错。 现在,我将一些包删了。错是不报了。但是转型又失败了。
我在ibm websphere 论坛中得到的答案: You need to check in the InfoCenter under "J2EE Client Container" or "launchClient.bat". You will be much better off using the J2EE client container to connect to WebSphere resources like DataSources than trying things on your own like this.但不知道 "J2EE Client Container"是什么东西?
你觉得我的初始化哪里错了?
配置过程:
l 在“资源”中点“JDBC 提供程序”。
l 点“新建”,创建一个新的JDBC连结。
l 我选的驱动是:IBM提供的MSSQL驱动。
l 建立完JDBC连结后。点击左侧的“安全性”,点击“JAAS配置”,点击“J2C 认证数据”。
l 点击“新建”,建立一个认证。用户标识:就是登陆数据库的用户名。密码就是登陆数据库的密码。
l 接着,配置数据源。
l 点击进入刚才建立的JDBC,在其他属性中,点击进入“数据源”,新建一个数据源。
l 输入名字、JNDI名。“组件受管认证别名”和“容器受管的认证别名”中选择刚才建立的J2C 认证数据。“映射 - 配置别名”中选“DefaultPrincipalMapping”,点“确定”。
l 在“定制属性”中修改各种属性值。
“databaseName”:数据库名
“serverName ”:数据库所在的服务器名/IP
“portNumber ”:数据库端口
l 在数据源列表中,有个“测试连接”,点击测试,OK!成功!
这是类型转换错误,也就是说你返回的object对象不能转换为DataSource。你检查一下是不是配置哪儿有点问题?
现在解决了问题 :
http://expert.csdn.net/Expert/topic/2949/2949579.xml?temp=.3253748但又出来新的问题:
本来可以获得OBJECT,现在不行,无法通过安全检验 ,包错:
com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object. Root exception is java.lang.Exception: Failed security check. Client is not permitted to create connection factory Mssql我什么都没改过阿,怎么会这样?
应该如何验证呢?
谁能帮我?
String user = "bibi";
String password = "12345678";
Properties properties = null;
try {
properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
properties.put(Context.PROVIDER_URL, url);
if (user != null) {
properties.put(Context.SECURITY_PRINCIPAL, user);
properties.put(Context.SECURITY_CREDENTIALS,
password == null ? "" : password);
}
Context context = new ConnWebsphere().getContex("corbaloc:iiop:guess:2809");
确认你的websphere的IIOP端口是否开了2809,如果有别的IIOP端口可以换个试试还有是否该这么写:
Context context = new ConnWebsphere().getContext("corbaloc:iiop://guess:2809");
Context context = new ConnWebsphere().getContext("corbaloc:iiop://guess:2809");
是不对的。
包错:
javax.naming.ConfigurationException: Malformed provider URL: corbaloc:iiop:://guess:2809. Root exception is org.omg.CORBA.BAD_PARAM: empty port vmcid: OMG minor code: 9 completed: No我是已经得到对象了,只是转型失败。
一开始,我在java中将所有WEBSPHERE的包都打进去了。报这个安全的错。
现在,我将一些包删了。错是不报了。但是转型又失败了。
You need to check in the InfoCenter under "J2EE Client Container" or
"launchClient.bat". You will be much better off using the J2EE client
container to connect to WebSphere resources like DataSources than
trying things on your own like this.但不知道 "J2EE Client Container"是什么东西?