sun.jdbc.odbc的问题

ruirui521 2002-01-24 04:13:15
如果我的odbc有用户名和密码,请问URL怎么写?
jdbc:odbc:[dsn]
...全文
98 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
Fancy_fan 2002-01-24
  • 打赏
  • 举报
回复
我给你一个现成的!
Properties="db=MyDB;port=9998;user=fancy;password=fancy;server=10.10.16.200"
ruirui521 2002-01-24
  • 打赏
  • 举报
回复
这个我也知道
我的意思是weblogic里有内置的数据库连接池,在config.xml里修改和配置,然后就……l
ruirui521 2002-01-24
  • 打赏
  • 举报
回复
唉,看我的帖子,这样我也知道。但是Woblogic里有内置的数据库连接池。在config.xml里配置。
handbread 2002-01-24
  • 打赏
  • 举报
回复
package dbtool;
import java.sql.*;
public class Linkdb
{

Connection conn=null;
Statement stmt = null;
ResultSet rs=null;

String s_Driver = "sun.jdbc.odbc.JdbcOdbcDriver";

String s_URL = "jdbc:odbc:[DSN]";

String s_User = "xxx";
String s_Password = "xxxx";

public Linkdb()
{
try{
Class.forName(s_Driver);
conn=DriverManager.getConnection(s_URL,s_User,s_Password);
stmt=conn.createStatement();
}catch(java.lang.ClassNotFoundException e){
System.err.println("Linkdb():"+e.getMessage());}
}


//定义执行Select语句的函数
public ResultSet executeQuery(String sql){
rs=null;
try {

rs=stmt.executeQuery(sql);
}
//处理异常
catch(SQLException ex){
System.err.println("aq.executeQuery:"+ex.getMessage());}
return rs;
}//end method

//执行Insert,Update语句
public void executeUpdate(String sql) {
stmt = null;
rs=null;
try {
stmt.executeUpdate(sql);
}
catch(SQLException ex) {
System.err.println("执行executeUpdate SQL语句出错: " + ex.getMessage());
}
}//end method

//close Stmt
public void closeStmt(){
try{
stmt.close();
}
catch(SQLException e){
e.printStackTrace();
}
}//end method

//close Conn
public void closeConn(){
try{
conn.close();
}
catch(SQLException e){
e.printStackTrace();
}
}//end method

}//END CLASS
ruirui521 2002-01-24
  • 打赏
  • 举报
回复
在weblogic里这样配置行不行?
<JDBCConnectionPool CapacityIncrement="2"
DriverName="sun.jdbc.odbc.JdbcOdbcDriver" InitialCapacity="4"
LoginDelaySeconds="1" MaxCapacity="10" Name="oraclePool"
Password="{3DES}Y9jXl683KDY=" Properties="uid=hsbtob;pwd=hsbtob"
RefreshMinutes="10" ShrinkPeriodMinutes="15"
ShrinkingEnabled="true" Targets="examplesServer"
TestConnectionsOnRelease="false"
TestConnectionsOnReserve="false" TestTableName="dual" URL="jdbc:odbc:b2b"/>
ruirui521 2002-01-24
  • 打赏
  • 举报
回复
wait!
我的意思是在weblogic里怎么用
是在property里加入uid=;pwd=;吗?
Fancy_fan 2002-01-24
  • 打赏
  • 举报
回复
Connection con = DriverManager.getConnection("jdbc:odbc:[dsn]","uid","pwd");

给分啊!

81,122

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧