Mailingliste - Einträge 2006


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [qftestJUI] Jython: ClassNotFoundException occures, even if the *.jar file is known (ojdbc14.jar)


  • Subject: Re: [qftestJUI] Jython: ClassNotFoundException occures, even if the *.jar file is known (ojdbc14.jar)
  • From: Gregor Schmid <Gregor.Schmid@?.de>
  • Date: 02 Jun 2006 09:22:39 +0200

Hello Alexander,

are you running this as a Server script or as an SUT script? Unless
you have a specific reason for runnning it in the SUT you should
always use a server script.

The problem most likely comes from using Class.forName. For an SUT
script, plugin jars are not available to the System class loader. For
a server script it might work.

Have you tried importing the driver directly?

Best regards,
    Greg

Alexander Vondrous <avondrou@?.com> writes:

> Hi,
> 
> we try to make a databaserequest with jython to load some values for a
> test. We use Oracle 10 and ojdbc14.jar. I copied the jar file into the
> \plugin folder. Our qftestJUI Version is 1.06.1 (build 1027). I try to
> run the following skript:
> 
> 	from DBProxy import DBProxy
> 
> 	# load parameters
> 	driver = rc.lookup("DB","$(server).driver")
> 	url=  rc.lookup("DB","$(server).url")
> 	userid =  rc.lookup("DB","$(server).userid")
> 	password = rc.lookup("DB","$(server).password")
> 	sql = "select count(*) from ####### where ####### >
> '06.07.2006'"
> 
> 	#debug
> 	print driver
> 	print url
> 	print userid
> 	print password
> 	print sql
> 
> 	# get Resultset
> 	database = DBProxy()
> 	rs = database.getResultSet(driver, url, userid, password, sql)
> 	...	
> 
> DBProxy.py:
> 
> 	from java.lang import Class
> 	from java.sql  import DriverManager
> 
> 
> 	class DBProxy:
> 	def getResultSet(self, driver, url, user, password, sql):
> 		# loads Driver and gets DB Connection
> 		Class.forName(driver)
> 		dbconn = DriverManager.getConnection(url, user,
> password)
> 
> 		# creates statement and gets result
> 		stmt = dbconn.createStatement()
> 		rs = stmt.executeQuery(sql)
> 		dbconn.commit()
> 		return rs
> 		
> 	def setStatement(self, driver, url, user, password, sql):
> 		# loads Driver and gets DB Connection
> 		Class.forName(driver)
> 		dbconn = DriverManager.getConnection(url, user,
> password)
> 
> 		# creates statement and gets result
> 		stmt = dbconn.createStatement()
> 		rs = stmt.executeQuery(sql)
> 		return
> 
> 
> The following error occures: 
> 
> 	java.lang.ClassNotFoundException:
> java.lang.ClassNotFoundException: oracle/jdbc/driver/OracleDriver
> 
> We added the jar file into the CLASSPATH, we copied the jar file in
> almost every directory but nothing helped.
> Please help us.
> 
> With kind regards
> 
> Alexander Vondrous

-- 
Gregor Schmid                                Gregor.Schmid@?.de
Quality First Software GmbH                     http://www.qfs.de
Tulpenstr. 41                                Tel: +49 8171 919870
DE-82538 Geretsried                          Fax: +49 8171 919876


Videos Downloads Dokumentation Kaufen Gratis Testen