TAILIEUCHUNG - Core Servlets and JavaServer Pages phần 9

Một ví dụ JDBC kết nối hoặc Oracle hoặc cơ sở dữ liệu Sybase và in ra các giá trị của cột * xác định trước trong bảng "trái cây", nhập khẩu .Public class FruitTest Đọc tên, cơ sở dữ liệu tên máy, tên người dùng, mật khẩu, và nhận dạng nhà cung cấp từ dòng lệnh. Nó sử dụng định danh nhà cung cấp để | Prentice Hall and Sun Microsystems. Personal use only do not redistribute. Chapter 18 JDBC and Database Connection Pooling Listing FruitTest result connecting to Sybase on NT Prompt java 605741 hall xxxx Sybase Database Adaptive Server Anywhere Version Comparing Apples and Oranges quarter apples applesales oranges orangesales topseller 1 32248 18459 Maria 2 35009 18722 Bob 3 39393 18999 Joe 4 42001 19333 Maria Listing package coreservlets import . A JDBC example that connects to either an Oracle or a Sybase database and prints out the values of predetermined columns in the fruits table. public class FruitTest Reads the hostname database name username password and vendor identifier from the command line. It uses the vendor identifier to determine which driver to load and how to format the URL. The driver URL username host and password are then passed to the showFruitTable method. public static void main String args if 5 printUsage return String vendorName args 4 int vendor vendorName if vendor printUsage return Home page for this book Home page for sequel . Servlet and JSP training courses by book s author . Prentice Hall and Sun Microsystems. Personal use only do not redistribute. Basic JDBC Example Listing continued String driver vendor String host args 0 String dbName args 1 String url host dbName vendor String username args 2 String password args 3 showFruitTable driver url username password Get the table and print all the values. public static void showFruitTable String driver String url String username String password try Load database driver if not already loaded. driver Establish network .

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.