import java.sql.*;
import java.util.*;
public class Untitled7
{
public static void main(String args[])
{
Connection db;
String DriverName = "com.microsoft.jdbc.sqlserver.SQLServerDriver";
String DBUrl =
"jdbc:microsoft:sqlserver://host:port;user=[username];password=[password]";
try
{
// Initialize the JDBC driver
Class.forName(DriverName);
// System.out.println("Opening connection to database!");
db = DriverManager.getConnection(DBUrl);
if (db == null)
{
System.out.println("Unable to open connection to database!");
}
else
{
System.out.println("Successfully opened connection to database!");
}
}
catch (Exception e)
{
// screwed :)
}
} // end main method
} // end class
-- Azam Khan
-----Original Message-----
From: Venkat & Radha Venkataramanan [mailto:[EMAIL PROTECTED]
Sent: Friday, October 01, 2004 10:08 AM
To: 'Tomcat Users List'
Subject: Does anybody have a JSP/Servlet example on MS SQLServer JDBC
Connectivity?
Hello:
I am a newbie trying to learn Tomcat.
I was successful in creating my first HelloWorld servlet.
However, I am unable to make a MS SQL Server 2000 database connection. Does
anybody have a quick sample application/tutorial that walks one through the
required steps?
Thanks.
Venkat
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]