Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Accessing PostgreSQL from Mac-only network



Oguz Imre wrote:
Gentle people,

I have an in-house Ethernet network of a Cube and iMac. PostgreSQL is up and running on the Cube. How do I access the database from iMac?
Both running OS X 10.2.6 with the latest security update installed.

I have the following in creating a connection dialog:


.
JTextField("jdbc:postgresql://localhost:5432/myname?charSet=LATIN1");
.
driverField = new JTextField("org.postgresql.Driver");
.

From the iMac, I make sure I connect to the Cube. The connection dialog displays this "URL" and allows one to make changes. I know I have to change the "localhost" to the IP adress of the Cube. How can I specify the "path" to thedriver on the Cube?

You simpy load the driver with
Class.forName("org.postgresql.Driver");

Do I have to have the driver installed on the iMac? What do I have to enter in the .tcshrc on the iMac? Cube has:

Yes, the driver (I think a jar file) must be in the classpath of the client application.

You can start the application with
java -cp .:postgresJDBCDriver.jar MyApp
or set CLASSPATH to include postgresJDBCDriver.jar (this is only an example)

I usually start a connection by
DriverManager.getConnection("jdbc:postgresql://localhost:5432/guidebook","myName","myPassword");

before that be sure that postgres is listening from the TCP port in your Cube, my default installation don't do that.


edoardo
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.

References: 
 >Accessing PostgreSQL from Mac-only network (From: Oguz Imre <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.