function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
VivoVivo 

Querying data from outside sources

Hi,

 

i am attempting to have a page in which the user can query some datasets from other databases using user/pass. The old code that was working on another site uses stuff like 

conn1 = DriverManager.getConnection(dbUrl, userName, pwd);

stmt = conn1.createStatement();
rs = stmt.executeQuery("");

 

And so on. Is there a way to use this same stuff on a visualforce page? If so, how do I import the java.sql and so on onto the apex class?

 

Or does salesforce have it's own way of connecting to stuff like this?

 

I am pretty new to this side of development, so any help is good.

 

Thanks!

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

You can't use the Java SQL classes in Visualforce.  You can consume web services or make HTTP callouts, so your external system would need to support one of these interfaces.  Or you could always set up some integration to replicate the data from the external system in to Salesforce.

All Answers

bob_buzzardbob_buzzard

You can't use the Java SQL classes in Visualforce.  You can consume web services or make HTTP callouts, so your external system would need to support one of these interfaces.  Or you could always set up some integration to replicate the data from the external system in to Salesforce.

This was selected as the best answer
VivoVivo
Thank you for your reply Bob. I guess I'll attempt to use a web service to make this happen.