| Author |
Error in connetion pool driver.connect
|
peter brews
Ranch Hand
Joined: Jan 25, 2002
Posts: 59
|
|
Dear All, I am getting following error msg : connect(java.lang.String,java.util.Properties) in java.sql.Driver cannot be applied to (java.lang.ring,java.lang.String,java.lang.String) [javac] Driver.connect("jdbc racle:thin:@localhost:1521 emo", "tiger", "scott"); [javac] ^ [javac] 1 error whereas as per utils.dbping following is valid code: Class.forName("oracle.jdbc.driver.OracleDriver").newInstance(); java.sql.Connection conn = Driver.connect("jdbc racle:thin:@localhost:1521 emo", "tiger", "scott"); I have external properties file which contains username,password, and lot of other information. I wanted to get only requred properties for driver.connect and pass the username and password as strings instead of passig the complete properties file. can anyone help me how to read/load a external properties file so that it can be passed Driver.connect thanks, smita
|
 |
Chris Mathews
Ranch Hand
Joined: Jul 18, 2001
Posts: 2712
|
|
How about this: [ September 17, 2002: Message edited by: Chris Mathews ]
|
 |
peter brews
Ranch Hand
Joined: Jan 25, 2002
Posts: 59
|
|
I don;'t want to Drivermanager.getConnetion() as it is syncronized I want to use Driver.connect Is there some way of knowing details of parameters accepted by Driver.connect. Can anyone sugget me how to use external properties file to read the user and passsword and pass it to Driver.conenct Any help is highly appreciated Thanks, smita
|
 |
Chris Mathews
Ranch Hand
Joined: Jul 18, 2001
Posts: 2712
|
|
|
The fact that Drivermanager.getConnetion() is synchronized is not the real problem. The real problem is that you are creating the connection for each use. You should be using a Connection Pool. Since you posted this on a WebLogic forum, I am going to assume that WebLogic is your Application Server. In that case you should be utilizing WebLogic Connection Pools.
|
 |
peter brews
Ranch Hand
Joined: Jan 25, 2002
Posts: 59
|
|
I have created Connection pool . I want to use the connection pool. Can i get some sample code. In the docs of bea it is mentioned to use utils.dbping and after running that i got some code on scrren that i had used or mu method. If you could provide me some sample code to use connection pool( i have oracle thin dirver pool created) that will be helpful thanks, smita
|
 |
Dave Landers
Ranch Hand
Joined: Jul 24, 2002
Posts: 401
|
|
The easiest way is to create a DataSource for the pool, then look up the DataSource from JNDI. From a client program, it'd go something like this: From server-side code, you don't need the hashtable - just use new InitialContext()....
|
 |
Pearlo Muthukumaran
Ranch Hand
Joined: Sep 17, 2002
Posts: 79
|
|
will the following code work if I just change the IP address in place of localhost(of course within the LAN) and run the Bean Client in a diffreent system having no traces of WEBLOGIC installations (ie no jars realated to weblogic) Rgds Muthukumaran
|
 |
 |
|
|
subject: Error in connetion pool driver.connect
|
|
|