小编use*_*097的帖子

GlassFish JDBC连接池

我正在尝试为我的Web应用程序建立连接池,但不知道如何使用它设置sql server的基础知识

主要问题:什么是资源类型(写什么),classname,driverclass名称?

public static void main(String[] args) throws ClassNotFoundException, SQLException {
    String str="SELECT * from Book";
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
        try {
            Connection con = DriverManager.getConnection("jdbc:odbc:lol","Sar\\KILLER_GUY",null);
            Statement stmt=con.createStatement();
            ResultSet rs=stmt.executeQuery(str);
            System.out.println("SalesPerson Id: ");
            while(rs.next())
            {
                String id= rs.getString("Add");
            System.out.println(id);
            }
            con.close();
        }
    catch(SQLException e)
    {

    }
Run Code Online (Sandbox Code Playgroud)

java odbc connection-pooling pool jdbc-odbc

0
推荐指数
1
解决办法
5833
查看次数

标签 统计

connection-pooling ×1

java ×1

jdbc-odbc ×1

odbc ×1

pool ×1