当前位置:首页 > JSP教程 > JSP常见问题

jsp简单连接SQL Server2000数据库的方法

本文实例讲述了jsp简单连接sql server2000数据库的方法。分享给大家供大家参考。具体如下:

package util; import java.sql.connection; import java.sql.drivermanager; public class conndb { public static string driver="com.microsoft.jdbc.sqlserver.sqlserverdriver"; public static string url="jdbc:microsoft:sqlserver://localhost:1433;databasename=temp"; public static string username="sa"; public static string password=""; public static connection con=null; public static connection getconnection() { try { class.forname(driver); con=drivermanager.getconnection(url,username,password); system.err.println("链接成功"); } catch (exception e) { e.printstacktrace(); } return con; } public static void main(string[] args) { conndb.getconnection(); } }

希望本文所述对大家的jsp程序设计有所帮助。



【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!

相关教程推荐

其他课程推荐