+ Start a Discussion

Apex external database connection/ querying

I am looking to access a database of my own outside of SF (I want to use an apex class so that I can display some information on a VF page). Can someone give me pointers as to where I should be looking for such information?
salesforce.com will not be able to connect directly to your database.
But you have a few options. Here are two.

1. integrate the data into salesforce.com and store the data using the Force.com Web Services API. then build your Visualforce page on that data as needed. or you could use the Data Loader to update the data. More info: http://wiki.apexdevnet.com/index.php/Data_Loader

2. web-service enable your backend data and have apex make "callouts" (web service calls) to retrieve the data. there are some constraints about request and response size so please read the Apex Documentation links below for more information.

If your web service provides a WSDL, you can try to import it to Apex and Apex will auto-generate the apex classes. More info here: http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_web_services_wsdl2apex.htm

Or you can construct the web service message using the HTTP (RESTful) apex classes. More info here: http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_classes_restful.htm

I have been thinking of the second option you have mentioned as MY last option. The first one is not feasible for the kind of updates we are having. Also, please do suggest any other options. I am fine with programming. Any other administrative changes would be more than a big hassle. thanks a lot though for reaffirming my thoughts.
Can you elaborate on (a) data volumes (b) real-time (c) batch loads (d) how is the data used? (e) do you want to store it and report on it in SFDC? or do you only want to build a UI on top of your external data?
I am trying to get and update data to a table that is also being used by the original app it was designed for (the app is a java tool; still in use)... we need real-time update on the table and the data displayed must also be near realtime. also data migration/ replication are not real options. (1. time consuming 2. debugging any errors in that process would be a pain).
Ok, if data integration is not an option, in order to access that external data within apex and visualforce, you will have to web-service enable the ability to retrieve the data.

Informatica has some low-cost on-demand (SaaS) Data Loader and Data Integration tools for salesforce.com you could look into also as a low-risk integration process.
thanks for the prompt replies. It has to be an in-house solution. Also, this is the first stage of many-more-to-come (hopefully). let me think it through with the other developers. the present design might allow for some other work-around.:smileywink:

Message Edited by rawiswar on 12-23-2008 02:17 PM

Hi, I have a problem..


I need to make an integration of my application to Salesforce ..i need to update my application data , taking from salesforce...

i have oracle 10g..


So any suggestion or Apex method that i can use ..previously we did 1 standalone application  for this now i need to use Force.com and do it..


1) Is it possible to take data from sales force and store in my Application using force.com..


2) Any sample or suggestion..


it will be nice if i can get some advise immediately..



Message Edited by venkatesh on 01-27-2009 11:14 PM

real time contact with an external DB can only be done via a webservice that does you JDBC (/eqivalent) transaction. try to remember that Force.com is a standalone paltform (why would they take some much trouble designing everything when they can allow you to access outside stuff - Don't worry, I am starting to realize that just now myself).

as for data transfer, you can move data in batches using Data Loader tool from SFDC.