If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Connecting to local?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 03-25-04, 18:26
mbrindley mbrindley is offline
Registered User
 
Join Date: Mar 2004
Posts: 16
Connecting to local?

Hi, i am newbie, so i am going to do my best to explain what i am trying to do.
At university i have a DB, we use DB2...and we are doing some exercises where we connect to out DB through java, JDBC?

well i cant access that server from home, so i installed MySQL and created the database on my PC (locally..right?)
well, now i would like to test my java with the DB i have on my hardisk...
How the heck?
this is the code for my DB2 at uni, which is in my java at the moment...i dont know if it can help at all...thanks!!!!!!

// load driver and connect to datbase
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
String url = "jdbc:db2:CMPS2B26";
String userid = "XXXXX";
String password = "XXXXX";
Connection con = DriverManager.getConnection(url, userid, password);
Statement stmt = con.createStatement();
Reply With Quote
  #2 (permalink)  
Old 03-26-04, 05:08
pt2004 pt2004 is offline
Registered User
 
Join Date: Mar 2004
Posts: 21
For the connection string

Try http://www.connectionstrings.com
It has a load of different connection strings for different dbs. Being in college i'm sure you'll find it useful with future projects anyway
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On