+ Reply to Thread
Results 1 to 4 of 4
This is a discussion on Salesforce PHP Oracle Database Replication Tool within the Salesforce PHP Tutorials forums, part of the Salesforce category; Here is my latest release that will help developers and organizations tremendously.
  1. #1
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    607
    Blog Entries
    16

    Lightbulb Salesforce PHP Oracle Database Replication Tool

    Here is my latest release that will help developers and organizations tremendously. This new script takes parameters from a web form and will create your Oracle tables/objects via the API. All you have to supply is the following:
    • You're Salesforce Username
    • You're Salesforce Password
    • Table Prefix (e.g. sforce_ ) not required
    • Oracle Database Name
    • Oracle User Name
    • Oracle Password
    David Clairborne recently released a tool that will create the schema that a user could copy and paste from a web browser for MySQL and I sent him the Oracle script that performs the same process. This new script will not only create that same file, but it will login to your Oracle database and create the tables for you. This new function ads the ability to create your tables on the fly, without having to try and do it by each individual salesforce object.

    This script was developed against a new developers account and it works without any hiccups. It has also been tested against a real live org, a sandbox, and a modified developers account. I do not see why it would not work against anyone's or any company's live instance.

    If you plan on using this script to test it out, there are a few lines of code that need to be checked so they match your paths of the following scripts from the PHP toolkit:

    Check line numbers 19 and 20 and make sure you correct the paths to the following:

    PHP Code:
    require_once ('./includes/soapclient/SforcePartnerClient.php');
    require_once (
    './includes/soapclient/SforceHeaderOptions.php'); 
    Check line number 37 and make sure you correct the path to the following:

    PHP Code:
    $wsdl './includes/soapclient/partner.wsdl.xml'
    If you forget to modify these lines, the script will fail. This takes into account that the table names and field names in Oracle cannot exceed 30 characters, so you will need to check your table names once the script is complete. An example of this is the Oracle reserved word, Number. There are field names which are in salesforce that have this same exact name. Here is what I did to check this and change the name to Number__c:


    PHP Code:
    $field->name substr($field->name030);
    if (
    $field->name == "Number")
    {
           
    $field->name "Number__c";
    }
    else
    {
          
    $field->name $field->name;

    If you wish to obtain the SQL file that is also created to this, it will be located in the same folder as this script runs in and is called:

    Code:
    salesforce_oracle.sql
    If you wish to only have the SQL file generated then uncomment the exit() statement on line number 99.

    This script uses ADOdb to connect to Oracle; you MUST be using this database class in order for this script to work, if you do not, THE SCRIPT WILL FAIL.

    You can download the ADOdb package from the main menu on my home page. This package was developed to work with:

    Apache
    Oracle 10g
    PHP 5.*

    If you have any questions please feel free to use the contact form on this site and I will do my best to get back to you ASAP!

    I am working on improving this system with enhancements that will even perform the database replication with a nice UI that users will be able to actually pick the tables and fields that they wish to backup. I am also going to release this same script for MySQL in the next couple of days


    Thanks,
    Mike
    Attached Files Attached Files

  2. #2
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    607
    Blog Entries
    16
    Updated the Oracle database replication tool, Minor changes and Oracle Connection check at start of script

    ~Mike
    Attached Files Attached Files

  3. #3
    Unregistered Guest

    Pull Data From SF.com, but what about Push into?

    I am looking to do some automated importation of data and was curious if you have found a way to do this with PHP?

  4. #4
    mike's Avatar
    mike is offline Administrator
    Join Date
    May 2007
    Location
    Wylie, Texas
    Posts
    607
    Blog Entries
    16
    Quote Originally Posted by Unregistered View Post
    I am looking to do some automated importation of data and was curious if you have found a way to do this with PHP?
    When you say some sort of automated process, do you mean like replicate your data from salesforce to a local database (like oracle)?

    If that is what you mean, yes I have created scripts which can run on cron (automated) and download an entire object and its data into a local database. I have done this for both Oracle and MySQL

    Can you be more specific on what you are trying to accomplish. Also a name would be nice to know

+ Reply to Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO 3.5.2