Weblogic :JDBC-Conncetion pool -> config new ... ->
Name: samplePool//你的名字
URL: jdbc:weblogic:mssqlserver4:127.0.0.1:1433
Driver Classname: weblogic.jdbc.mssqlserver4.Driver
Properties ://格式是:(key=value)
db=你所要连接的数据库名字
user=sa //system admin得名字(一般默认sa)
password= //sa的密码
// ACLName: 不用填写
// Password: 不用填写
// Open String Password: 不用填写 apply -> target -> chosen (myserver) -> apply
Tx Data Source -> config new..... ->
Name: 名字,随便起
JNDI Name: 你的jndi名字
Pool Name: 上面配置的pool的名字,必须[保证和上面一样!!!同上,apply -> target -> chosen -> apply !!
ok.complete!!!
Name: samplePool//你的名字
URL: jdbc:weblogic:mssqlserver4:127.0.0.1:1433
Driver Classname: weblogic.jdbc.mssqlserver4.Driver
Properties ://格式是:(key=value)
db=你所要连接的数据库名字
user=sa //system admin得名字(一般默认sa)
password= //sa的密码
// ACLName: 不用填写
// Password: 不用填写
// Open String Password: 不用填写 apply -> target -> chosen (myserver) -> apply
Tx Data Source -> config new..... ->
Name: 名字,随便起
JNDI Name: 你的jndi名字
Pool Name: 上面配置的pool的名字,必须[保证和上面一样!!!同上,apply -> target -> chosen -> apply !!
ok.complete!!!
解决方案 »
- STRUTS2 上传文件类型 限制问题!!!!!!!!!!
- pager-taglib 报错? 纳闷........
- Java做通信软件的前瞻
- java.lang.IllegalStateException异常问题
- 国庆还请大家帮忙 不好意思~~~不过真的比较头疼~~~拜托了~~
- struts中的tiles问题, 急啊!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- xsd,xml,
- 那位达人帮忙一下一个比较简单的hibernate问题
- 做JSP用XML技术使用什么解析比较好,Xerces下载地址是什么,现在最高版本是什么?
- 各位老大介绍一本J2EE的入门书籍,并且在学习J2EE之前应该具备哪些知识?
- 学.net好还是学JAVA好?
- 初学者对分布式事务处理的必要条件的理解,请大家指定一二,谢谢!
用下面代码可以吗?
import java.sql.*;
import javax.naming.*;
import javax.sql.*;
import java.util.Properties;
import javax.rmi.PortableRemoteObject;
public class testD { public static void main(String[] args) {
DataSource ds=null;
Context ctx=null;
Connection myConn=null;
try{
ctx=getInitialContext();
System.out.println(ctx.toString()); ds=(javax.sql.DataSource)ctx.lookup("dataSource"); }
catch(Exception e){
System.out.println ( "Init error"+ e);
}
}
private static Context getInitialContext() throws Exception{
String url="t3://127.0.0.1:7001";
String user="system";
String password="security";
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); }
return new InitialContext(properties); }
catch (Exception e){
throw e;
}
}
}