Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Whats the easiest way to establish a DB connection

Thread Tools

Whats the easiest way to establish a DB connection

Posts: n/a
Hello everyone,

Im looking for the simplest way anyone can thank of to establish a
connection my my mssql server 2000 through my jdbc. Im looking for a
bit of code that i can take and build a program ontop of.
My project for school is to make an address book that will store Name,
City, phone#, blah blah blah.
Iv tried on my own but i cant get the connection to go through so i
thought id start with the connection and build ontop of that.
If i know the connection works then i dont think ill have any problem
with the tables and the rest of the code.

My connection code used to look like this.
But i kept running into to many errors that i didnt have answers for.
If anyone has any other suggestions about how to go about doing this i
would greatly appreciate it.

private void connect() throws Exception
JOptionPane.showMessageDialog(null,"CloudScape Inside Connect");

Class.forName(" verDriver");
Properties p = new Properties();
connection = DriverManager.getConnection
catch (Exception ex)
JOptionPane.showMessageDialog(null, ex.toString());

connection.setAutoCommit( false );
catch (Exception ex)
JOptionPane.showMessageDialog(null, ex.toString());
Reply With Quote

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Set SSID to establish a connection PheNiX Wireless Networking 1 03-22-2006 09:50 PM
Cannot establish connection with ADSL provider John Chajecki Cisco 9 12-07-2005 10:34 AM
whats the easiest way tooo... web Digital Photography 6 11-07-2005 04:59 PM
Whats easiest way to pass viewstate data into a popup dialog ASP .Net 1 10-18-2005 03:06 PM
Fail to establish secure connection to PIX 501 Ian Easson Cisco 1 07-08-2003 04:46 PM