Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

need your opinion : what is the best JDBC driver ?

Status
Not open for further replies.

tyris

Programmer
Nov 2, 2000
311
FR
hi all,

i've found so much company selling jdbc driver ...

i'd like your opinion about the best JDBC driver for MS SQL server 7 that could support SQL server and NT authentication.

tell me what's your favorite and why please, that could help me to find the best one. Best regards X-),
Elise
 
The Sun ODBC driver will do the trick for you and it should already be installed either with your servlet engine or in the JDK (I think - otherwise check
Some code like this is what you need.

Code:
...
try
{
	Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
	con = DriverManager.getConnection("jdbc:odbc:msdb","sa","");

	stmt = con.createStatement();
	rs = stmt.executeQuery("SELECT name FROM employees");

	out.println(&quot;<html><head><title>DB Example</title></head>&quot;);
	out.println(&quot;<body>&quot;);
	out.println(&quot;<UL>&quot;);
	while(rs.next())
	{
		out.println(&quot;<LI>&quot; + rs.getString(&quot;name&quot;));
	}
	out.println(&quot;</UL>&quot;);
	out.println(&quot;</BODY></HTML>&quot;);

}
        catch(Exception e)
{
	out.println(&quot;SQLException caught: &quot; + e.getMessage());
	if (e instanceof SQLException)
	{
		out.println(&quot;SQL Exception&quot;);
	}
	else
	{

	}
}
Hope this helps! --
Tim <tim@planetedge.co.uk>
 
thanks for the code, i even found a good site explaining this for the begining :


for the driver, well i have begun my search from the sun site, and they gave me so much results... what would like ùe company is the most common and used driver. so hard to choose among all those one...

Best regards X-),
Elise
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top