|
Driver Name
The class name of the driver is : com.inet.tds.TdsDriver
JDBC URL Syntax
jdbc:inetdae7:hostname:portnumber
e.g. jdbc:inetdae7:www.indianseo.co.in:1433
A Sample Code :
Pl. note in the example below the Database
User name : rama
Password : media22
Site URL : www.indianseo.co.in
The code starts here :
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
String url = "jdbc:inetdae7:www.indianseo.co.in:1433"; // use your hostname
and port number
String login = "rama"; // use your login here
String password = "media22"; // use your password here
public class create extends HttpServlet
{
Connection con;
Statement st;
ServletOutputStream out;
public void doGet(HttpServletRequest req,HttpServletResponse res) throws
Servlet Exception,IOException
{
out=res.getOutputStream();
out.println("<html>");
out.println("<body>");
try
{
Class.forName("com.inet.tds.TdsDriver").newInstance();
con=DriverManager.getConnection(url,login,password);
st=con.createStatement();
st.execute("create table test1(no varchar(20))");
out.println("<h1>Table Created</h1>");
}
catch(Exception e)
{
out.println("start"+e+"end");
}
out.println("</body>");
out.println("</html>");
}
}
|