Sep

14

If you have JSP, MySQL and Jconnector installed, and wanna test if everything works okay, here is a simple script you can use to test.


<%@ 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://192.168.110.5:3306/databasename","username","password");
out.write("Connected!");
}
catch(SQLException e)
{
System.out.println("Error!!!!!!" + e);
} 

Change 192.168.110 from the above script to your url
databasename, username and password to your databasename, username and password.



Similar Posts

Comments

Name (required)

Email (required)

Website

Speak your mind

Sponsors




Links