简体   繁体   English

玻璃鱼错误

[英]glassfish error

SEVERE: javax.naming.NamingException: Lookup failed for 'jdbc:mysql://localhost:3306/sample ' in SerialContext [Root exception is javax.naming.NameNotFoundException: jdbc:mysql:] 严重:javax.naming.NamingException:在SerialContext中对'jdbc:mysql:// localhost:3306 / sample'的查找失败[根异常是javax.naming.NameNotFoundException:jdbc:mysql:]

what to do to rectify? 怎么纠正?

i am running jsp code in netbeans and i am using mysql as dbms 我正在netbeans中运行jsp代码,并且我正在使用mysql作为dbms

So, this is your classmate? 那是你的同学吗 MySQL Connection Error with JSP JSP的MySQL连接错误

To the point, you're trying to access a JNDI resource with a JDBC URL. 到目前为止,您正在尝试使用JDBC URL访问JNDI资源。 This ain't going to work. 这是行不通的。 To fix this problem, you need either to define a JNDI resource and access it with a JNDI name, or to load the JDBC driver yourself and connect it with a JDBC URL. 要解决此问题,您需要定义JNDI资源并使用JNDI名称访问它,或者您自己加载JDBC驱动程序并将其与JDBC URL连接。

That said, it however sounds like that you're a student (given the fact that two identical questions from two different people were posted at almost same time), but you should keep in mind that writing raw Java code in a JSP file is considered bad practice in real world. 就是说,但这听起来像是您是学生(鉴于几乎同时发布了来自两个不同人的两个相同的问题),但是您应该记住,应考虑在JSP文件中编写原始Java代码在现实世界中的不良做法 You can find here a basic kickoff tutorial to learn how to do the stuff the right way: DAO tutorial - the data layer . 您可以在此处找到基本的入门教程,以学习如何以正确的方式进行操作: DAO教程-数据层

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM