michail Posted March 28, 2017 Share Posted March 28, 2017 I want to upload a war file and I have some questions that are not answered by wiki. 1)How to connect mysql and jsp on tommy server? I have done that locally but Im not sure how this works on tommy. 2)Does tommy support JNDI? Quote Link to comment Share on other sites More sharing options...
Krydos Posted March 28, 2017 Share Posted March 28, 2017 1)How to connect mysql and jsp on tommy server? I have done that locally but Im not sure how this works on tommy.<%@ page import="java.io.*,java.util.*,java.sql.*"%> <%@ page import="javax.servlet.http.*,javax.servlet.*" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head> <title>JSP MySQL Test</title> </head> <body> <sql:setDataSource var="mysql_test" driver="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost/username_test?serverTimezone=UTC" user="username_test" password="bestpasswordever"/> <sql:query dataSource="${mysql_test}" var="result"> SELECT * from java; </sql:query> <c:forEach var="row" items="${result.rows}"> <c:out value="${row.data}"/> </c:forEach> </body> </html> Then download https://krydos.heliohost.org/jars/jstl-1.2.jar and https://krydos.heliohost.org/jars/mysql-connector-java-6.0.5.jar and put them in your WEB-INF/lib directory Working example: https://krydos.heliohost.org/mysql.jsp 2)Does tommy support JNDI?It doesn't look like anyone has tried that yet. Let us all know how it goes and the next person will know. Quote Link to comment Share on other sites More sharing options...
michail Posted March 29, 2017 Author Share Posted March 29, 2017 I guess I dont need to upload jdbc driver for mysql. UPDATE: Not working. Maybe it needs driver. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.