954,545 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

JDBC connection

Im new to java programming.
I want to establish a connection to
my MS-sql database using java.
How do i do it?

HiTleR83
Newbie Poster
3 posts since May 2004
Reputation Points: 10
Solved Threads: 0
 

First declare your URL (in string format of cours
Remember your URL is
1 a String
2 "jdbc:odbc:"+dataSourceName;

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")//often the standard;
Connection con = DriverManager.getConnection(url,"username","password");
Statement stmt = con.createStatement();

this is as far as connection goes

hakeem46
Newbie Poster
2 posts since May 2004
Reputation Points: 10
Solved Threads: 0
 
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver")//often the standard;

Case Sensitive

Paladine
Master Poster
Team Colleague
824 posts since Feb 2003
Reputation Points: 211
Solved Threads: 27
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You