TAILIEUCHUNG - The definitive guide to grails second edition - phần 2

Tuy nhiên, vì nó là một yêu cầu khá phổ biến, chúng tôi sẽ nghiên cứu kỹ vào nguồn dữ liệu bởi vì bạn chắc chắn sẽ cần phải cấu hình chúng, cộng thêm, họ sẽ giúp bạn phát triển kiến thức của bạn của môi trường. | CHAPTER 2 GETTING STARTED WITH GRAILS 35 However since it is a pretty common requirement we will delve into data sources because you ll certainly need to configure them plus they ll help you develop your knowledge of environments. The File When you create a Grails application Grails automatically provides a grails-app conf file that contains configuration for each environment see Figure 2-11 . You might find this convenient because it means most of the work is done for you but you might prefer to use another database such as MySQL rather than the provided HSQLDB database. Figure 2-11. The file Defining a data source is one area where the strength of the Java platform becomes apparent. Java s database connectivity technology JDBC is extremely mature with drivers available for pretty much every database on the market. In fact if a database provider does not deliver high-quality stable JDBC drivers its product is unlikely to be taken seriously in the marketplace. A data-source definition is translated into a instance that supplies JDBC Connection objects. If you ve used JDBC before the process will be familiar with the first step ensuring that the driver classes normally packaged within a JAR archive are available on the classpath. 36 CHAPTER 2 GETTING STARTED WITH GRAILS The DataSource .groovy file contains some common configuration setup at the top of the data-source definition an example of which is presented in Listing 2-20. Listing 2-20. Common Data-Source Configuration dataSource pooled true driverClassName username sa password The snippet indicates that by default you want a pooled data source using the HSQLDB driver with a username of sa and a blank password. You could apply defaults to several other settings. Here s a list of the settings that the file provides driverClassName This is the class name of the JDBC driver. username This is the .

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.