请问怎么让JAVA与ORACLE 的数据库连接呀??高分相送 getConnection(String url, String user, String password) throws SQLExceptionDriverManager.getConnection("jdbc:oracle:thin:@host:1521:db","scott","tiger"); 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 在 Oracle 的 jdbc 子目录中 Demo.zip 有很多范例 到ORACLE 公司的网站上面侃侃了.有一个叫ORACLE JDBC 的书将的很详细的哟.我补充以下了:forclass("oracle.jdbc.driver");//好象是这么写的吧.Conntion myconn = DriverManager.getConnection("jdbc:oracle:thin:@host:1521:db","scott","tiger");回复人: bluesmile979(笑着) ( ) 信誉:110 2003-07-13 13:53:00 得分:0 getConnection(String url, String user, String password) throws SQLExceptionDriverManager.getConnection("jdbc:oracle:thin:@host:1521:db","scott","tiger"); Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();String url="jdbc:oracle:thin:@localhost:1521:orcl";String user="scott";String password="tiger";Connection conn= DriverManager.getConnection(url,user,password);Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);String sql="select * from test";ResultSet rs=stmt.executeQuery(sql); public class ConnectionPool { private static String driverName="oracle.jdbc.driver.OracleDriver"; private static String url="jdbc:oracle:thin:@testserver:1521:heliosdb"; private static String user="helios"; private static String password="helios"; public static void setDriver(String driverName) { ConnectionPool.driverName = driverName; } public static void setUrl(String url) { ConnectionPool.url=url; } public static void setUserPassword(String user,String password) { ConnectionPool.user=user; ConnectionPool.password=password; } public static java.sql.Connection getConnection() { java.sql.Connection conn=null; try { Object oDriver=null; try { oDriver = Class.forName( driverName ).newInstance(); } catch(Exception ex) { ex.printStackTrace(); } java.sql.Driver driver = (java.sql.Driver)oDriver; java.sql.DriverManager.registerDriver(driver); conn = java.sql.DriverManager.getConnection( url, user,password); }catch(Exception ex) { ex.printStackTrace(); } return conn; } } Class.forName("oracle.jdbc.driver.OracleDriver").newInstance();String url="jdbc:oracle:thin:@localhost:1521:orcl";String user="system";String password="manager";Connection conn= DriverManager.getConnection(url,user,password);JDBC的配置就是要你有到的WEBLOGIC中配置的,就是控制抬上的配置另外还要在你的WEBLOGIC中添加ORACLE 的class12。jar的包才可以的 这是什么意思? 在子panel里可不可以用类似setVisible关闭主窗体 !!panel是自定义加载到窗体上的!! swing中遇到的问题? 请问20957.0 * 1142.61的结果用什么类型表示啊? 麻烦大家进来看一下,需要你们的帮助 struts可以加上Filter实现安全访问控制吗? 请问谁有JDK的中文文档 《core java》里两个算法没看懂,哪位指点指点 请问谁有关于义务兵逃跑的法律文件!急急急!!! java中为什么反射不能直接获取到被继承父类的方法 请教一个程序题。 关于oracle数据库开发的问题
我补充以下了:forclass("oracle.jdbc.driver");//好象是这么写的吧.
Conntion myconn = DriverManager.getConnection("jdbc:oracle:thin:@host:1521:db","scott","tiger");回复人: bluesmile979(笑着) ( ) 信誉:110 2003-07-13 13:53:00 得分:0
getConnection(String url, String user, String password) throws SQLExceptionDriverManager.getConnection("jdbc:oracle:thin:@host:1521:db","scott","tiger");
String url="jdbc:oracle:thin:@localhost:1521:orcl";
String user="scott";
String password="tiger";
Connection conn= DriverManager.getConnection(url,user,password);
Statement stmt=conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);String sql="select * from test";ResultSet rs=stmt.executeQuery(sql);
{
private static String driverName="oracle.jdbc.driver.OracleDriver";
private static String url="jdbc:oracle:thin:@testserver:1521:heliosdb";
private static String user="helios";
private static String password="helios";
public static void setDriver(String driverName)
{
ConnectionPool.driverName = driverName;
}
public static void setUrl(String url)
{
ConnectionPool.url=url;
}
public static void setUserPassword(String user,String password)
{
ConnectionPool.user=user;
ConnectionPool.password=password;
}
public static java.sql.Connection getConnection()
{
java.sql.Connection conn=null;
try
{
Object oDriver=null;
try
{
oDriver = Class.forName( driverName ).newInstance();
}
catch(Exception ex)
{
ex.printStackTrace();
}
java.sql.Driver driver = (java.sql.Driver)oDriver;
java.sql.DriverManager.registerDriver(driver);
conn = java.sql.DriverManager.getConnection(
url, user,password);
}catch(Exception ex)
{
ex.printStackTrace();
}
return conn;
}
}
String url="jdbc:oracle:thin:@localhost:1521:orcl";
String user="system";
String password="manager";
Connection conn= DriverManager.getConnection(url,user,password);JDBC的配置就是要你有到的WEBLOGIC中配置的,就是控制抬上的配置
另外还要在你的WEBLOGIC中添加ORACLE 的class12。jar的包才可以的