connectivity of SQL server 2000 with java
-
Front end of my project is JSP and i'm suppose to use SQl Server as the database for the project so please provide my the code for the connectivity of java with sql server...
-
Front end of my project is JSP and i'm suppose to use SQl Server as the database for the project so please provide my the code for the connectivity of java with sql server...
Your best bet would be to have servlets or some other Java based backend (JSF for example) instead of connecting to the database directory from within JSF. You can then use standard JDBC to connect to the database. If you want to connect to SQL Server, the jTDS driver is one of the best.
-
Front end of my project is JSP and i'm suppose to use SQl Server as the database for the project so please provide my the code for the connectivity of java with sql server...
import java.sql.*; Class.forName(sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:DSN);// DSN(Data Source Name) Statement st=con.createStatement(); st.executeUpdate("insert query"); // Retrieve datas ResultSet rs=st.executeQuery("query"); while(rs.next()) { String name=rs.getString(1); int age=rs.getInt(2); } ;P