Search:     Advanced search
Browse by category:

JSP mysql connection sample script

Posted: 27 May, 2010
by: IPSERVERONE - Support .
Updated: 27 May, 2010
by: IPSERVERONE - Support .
<%@ page import = "java.sql.*"%>
<html>
<head>
<title>Obtaining a Connection </title>
</head>
<body>
<%
Connection conn=null;
ResultSet result=null;
Statement stmt=null;
ResultSetMetaData rsmd=null;
try
{
Class c=Class.forName("com.mysql.jdbc.Driver");
}
catch(Exception e)
{
out.write("Error!!!!!!" + e);
}
try
{
conn=DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/mystudyr_vshare1","mystudyr_test","passw0rd");
out.write("Connected!");
}
catch(SQLException e)
{
System.out.println("Error!!!!!!" + e);
}
%>
</body>
</html>
Others in this Category
document MySQL ConnectionString in ASP/ASP.net
document How to establish a Connection to a MS Access Database
document How to allow Upload more than 30MB in ASP + IIS7
document Redirect Pages with .htaccess