Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Databases / May 2006

Tip: Looking for answers? Try searching our database.

MySQL ConnectorJ & remote machine

Thread view: 
Ike - 09 May 2006 12:52 GMT
Does anyone here use MySQL ConnectorJ to connect to a DB on a remote IP ? If
so, could you please share your code with me to do so. I can get it to
connect to a local machine, but not a remote one. Thanks, Ike
Dhananjay - 09 May 2006 15:28 GMT
Can u please explain what do you men by remote?
Its on your local network or out of your network?

Regards
Dhananjay
Ike - 10 May 2006 11:46 GMT
out of my network. I have an IP address, a dbname, a username and a
password. I know I cannto connect with these parameters from this remote
machine because I am doing it with php -- but I want to be able to get
MySQLConnectorJ to be able to do it as well. Thank you. -Ike
David Lee Lambert - 10 May 2006 19:44 GMT
> out of my network. I have an IP address, a dbname, a username and a
> password. I know I cannto connect with these parameters from this remote
> machine because I am doing it with php -- but I want to be able to get
> MySQLConnectorJ to be able to do it as well. Thank you. -Ike

Something like this should work:

java.sql.Connection con =
  DriverManager.getConnection("jdbc:mysql://"
                + ip + "/" + dbname,
                username,
                password );

If you still have trouble,  wrap the whole thing in a try {}
block and report the exact error-message to this group or
a MySQL forum.

Signature

PGP key posted on website ... http://www.lmert.com/people/davidl/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.