你在jdk doc里面查一下DataSource这个类的方法呀,里面有说明。
public Connection getConnection(String username,String password) throws SQLException
public Connection getConnection(String username,String password) throws SQLException
解决方案 »
- 菜鸟问题
- DWR 内网 和 外网 的取session值的问题
- HTTP Status 404 错误问题
- 在jsp<html>标记上面 Iterator 从request里面取出来是true,但在<html>里面取出来就为false
- struts标签嵌套JAVA语句的问题。
- java编程走哪个方向好?目前菜鸟我会J2EE的知识
- 这个要怎么办才好啊?
- 关于JDK1.5文档的问题,我刚下了1.5的文档,里面怎么找不到javax.servlet的内容呢?
- 哪位强人帮我解答两个问题(Spring和Struts).小弟谢谢了....
- struts2 下载出错 大哥们给解决一下把
- 怎样看到linux的tomcat下的控制台打印出来的信息?
- 有关socket的网络编程,大虾请进!!!
public static Connection getConnection(String url,
Properties info)
throws SQLExceptionAttempts to establish a connection to the given database URL. The DriverManager attempts to select an appropriate driver from the set of registered JDBC drivers.Parameters:
url - a database url of the form jdbc:subprotocol:subname
info - a list of arbitrary string tag/value pairs as connection arguments; normally at least a "user" and "password" property should be included
Returns:
a Connection to the URL
Throws:
SQLException - if a database access error occursgetConnection
public static Connection getConnection(String url,
String user,
String password)
throws SQLExceptionAttempts to establish a connection to the given database URL. The DriverManager attempts to select an appropriate driver from the set of registered JDBC drivers.
Parameters:
url - a database url of the form jdbc:subprotocol:subname
user - the database user on whose behalf the connection is being made
password - the user's password
Returns:
a connection to the URL
Throws:
SQLException - if a database access error occurs
getConnection
public static Connection getConnection(String url)
throws SQLExceptionAttempts to establish a connection to the given database URL. The DriverManager attempts to select an appropriate driver from the set of registered JDBC drivers.
Parameters:
url - a database url of the form jdbc:subprotocol:subname
Returns:
a connection to the URL
Throws:
SQLException - if a database access error occurs说得比较详细了,虽然看懂个大概,但我还是没翻译的水平。希望对你有帮助!
采访数据库的时候用的
假如你在你的服务器jboss/weblogic里面设置好了话 可以不用的
java:comp/env/jdbc/oracle"); 假设这个。。 用jbuilder的话是在ResourceReference那里 添加指向你的数据源的JNDI的