weblogic7+sqlserver2000??????????????????

gengyf931 2002-11-14 12:01:24
我下载微软的SQLSERVER2000的JDBC驱动。请详细讲讲他和weblogic7的配置步骤
(这里的帖子我没成功过。)
谢谢,请详细讲讲
...全文
24 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
cenjava 2002-11-23
  • 打赏
  • 举报
回复
我用的weblogic jdbc驱动程序,但是怎么也不能成功,不知道哪里出了问题,请问刘晓巍有何解决办法
DIVES 2002-11-17
  • 打赏
  • 举报
回复
用Java还要用微软的东西吗?不会吧!那您还不如用VB
yoshiyan 2002-11-16
  • 打赏
  • 举报
回复
我跟着配不行!

gengyf931 2002-11-14
  • 打赏
  • 举报
回复
?????????????????????????????
gengyf931 2002-11-14
  • 打赏
  • 举报
回复
地平线:
1、把3个.JAR文件先拷入..\weblogic700\server\lib吗?
2、我指定了,也不行。我指定的有问题?能不能把你的statWLS.cmd 贴上来?
谢谢!!!!!!!
dipingxian 2002-11-14
  • 打赏
  • 举报
回复
首先 ,确定你那三个jar文件已经在statWLS.cmd 中正确指定了

1 . 连接池配置 :
Name: MyJDBC Connection Pool
URL: jdbc:microsoft:sqlserver://192.168.0.88:1433(这里要和SQL
SERVER的默认端口一致)
Driver Classname: com.microsoft.jdbc.sqlserver.SQLServerDriver
Properties
(key=value): user=sa
password=!wmoneymw
2 . 数据源配置 :
Name: MyJDBC Data Source
JNDI Name: MysqlDataSource
Pool Name: MyJDBC Connection Pool
Row Prefetch Size: 48
Stream Chunk Size: 2564 bytes
gengyf931 2002-11-14
  • 打赏
  • 举报
回复
我要的是微软的JDBC驱动的配置方法,不是WEBLOGIC的!!!!!
wjmmml 2002-11-14
  • 打赏
  • 举报
回复
hehe 呵呵。
hotenM 2002-11-14
  • 打赏
  • 举报
回复
这个例子多少人成功,有让多少人得了分啊
hotenM 2002-11-14
  • 打赏
  • 举报
回复
实战JBuilder7+WebLogic7存取MS SQL Server2000(一)
刘晓巍: liuxiaowei2000@sina.com





第一次写文章,希望大家多多捧场,本文完全根据我的个人经验所写,如有错误,恳请大家指正!

JBuilder7+WebLogic7 的配置
假设Jbuilder7和WebLogic7安装完毕,操作系统为:windows2000 server(SP2),数据库为: SQLServer2000(SP2)。



JBuilder7的配置:

1. 修改环境变量TEMP和TMP 为不带空格的目录如:E:\winnt\temp

2. 启动Jbuilder7,选择:Tools->Configure Servers

3. 选中左侧的Weblogic Application Server 6.x+,选中右边的Enable Server

4. 将General->Home Directory设为WebLogic7的Home Directory如:E:/bea/weblogic700/server,正常的话Jbuilder7将自动为你添好其他的项。

5. 将Custom->JDK Installation Directory设为 JDK的安装目录,如:E:/bea/jdk131_02

6. 将Custom->BEA Home Directory设为WebLogic7的Home Director,如:E:/bea

7. 将Custom->Domain Directory设为你的域目录,如:E:/bea/user_projects/mydomain

8. 添好User name, Password ,Domain name, Server name后,单击OK退出。

9. 选择:Tools->Enterprise Setup,单击CORBA页上的New, 按下表填写相应信息:

Name for this configuration = WelLogic 7.0

Path for ORB Tools = E:/bea/weblogic700/server

Library for Projects = WebLogic 6.x+ Deploy

IDL compiler command = idlj.exe

Commnad option for output directory = E:\CORBAOutput(任意目录,不要有空格)

单击OK退出。

10.选择Project->Default Project properties

在Path页的Required libraries中将会看到WebLogic 6.x+ Client和WebLogic 6.x+ Deploy两项,如果没有,请检查以上步骤是否正确。

11.选择Server页,单击Single services for all service in project

在下拉列表中选择WebLogic Application Server 6.x+,但击OK退出,配置完毕。



WebLogic7的配置:

1. 启动WebLogic7

2. 打开IE6,在地址栏中输入:http://localhost:7001/console

3. 输入用户名和密码

4. 在左边的目录树中选中Services->JDBC->Connection Pools,单击右侧的Configure a new JDBC Connection Pool.,输入以下信息:

Configuration->General页:

Name = SQL Server Connection Pool

URL = jdbc:weblogic:mssqlserver4:northwind@localhost

Driver classname = weblogic.jdbc.mssqlserver4.Driver

Properties : user = sa

Password = “” <- sa的密码

单击Create建立连接池。

Targets->Server页:

将myserver(服务器名称)移至右侧的列表中,但击单击Apply

5. 在左边的目录树中选中Services->JDBC->Data Sources(或者TXData Sources),单击右侧的Configure a new JDBC Connection Pool.,输入以下信息:

Configuration->General页:

Name = SQLServer Tx Data Source

JNDI Name = SQLServer

Pool Name = SQL Server Connection Pool

选中Emulate Two-Phase Commit for non-XA Driver和Row Prefetch Enabled

单击Create建立数据源。

Targets->Server页:

将myserver(服务器名称)移至右侧的列表中,但击单击Apply,配置完毕。

实战1:连接SQLServer2000
1. 打开JBuilder7选择File->New project

在Name栏中输入SQLServerDemo,Directory栏中输入存放路径(不要有空格),其他不变,单击Finish。

2. 选择File->New,选择General->Application,单击OK。

第一步,第二步和第三步都不用更改,直接Finish即可。

3. 回到JBuilder7的集成开发环境中,单击右侧的Designer页设计窗体,在窗体中放入一个JscrollPane 和JtextArea 及三个按钮,双击第一个按钮输入以下代码:

try

{

Class.forName("weblogic.jdbc.mssqlserver4.Driver");

Connection con = DriverManager.getConnection("jdbc:weblogic:mssqlserver4:northwind@localhost","sa","");//此处根据你的SQLServer帐户而定。

Statement st = con.createStatement();

ResultSet res = st.executeQuery("select * from employees");

String line = "";

while (res.next())

line = line + res.getString("title")+"\n";

jTextArea1.setText(line);

con.close();

}

catch (Exception ex)

{

jTextArea1.setText("error : "+ex.getMessage());

}

双击第二个按钮输入以下代码

Hashtable ht = new Hashtable();

ht.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");

ht.put(Context.PROVIDER_URL,"t3://localhost:7001");



try

{

Context ctx = new InitialContext(ht);

DataSource ds = (DataSource)ctx.lookup("SQLServer");

Connection con = ds.getConnection("system","12345678");//此处是WebLogic7

的域用户和密码

Statement st = con.createStatement();

ResultSet res = st.executeQuery("select * from employees");

String line = "";

while (res.next())

line = line + res.getString("notes")+"\n";

jTextArea1.setText(line);

con.close();

}

catch (Exception ex)

{

jTextArea1.setText("error : "+ex.getMessage());

}

运行WebLogic7,运行程序单击第一个按钮使用JDBC直接连接SQLServer并获取数据,单击第二个按钮使用DataSource连接SQLServer并获取数据。

实战2:Session Bean
建立一个简单的Bean:

1. 关闭所有工程:File->Close Projects

2. 选择File->New project

在Name栏中输入HelloDemo,Directory栏中输入存放路径(不要有空格),其他不变,单击Finish。

3. 选择File->New->Enterprise->EJB 2.0 Designer单击OK。

在弹出的对话框中单击new建立一个Moudle,在Name中输入HelloMoudle单击OK关闭当前对话框,再次单击OK关闭对话框。

4. 在右侧的工作区中单击右键选择:Create EJB->Session Bean,将Bean Name改为HelloBean

5. 右键单击代表HelloBean的长方形,选择Add->Method

按如下填写:

Method Name = SayHello

Return Type = java.lang.String

Input parameter 不添

Interface = remote

6. 右键单击代表HelloBean的长方形,选择 View Bean Source

按如下填写SayHello():

public java.lang.String SayHello()

{

/**@todo Complete this method*/

return new String(“Hello World “);

}

7.按F9运行,在弹出的对话框中选择Run页,单击New,在configure name处填写Server Runtime Configuration,再选择Run->Server,单击OK关闭当前对话框,单击OK开始编译运行。运行起来之后在左上角的目录树中右键单击HelloModule选择:Deploy options for “HelloModule.jar”->Deploy来发布Bean。

建立客户端:

1. 选择File->New->Enterprise->EJB Test Client单击OK。

选中Genrate method for 特斯廷remote interface calls with default arguments单击OK。

2. 按如下填写main():

public static void main(String[] args)

{

HelloBeanTestClient1 client = new HelloBeanTestClient1();

// Use the client object to call one of the Home interface wrappers

// above, to create a Remote interface reference to the bean.

// If the return value is of the Remote interface type, you can use it

// to access the remote interface methods. You can also just use the

// client object to call the Remote interface wrappers.

client.create();

System.out.println(client.SayHello());

} 选择Run->Run “HelloBeanTestClient1.java” using defaults运行。
gengyf931 2002-11-14
  • 打赏
  • 举报
回复
帮帮忙

1,219

社区成员

发帖
与我相关
我的任务
社区描述
企业软件 中间件技术
社区管理员
  • 中间件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧