Novell Home

How to connect to MySQL using the NPS query gadget

Novell Cool Solutions: Trench
By Robert Strasser

Digg This - Slashdot This

Posted: 16 Jul 2003
 

I was configuring the NPS query gadget for a client and thought I would pass on the how-to tip:

Step 1.
Download and install MySQL for NetWare from: http://www.mysql.com/downloads/mysql-4.0.html

Refer to the readme for instructions.

Keep scrolling down the page to find the Novell NetWare Downloads.

I installed this to sys:\MySQL

Step 2.
Download and install the MySQL GUI to administer MySQL. This can be located at: http://www.mysql.com/downloads/mysqlcc.html

Refer to the readme for instructions.

Step 3.
Start the MySQL server: I created a startsql.ncf file with the following:

search add sys:mysql\bin
mysqld_safe --skip-external-locking

Step 4.
Create a database!

  1. At the server console run the mysql_install_db.nlm to create your database.
  2. Type mysqladmin -u root password YourPasswordHere and press Enter.

This will set the root password.

Step 5.
Launch MySQL Control Center and connect to your database.

  1. Enter the Connection Name: I call mine MySQL
  2. Host Name: Enter either the IP address or host name of the server that you are running MySQL.
  3. User Name: Use root as the user name.
  4. Password: This is the password that you selected in step 4.

Press the TEST button to verify that you're connected.

You should now see your database that was created when you click on mysql - databases.

Step 6.
Create a table in the database:
  1. Click open the database. You should now see the tables object under the database.
  2. Right click on tables and select NEW Table.
  3. Fill it out so it looks like this:

Save the table and refresh the table view to see your new table.

Step 7.
Double-click on the new table and add some rows of data to it.

It should now look like this:

Step 8.
Download the MySQL JDBC driver from: http://www.mysql.com/downloads/api-jdbc-stable.html

Refer to the readme for instructions.

  1. Copy everything from the com directory and below from the mysql-connector-java-3.0.8-stable\com directory to the webapps\nps\WEB-INF\classes directory.

    You should now have: webapps\nps\WEB-INF\classes\com\mysql\jdbc
  2. Restart Java on your server.

Step 9.
Time to configure the Query gadget.

  1. Login to your portal as administrator and create a Page called MySQL.
  2. Add the query gadget and configure it with the following:
    • JDBCClass = com.mysql.jdbc.Driver
    • JDBCConnect = jdbc:mysql://Your server address:3306/your database name
    • DBUsername = root
    • DBPassword = the password you selected in step 4.
  3. Press connect!
    You should now be connected to your database!
  4. Select the build query statement button. You should now see your products table in the list.
  5. Select it and click on change table.
  6. Click on add all in the available fields.
  7. Refresh query results. Check to see if your sample data is listed below.
  8. Press Finish.
  9. Assign your page to your portal test user and you're done!

If you have any questions you may contact Robert at rstrasser@cvcinet.com


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell