SmartClient 更改數據庫及導入數據
The SmartClient object-relational connector supports rapid end-to-end application prototyping and SDK evaluation. To configure this connector for use against a database other than the embedded HSQLDB instance:
To install a JDBC driver, copy the downloaded .jar file, or unzip the downloaded .zip file, into your?isomorphicSDK\WEB-INF\classes?directory.
By default, the example applications provided in the SmartClient SDK look for their data in a database named?isomorphic. You must create this database and import the sample data in order to use the example applications. Follow your database vendor's instructions for creating new databases and tablespaces.
Alternatively, you may edit the parameters in?isomorphicSDK\WEB-INF\classes\server.properties?to use an existing database. If you choose to do this, you must edit and save?server.properties?and restart your servlet container?before?attempting to import the sample data.
The instructions in this section explain how to manually edit your configuration settings. Alternatively, you may use the graphical?SmartClient Admin Console?to edit these settings. If you are viewing this page from your application server,?click here to open the Admin Console. Otherwise, open the console from:?http://<your server>:<your port>/isomorphicSDK/tools/adminConsole.jsp.
To manually edit your configuration, open?isomorphicSDK\WEB-INF\classes\server.properties?in a text editor. This file contains configuration blocks for HSQLDB, MySQL, Oracle, PostgreSQL, and DB2. The?sql.defaultDatabase?variable controls which block is actually used by the system. To use a database other than the embedded HSQLDB, comment out the line that reads?sql.defaultDatabase:?HSQLDBand uncomment the line that reads?sql.defaultDatabase:?<your database type>.
After you have selected the database type, ensure that other configuration parameters in this file are set appropriately for your system. For a custom installation, you may need to change the values of the following variables:
sql.<DBtype>.driver.serverNameName or IP address of the system on which the database is runningsql.<DBtype>.driver.portNumberTCP port on which the database is listening for connectionssql.<DBtype>.driver.databaseNameName of the database as known by the database serversql.<DBtype>.driver.userDatabase username for SmartClient requests. Ensure that this user has the following privileges: create/alter/drop tables; create/drop sequences (Oracle); insert/update/replace/delete rows.sql.<DBtype>.driver.passwordPassword for the given database username.Refer to the comments in?server.properties?for more information.
Note:?You must restart your servlet engine whenever changes have been made to?server.properties.
To import the sample data:
Open the?SmartClient Admin Console.
Click?Import DataSources?in the options tree at top left.
Click/shift-click or right-click to select all datasources in the list at top right.
Click on the?Import?button.
Importing all sample data may take more than 10 seconds. A dialog will appear when the import operation has completed.
If you get an out of memory error when importing a very large data set (e.g. the productRevenue sample data), you will need to increase the maximum heap size of your JVM (e.g.?java.exe -Xmx128M).