免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 4286 | 回复: 1
打印 上一主题 下一主题

[WebLogic] 请教在WebLogic中设置Sybase数据库的Connection Pool [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-01-16 13:42 |只看该作者 |倒序浏览
我在自己地程序中使用Sybase的JDBC驱动连接数据库成功,程序见下,但是使用同样的url和driver名字,在Weblogic中设置Connection Pool时,出现下面错误:


<2003-1-16 下午01时13分58秒>; <Error>; <JDBC>; <001060>; <Cannot startup connection
pool "sybasepool" weblogic.common.ResourceException: java.sql.SQLException: JZ0S
J: 没有在此数据库中发现元数据存取器信息。
        at com.sybase.jdbc.ErrorMessage.raiseError(ErrorMessage.java)
        at com.sybase.jdbc.MdaManager.loadMetaData(MdaManager.java)
        at com.sybase.jdbc.MdaManager.<init>;(MdaManager.java)
        at com.sybase.jdbc.MdaManager.<init>;(MdaManager.java)
        at com.sybase.jdbc.SybConnection.checkMDA(SybConnection.java)
        at com.sybase.jdbc.SybConnection.getMDA(SybConnection.java)
        at com.sybase.tds.Tds.getIntOption(Tds.java)
        at com.sybase.jdbc.SybConnection.getTransactionIsolation(SybConnection.j
ava)
        at weblogic.jdbc.common.internal.ConnectionEnvFactory.createResource(Con
nectionEnvFactory.java:141)
        at weblogic.jdbc.common.internal.ResourceAllocator.makeResources(Resourc
eAllocator.java:929)


运行正常的测试程序:

import java.sql.*;
import java.util.*;

public class TestSybase{
        public static void main(String args[]){
                Connection con = null;
                String sqlstr = new String();
                Properties info = new Properties();
                ResultSet rs;
               
                info.put("user", "iss";
                info.put("password", "sybase";
                try{
                        /* Load the class  */
                        Class.forName("com.sybase.jdbc.SybDriver".newInstance();
                        System.out.println("JDBC driver loaded.";
                        /* Establish the connection to the database */
                        con = DriverManager.getConnection("jdbc:sybase:Tds:10.4.5.250:8080",info);
                        System.out.println("Database connection established.";
                        /* Create a statement for later usage */
                        Statement stmt = con.createStatement();
                        /* Get the data from the table  */
                        String myStr = new String();
                        myStr.getBytes("ISO8859_1";

                        sqlstr = "select * from test";
                        rs = stmt.executeQuery(sqlstr);
                        while (rs.next()) {
                                System.out.println("tram   :" + rs.getString("tram");
                        }
                }
                catch (ClassNotFoundException cnfe){
                        System.out.println("ClassNotFoundException: Could not locate driver.";
                }
                catch (SQLException cnfe){
                        System.out.println("******************************** SQLException **********************************";
                        System.out.println("SQL State: " + cnfe.getSQLState());
                        System.out.println("Message  : " + cnfe.getMessage());
                        System.out.println("SQL Code : " + cnfe.getErrorCode());
                        System.out.println("********************************************************************************";
                        //System.out.println("SQLException: " + cnfe);
                }
                catch (Exception e){
                        System.out.println("An unknown error occurred while connecting to the database ");
                }
               
                finally {
                        try{
                                if (con != null )
                                        con.close();
                        }
                        catch(SQLException sqle){
                                System.out.println("Unable to close database connection.");
                        }
                }
        }       
}

论坛徽章:
0
2 [报告]
发表于 2003-01-16 13:44 |只看该作者

请教在WebLogic中设置Sybase数据库的Connection Pool

Weblogic中URL:jdbc:sybase:Tds:10.4.5.250:8080
DriverName:com.sybase.jdbc.SybDriver
Properities: user=sa
                   password=
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP