Browse DevX
Sign up for e-mail newsletters from DevX


Stop Speculating, Start Building: A Step-by-step Guide to Building Web Services with WebLogic Workshop 8.1 and MySQL : Page 2

Use this simple, step-by-step solution to download and configure both WebLogic platform 8.1 and MySQL, and develop a Web service that ties the two together.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

Step 1. Download and Install WebLogic Workshop 8.1 Beta Software
Download the public beta of 8.1 and double click the file to launch it. Accept the defaults during installation. At the end of the installation, the wizard will give you the option to launch the WebLogic quick start to configure a domain. Accept this option, and when the screen asks which type of domain you want, select a workshop domain.

Create the domain and exit the quick start. Now launch WebLogic Workshop (WLW) by selecting its icon on the start menu. When WLW starts, you should see a screen like the one Figure 1 shows.

WebLogic Workshop 8.1
Figure 1: WebLogic Workshop 8.1

Near the center of the taskbar at the bottom of the screen, you'll see a little red button labeled "Server Stopped." This indicates that the WebLogic application server is not yet running.

To start the server, click Tools–>WebLogic Server–>Start WebLogic Server. The progress dialog will appear, as will a couple of DOS consoles. WLW starts the app server by issuing the following DOS command:


After a few minutes, the application server will start. (Later, you will amend this .cmd file by adding classpaths to the JDBC drivers for MySQL.)

Once the server starts and runs successfully, close down Workshop, which shuts down the server. Should the server not start properly, uninstall WebLogic 8.1 and try again. Remember, this is a beta, so it may have some quirks.

On some machines, starting up the server may take some time. BEA has improved this drastically in versions of the beta that post-date the public beta that you downloaded.

Step 2. Download, Install, and Configure MySQL
You will download and install three products from MySQL.com for this Web service:

  • MySQL 4.X production server
  • MySQL Control Center (MySQLCC)
  • JDBC drivers for MySQL (Connector/J)
  • The following instructions apply to the Microsoft Windows versions of the software. The Linux installation and startup should be similar, but check the product documentation for further details.

    MySQL 4.X Production Server
    Download MySQL 4.0 production release, and extract the zip file to a new directory. Launch the file setup.exe to install it. Once the application is installed, reboot. If the server isn't running (check your task list for mysqld-nt.exe), you can run it from c:\mysql\bin.

    MySQL Control Center (MySQLCC)
    Download MySQL Control Center (MySQLCC), extract the files, and run setup.exe. MySQL Control Center will install and place an icon on your desktop. Double click this icon to view the control center. On the left side of the screen you should see a list of MySQL servers. If the list is empty, right click the list and select "New." A dialog will appear. Set the "Name" to "ContentManager" and the "Host" to "Localhost." Click "Add" and you will be returned to the previous screen.

    You should now see "ContentManager" on the list with a red button indicating that it has stopped. Right click "ContentManager" and select "Connect." The database will start and you will be connected to it. (In the next section, you will set up a table for the content manager.)

    JDBC Drivers for MySQL (Connector/J)
    Download Connect/J JDBC drivers for MySQL. The downloaded zip file will contain the JDBC drivers. Create a directory at c:\mysqljar and unzip the files there.

    Step 3. Create the Database
    This solution builds a very simple database structure using the MySQLCC. You can easily expand upon the instructions for your own applications. If you have MySQLCC open and you are connected to the ContentManager database, open the ContentManager node to view the 'Databases', 'Server Administration', and 'User Administration' nodes.

    1. Open the 'Databases' nodes to view the database available on this server. It will probably be populated with 'mysql' and 'test' databases.
    2. Right click the 'Databases' node, and select 'Create New Database.'
    3. Name the database 'Content' and click OK.
    4. Right click the new 'Content' database and select 'Connect.'
    5. Open the node, and select 'Tables.'
    6. Right click 'Tables' and select 'New Table.'
    7. Add the following fields in the Table manager:
      FieldName DataType Size
      contentID Int  
      contentDate DateTime  
      contentHeadline VarChar 100
      contentText longText  
    8. Select the contentID field, and click the 'key' icon to make contentID the key field for the table. Also, make sure that AUTO_INCREMENT is checked, and make sure that contentID is added as an Index on the 'Indexes' tab.
    9. Click the floppy disk icon to save, and call the table 'WebContents.'

    You can now enter data on your table. Double click the table to access the table editor. To edit contentText you need to double click the field to open the text editor, where you can edit and update the text by clicking Apply at the bottom right of the screen.

    Finally, you must give the root user a password. Double click the User administration node, and select root@localhost. Set the password to 'root' in the password box and click Apply. This step does not ensure a secure system. For a production system, you should set strong passwords for your database on a properly secured server.

    In some cases, your WebLogic installation may come with a MySQL driver already. Check your documentation about using it. For the purposes of this solution, however, you will step through the procedure for adding a driver for the times when the driver does not come as part of the installation.

    Comment and Contribute






    (Maximum characters: 1200). You have 1200 characters left.



    Thanks for your registration, follow us on our social networks to keep up-to-date