The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> Java Help
|
JDBC and MySQL
Discuss JDBC and MySQL in the Java Help forum on Dev Shed. JDBC and MySQL Java Help forum discussing all Java platforms - J2ME, J2SE and J2EE - as well as relevant standards, APIs and frameworks such as Swing, Servlets, JSPs, Applets, Struts, Spring, Hibernate, ANT, EJB, and other Java-related topics.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

August 15th, 2000, 02:54 PM
|
|
Junior Member
|
|
Join Date: Aug 2000
Location: City, State, US
Posts: 6
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
I have hosted my website with a company that uses MySQL
I tried to connect to my database using the usual php script
....
<?php
mysql_connect (localhost, MyUserName, MyPassword);
mysql_select_db (MyDatabse);
mysql_query ("INSERT INTO addressbook (fname, lname)VALUES 'fname', 'lastname')
");
print ("Thanks for submitting your name.");
?>
Obviously I substituted the values MyUser name .... with my settings.
I emailed my webshsting company and I was told that they use JDBC Connection !!! And I should insert the following string:
"jdbc:mysql://MyDomain.com/MyDomain_com?user=MyUsername&password=MyPassword"
Can Any one tell me how could I connect to MySQL using this connection string?
Where should I insert it?
Can any one rewrite the php script above so that it connects using JDBC...
Any help would be appreciated very much.
Thank you all
|

August 24th, 2000, 08:23 AM
|
|
Junior Member
|
|
Join Date: Aug 2000
Location: nl
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
This will do the job :
$host="host.xxx.yyy.nl";
$user="user";
$passwd="xxxxx";
mysql_connect ($host,$user,$passwd);
mysql_select_db (database);
|

September 5th, 2000, 08:19 AM
|
|
Junior Member
|
|
Join Date: Sep 2000
Location: Simf, NA, Ukraine
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
ruler i think that's not what he needs
Class.forName("org.gjt.mm.mysql.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://MyDomain.com/MyDomain_com?user=MyUsername&password=MyPassword"
);
but u better use
Connection con = DriverManager.getConnection("jdbc:mysql://MyDomain.com/MyDomain_com","MyUsername","MyPassword");
the first one would be ok with mysql, but not with all of RDBMS, for example the first one doesn't work with PostreSql
thant's all u have the connection
<Slash>
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|