Mailingliste - Einträge 2006


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

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


  • Subject: [qftestJUI] Jython: ClassNotFoundException occures, even if the *.jar file is known (ojdbc14.jar)
  • From: Alexander Vondrous <avondrou@?.com>
  • Date: Thu, 1 Jun 2006 09:12:24 +0200

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