PreviousUser's Guide (v10) Next

Setting up Database Access with PCC

Chapter contents

You must know the name of the server where the database is located. If the database already has a DBNAME, PCC uses it. If you wish to create a new database but use existing data files, you must know the location of the data files on the server.

To create up an Engine DSN on a remote machine, you must possess administrator rights on the remote machine that houses the database you wish to access. You must have OS system rights to create a System DSN on the local machine.

Setting Up Database Access on Windows

To set up database access on Windows

  1. Follow the steps listed in To register a remote server engine .
  2. Existing databases with a DBNAME on the registered server can then be accessed from PCC.

  3. Optionally, follow the steps listed in To create a new database .
  4. The new database can then be accessed from PCC.

To set up ODBC database access on Windows

  1. Follow the steps listed in To register a remote server engine .
  2. Existing databases with a DBNAME and a DSN on the registered server can then be accessed from PCC.

  3. Optionally, follow the steps listed in To create a new database and ensure that the Create DSN option is selected.

  4. By default, PCC creates a system DSN with the same name as the database name. The new database has a DSN associated with it and can be accessed through ODBC.

To set up an Engine DSN using ODBC Administrator

  1. In PCC, click Tools and select ODBC Administrator.
  2. Click the System DSN tab, then Add.
  3. In the list, click Pervasive ODBC Engine Interface.
  4. Click Finish.
  5. The Pervasive ODBC Engine DSN Setup dialog displays.

  6. Type a Data Source Name.
  7. For Database Name, click the name of the database in the list for which you want to create the Engine DSN.
  8. Click Options if you want to specify the open mode option.
  9. See ODBC DSN Creation Options in Advanced Operations Guide.

  10. Click OK.
  11. Click OK.

Setting Up Database Access on a Linux Server

To set up a named database and Engine DSN from a Linux server

Database names are created in Linux by using the dbmaint utility at the server. For a complete description of dbmaint, see dbmaint or read the dbmaint man page.


Note
This utility can only be run by user accounts belonging to group pvsw. See Getting Started With Pervasive PSQL for information on Pervasive PSQL Linux utilities and user accounts.
  1. To create an empty database, use the following at the command line:
  2. dbmaint a | d | l [-b] [-i] [-e] -nDbname
    [-ldictpath] [-ddatapath] 
     

    The list of commands for dbmaint include:

    a - add database name
    d - delete database name
    l - list all database names

    Options include:

    -b - create Bound database
    -i - create database with Relational Integrity enforced
    -e - do not create dictionary files for database
    -nDBName - specify database name
    -lDictpath - specify dictionary path
    -dDatapath - specify data path
    -a - show full data in the DBNames list

    For example, to create DBName TEST with relational integrity, type:

    dbmaint a -i -nTEST

    Note
    Unless datapath is specified, the new database is created in the default location, $PVSW_ROOT/data. Likewise, if dictpath is not specified, the dictionary is created in the default location.
    • To delete an existing database, use the following at the command line:
    • dbmaint d -nDbname 
       

      For example, to delete the newly created database TEST, type

      dbmaint d -nTEST
    • To list all existing databases:
    • dbmaint l [-a] 
      
  3. To set up an Engine DSN, modify the following files:
    • ${PVSW_ROOT}/etc/odbc.ini.
    • SQLMGR required settings:

      [SQLManager]
      MgrPort=1583 
      
    • ${PVSW_ROOT}/etc/odbc.ini

    • Note
      The value of ${PVSW_ROOT} is typically /usr/local/psql.

      Server data source - the one to which remote calls will be redirected:

      [DSN name]
      Driver=/usr/local/psql/lib/libodbcci.so
      Description=Test Pervasive database
      DBQ=DBName 
       

      In addition, each data source should be mentioned in the section [ODBC Data Sources] as in the following example:

      [ODBC Data Sources] dsnName1=Pervasive PSQL database dsnName2=Pervasive PSQL database

      For example, if you have in odbc.ini:

      [MyDSN] Driver=/usr/local/psql/lib/libodbccci.so Description=test DBQ=MyDB

      then your odbc.ini should have:

      [ODBC Data Sources] MyDSN=Pervasive PSQL database

      Note
      Because Linux is case sensitive, the [DSN name] must be input exactly as listed under [ODBC Data Sources].
    • The engine DSN can also be created using the dsnadd utility by typing the following at the command line:
    • % dsnadd -dsn=DSNname -db=DBName 
       

      An easy way to verify DBName and DSN configuration settings is to run the supplied isql program using the psql user account:

      % /usr/local/psql/bin/isql DEMODATA

  4. Proceed to setting up client DSNs as explained in Setting Up Client Access .

Setting Up Client Access

To enable client access to a remote Pervasive PSQL database

  1. Click Control Center from the Pervasive program on the Start menu.
  2. In the Pervasive PSQL Explorer pane, right-click Engines then click New 4 Server.
  3. The Pervasive PSQL Explorer pane is the column on the left side of the window that contains a list of machines to which you are connected.


    Note
    The machines listed in your Pervasive PSQL Explorer will remain between sessions. To remove a machine, right-click the machine name and click Delete.
    Figure 2-5 Registering a New Engine

  4. Enter the Server name where the Pervasive PSQL v10 database engine resides.
  5. Figure 2-6 Entering a Computer Name

    You need to be authenticated on the remote engine, and a dialog displays prompting you for a user name and password.

  6. Enter the user name and password in the appropriate fields and click OK.
  7. You are now connected to the remote Pervasive PSQL engine.

To set up a Client DSN using ODBC Administrator

  1. In PCC, click Tools and select ODBC Administrator.
  2. Click the System DSN tab, then Add.

  3. Note
    Pervasive PSQL does not support File DSNs. You must use User or System DSNs. System DSNs are generally preferred, because they are available to all users on a given computer.
  4. In the Drivers window, select Pervasive ODBC Client Interface.
  5. The following dialog box appears:

    Figure 2-7 Pervasive ODBC Client DSN Setup Screen



  6. In the Client section, enter a Data Source Name (DSN) to which you wish to set up a connection. This DSN will help you identify the data source. It will be visible only on the current machine.
  7. Type a description of the data source, if desired.
  8. If you want to enable OEM/ANSI conversion, click Options and make your selection in the dialog box that appears.
  9. Figure 2-8 Pervasive ODBC Client DSN Options



    Do not modify the Network settings or TCP/IP Port Number unless you have first reviewed the information in ODBC DSN Creation Options in Advanced Operations Guide.

  10. Click OK to return to the Pervasive ODBC Client DSN Setup dialog box.
  11. Figure 2-9 Pervasive ODBC Client DSN Setup Screen #2



  12. In the Server area, type in the host name of the computer where the data source resides. You can enter a machine name, TCP/IP address, or an IPX/SPX MAC address.
  13. To use an existing database on the server, click Get DSN List and select the desired DSN from the drop-down list. In the Server area, Data Source Name refers to an Engine DSN on the server computer.
  14. If no databases appear in the drop-down list, either you selected the wrong server, or you need to have your system administrator name the server databases and create Engine DSNs for each of them before you can access them.

  15. Click OK.
  16. You can now set up another Client DSN or click OK to exit the ODBC Administrator.

Setting Up a Client DSN on a Linux Workstation

While it is possible to access a database from a Linux server by a Linux client, there are no Pervasive PSQL utilities (except dsnadd) that can be used on the client. A Linux client configuration would be used for independent applications, such as web applications.

To add a client DSN on a Linux Workstation

To add a client data source, execute the following command:

dsnadd -dsn=myDSN -desc=datasource 
-host=psqlhost -sdsn=svDSN 
 

myDSN is a name you want to assign to the new Client DSN.

datasource is any string to describe the data source.

psqlhost is the name of the network host where your Pervasive PSQL database resides.

svDSN is the name of the Engine DSN on the Pervasive PSQL host.


Note
The datasource on the server must be named first.

For example, to create a Client DSN named TEST on host NewDev, where the Engine DSN name for the database is NewTest, type

dsnadd -dsn=TEST -host=NewDev -sdsn=NewTest 

For more information about the dsnadd utility, please see Getting Started With Pervasive PSQL.


Chapter contents
Book contents

Prev topic: Setting Up ODBC Database Access
Next topic: Accessing Data on a Remote Engine Using PCC