Monday, June 15, 2009

Oracle to_date and mysql STR_TO_DATE

Hi All,
If we exported tables from Oracle in insert query format then query statements contains to_date(DATE, PATTERN) for date values.
If we want to execute these query statements in MySql then this statement will not work.
There is fixed date format in MySql and that is 'yyyy-mm-dd'.
To store data from given format to MySql format STR_TO_DATE(DATE, PATTERN) can be used.
Oracle to_date is equivalent to STR_TO_DATE in mysql

STR_TO_DATE(str,format)
Ex:
In Oracle table date in dd-MMM-yy format
to_date('10-JAN-06','DD-MON-RR')
Equivalent in MySql is
STR_TO_DATE('10-JAN-06','%d-%M-%y')
will store date in yyyy-mm-dd format that is 2006-01-10

Monday, June 8, 2009

msvcr71.dll not found, reinstalling application may solve this problem

Problem Description:
I got 'msvcr71.dll not found, reinstalling application may solve this problem' error while installing webMethods on windows 2003 R2 server.
After completing installation of webMethods on this server I configured it for SAP Adapter and wmDB.
But when I started webMethods, while starting SAP Adapter service, this error popup message is thrown twice.
This popup was suggesting for reinstallation of webMethods due to improper installation.
wmSAP package was partially loaded.
I tried twice to reinstall webMethods but each time it was not deleting all files from c:\webmethods7\ directory.


SOLUTION:
May be due to some registry entries this problem was occurring again and again.
What I did, I uninstalled webMethods. Then from c: drive I deleted webmethods7 directory and its contains.
After this I simply restarted server physically.
Again installed webMethods and checked for msvcr71.dll in system 32 folder.
It was there!
My webMethods server is now working properly.

Monday, June 1, 2009

WebMethods configuration for mysql

Following configuration at webmethods end for mysql:

  • Before configuring mysql in webmethods download java-mysql connector from MySql Connectors Link
  • Downloaded file will be mysql-connector-java-5.1.7-bin.jar (depending on MySql version support).
  • Place this file in directory path as shown below
  • 'webmethods_dir_path\IntegrationServer\lib\jars\mysql-connector-java-5.1.7-bin.jar'
  • Go to administrator page of webMethods and click on about link.
  • You must see in above jar file in 'Server Classpath' list.
Configuring JDBC adapter:
To use JDBC adapter in webMethods for MySql do following configuration.
  • Transaction Type : LOCAL_TRANSACTION
  • DataSource Class : com.mysql.jdbc.jdbc2.optional.MysqlDataSource
  • server name : here you specify server ip
  • user : user name of MySql database
  • password : password for above user
  • Retype password : Retype above password again.
  • database name : Name of the database in MySql.
  • portNumber : Port on which MySql database is accessible remotely.
Save above configuration.
Now you are able to use MySql JDBC connection.

Configuration for WmDB:
  • Alias : Give any name to MySql alias of your choice.
  • DB URL : jdbc:mysql://SERVER_IP:3306/test
Most of the times port is 3306 which is default for MySql, kindly check for port address. Change SERVER_IP to server ip address.
  • DB Username : user name of MySql database
  • DB Password : password for above user
  • DB Driver : com.mysql.jdbc.Driver
All other settings keep as appered as default seetings.
Launch MySql:

from command prompt:
  • Goto Start->All Programs->MySql->MySql server 5.1->MySql Command Line Client.
  • It will open MySql prompt(mysql> ).
  • Enter password and proceed.
MySql basic commands are as follows:

  • To list databases:
show databases;
  • To select database:
use database_name;
Ex: use test;

  • To list tables in database:
show tables;

  • To see table schema:
describe table_name;
Ex: describe emptable;

  • To create table:
Ex:
create table if not exists `EMP_MASTER`
(
`EMP_ID` varchar(10) NOT NULL, `NAME` varchar(20), `ADDRESS` varchar(50), `SALARY` NUMERIC(10,2),
constraint SYS_C2516 unique (EMP_ID),
primary key (EMP_ID)
);

  • To insert records in table:
Ex:
insert into `EMP_MASTER` (`EMP_ID`, `NAME`, `SALARY`) values ('1000053003',`JOHN CENA`, 35000.00);

  • To delete all records from table:
truncate table `table_name`;
Ex: truncate table `EMP_MASTER`;
  • To delete table:
drop table table_name;
Ex: drop table `EMP_MASTER`;

Monday, May 25, 2009

Installing MySql on Windows

Getting Ready

The MySQL server is the most popular database server, although you can use other database servers with the NetBeans IDE for PHP.

The recommended version of the product is MySQL Server 5.0. Downloads are available here. Click here for general instructions in installing and configuring the MySQL database server.

The instructions provided in the current document apply to the Windows operating system. The document recommends a sequence of steps to set up the MySQL database server for working in the PHP development environment.

While installing disable your firewall. To avoid security errors, install thorough Administrator login.

Starting the Installation

After the download is completed:
  1. On the Downloads panel, select the downloaded MySQL installation file and click Open. The MySQL Server Setup Wizard starts. On the Welcome panel, click Next.
  2. On the Setup Type panel, choose the Custom option and click Next.
  3. On the Custom Setup panel, click Next.
  4. On the Ready to Install the Program panel, click Install.
  5. On the MySQL Enterprise panel, click Next.

Configuring MySQL Server

  1. On the Wizard Completed panel, switch on the Configure MySQL Server now checkbox and click Finish. The MySQL server Instance Configuration Wizard starts.
  2. On the Welcome panel, click Next.

Specifying Configuration Type

  1. On the Configuration Type panel, choose the Detailed Configuration option. Click Next.
    Note: Choosing this option is necessary to get to the panel for setting the network options where you will turn off the firewall for the port used by the MySQL server.
  2. Choose the Developer Machine option and click Next.
  3. Choose the Multifunctional Database option and click Next.
  4. On the InnoDB Tablespace Settings panel, choose the drive and \MySQL Datafiles\click Next.
  5. Specify the approximate number of concurrent connections to the server - choose the Decision Support (DSS)/OLAP option. Click Next.

Setting the Networking Options

  1. Switch on the Enable TCP/IP Networking checkbox.
  2. In the Port Number: edit-box, specify the connection port. The default setting is 3306 - leave it unchanged if there is not special reason to change it.
  3. Switch on the Add firewall exception for this port.
  4. Switch on the Enable Strict Mode checkbox. Click Next.

Setting the Character Set and the Operating System Options

  1. Specify the default character set and click Next.
  2. On the Set the Windows options panel, switch on the Install as Windows Service checkbox. To have the MySQL Server launched automatically, switch on the Launch the MySQL Server automatically checkbox. Click Next.

Specifying the Security Options

  1. Choose the Modify Security Settings option. !phpuser
  2. In the New root password, enter the root user's password.
  3. In the Confirm edit-box, retype the root user's password.
  4. Click Next.

    Note: The root user is a user who has full access to the MySQL database server - creating, updating, and removing users, and so on. Remember the root password - you will need it later when creating a sample database.

Completing the Configuration

  1. Click Execute to start the configuration.
  2. When the configuration is completed successfully, the information message appears. Click Finish.
Note: To check that the installation has completed successfully, run the Task Manager. If the MySQLd-nt.exe is on the Processes list - the database server is running.

For more information follow this link