How do I setup JDBC?
Here is an example utilizing org.gjt.mm.mysql.Driver.
<%
String dbhost = request.getParameter("dbhost");
String dbname = request.getParameter("dbname");
String user = request.getParameter("user");
String pass = request.getParameter("pass");
String connURL =
"jdbc:mysql://"+dbhost+"/"+dbname+"?user="+user+"&password="+pass;
try
{
Class.forName("org.gjt.mm.mysql.Driver").newInstance();
java.sql.Connection conn = java.sql.DriverManager.getConnection(connURL);
response.getWriter().println("<font color=green><b>");
response.getWriter().println("Connection success!!!");
response.getWriter().println("</b></font>");
}
catch(Exception e)
{
response.getWriter().println("<font color=red><b>[");
response.getWriter().println(e.getMessage());
response.getWriter().println("]<br>");
response.getWriter().println("Connection URL:["+connURL+"]");
response.getWriter().println("</b></font>");
}
%>
Got Questions? Need Assistance?
Submit a Support Ticket
Login and submit a support ticket to have our technical support
assist you:
|
|
|