hi guys i have a problem in connecting my jsp program in MSsql 2005
i want to create a connection in my jsp program to MSsql database
but theres an error of my work would you help me please in my problem
thanks ... fo helping
here is my code
Code:
PHP Code:
<%@ page import="java.util.*" %>
<%@ page import="javax.sql.*;" %>
<%@ page import="java.sql.*;" %>
<%@ page import="java.util.Enumeration;" %>
<html>
<head><title>Sample MS connection</title></head>
<body>
<table>
<%
Connection conn = null;
try {
String dbURL = "jdbc:sqlserver://192.168.0.103/mydatabase";
String user = "sa";
String pass = "";
conn = DriverManager.getConnection(dbURL, user, pass);
if (conn != null) {
DatabaseMetaData dm = (DatabaseMetaData) conn.getMetaData();
System.out.println("Driver name: " + dm.getDriverName());
System.out.println("Driver version: " + dm.getDriverVersion());
System.out.println("Product name: " + dm.getDatabaseProductName());
System.out.println("Product version: " + dm.getDatabaseProductVersion());
}
} catch (SQLException ex) {
ex.printStackTrace();
} finally {
try {
if (conn != null && !conn.isClosed()) {
conn.close();
}
} catch (SQLException ex) {
ex.printStackTrace();
}
}
%>
</body>
</html>