LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   jdbc connection in java (https://www.linuxquestions.org/questions/programming-9/jdbc-connection-in-java-199719/)

balanagireddy 06-30-2004 11:15 PM

jdbc connection in java
 
Hi,

Connection conn = DriverManager.getConnection("jdbc:odbc:<DSN NAME>")

I gave the DSN Name I Have in the control panel but how to give the DSN of
the data source located in some other PC.

What shuld above statement then??

tangleb1 07-01-2004 04:07 AM

Using the host name of your other machine (String hostName) and the database name (String databaseName), your URL will take the form (using postgres on port 5432 as an example):

"jdbc:postgresql://"+hostName+":5432/"+databaseName


Your other machine's database must be configured to accept external users, and you may need to supply username and password using:

DriverManager.getConnection(String url,
String user,
String password)

tangleb1

Galik 07-01-2004 06:42 AM

I think you have to make the (local) datasource in the ODBC configurator point to the (remote) maching running the database. I'm a bit rusty on this though...


All times are GMT -5. The time now is 08:01 PM.