hiteksoftware.com Forum Index hiteksoftware.com
User discussion forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Oracle SQL Doesn't disconnect

 
Post new topic   Reply to topic    hiteksoftware.com Forum Index -> Other
View previous topic :: View next topic  
Author Message
altman80



Joined: 07 Jul 2008
Posts: 7

PostPosted: Mon Jul 07, 2008 6:34 am    Post subject: Oracle SQL Doesn't disconnect Reply with quote

We are currently using Automize 7 and are using it to execute some Oracle stored procedures. I am using the ojdbc14.jar from Oracle to connect. The procedure runs as it should but what we've just found out is that automize is not releasing the connection to Oracle. We found this as we reached the max number of connections this morning. The task log shows that the task is starting and ending with exit code 0. Is there something I have set up wrong or is this a bug? My settings are as follows:


Driver Class Name: oracle.jdbc.driver.OracleDriver
Database URL: jdbc:oracle:oci:@myDatabase
The SQL is a stored procedure that looks somewhat like this:
Begin; MySP(); End;
Back to top
View user's profile Send private message
Robert
Site Admin


Joined: 25 May 2006
Posts: 1140

PostPosted: Mon Jul 07, 2008 8:30 am    Post subject: Reply with quote

our code explicitly closes the DB connection.
is there any errors in the debug log or task logs?
attach snippets of your logs from the last task run.
Back to top
View user's profile Send private message
altman80



Joined: 07 Jul 2008
Posts: 7

PostPosted: Mon Jul 07, 2008 9:27 am    Post subject: Reply with quote

Database SQL - Shift_Task - Schedule Title = Shift_Task , Scheduled execution time = Jul 7, 2008 5:00:00 AM

Jul 7, 2008 5:00:00 AM

Database SQL - Shift_Task - Start Instance = 94

Jul 7, 2008 5:00:31 AM

Database SQL - Shift_Task - Rows updated/inserted/deleted = -1

Jul 7, 2008 5:00:31 AM

Database SQL - Shift_Task - End Instance = 94 , Exit Code = 0 , Runtime (ms) = 31406

The task log looks like this for every instance it ran.
Upon further looking though, the problem must be intermittent as we have this run every 8 hours and different one run every 15 minutes to the same database. We have a maximum of 150 connections set up in Oracle and this has been running for a while until we reached the maximum connections. When we got the max connections error though there were numerous connections to Oracle still left open from one of these 2 tasks.
Back to top
View user's profile Send private message
Robert
Site Admin


Joined: 25 May 2006
Posts: 1140

PostPosted: Mon Jul 07, 2008 10:46 am    Post subject: Reply with quote

is there anything in the debug log around 5:00:xx or 5:01:xx ?

Jul 7, 2008 5:00:31 AM
Database SQL - Shift_Task - Rows updated/inserted/deleted = -1
Back to top
View user's profile Send private message
altman80



Joined: 07 Jul 2008
Posts: 7

PostPosted: Mon Jul 07, 2008 11:03 am    Post subject: Reply with quote

There is nothing for that specific time but there are logs with errors in them for the stored procedure. This gave the following:
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)

at oracle.jdbc.oci8.OCIDBAccess.check_error(OCIDBAccess.java:2349)

at oracle.jdbc.oci8.OCIDBAccess.executeFetch(OCIDBAccess.java:1757)

at oracle.jdbc.oci8.OCIDBAccess.parseExecuteFetch(OCIDBAccess.java:1915)

at oracle.jdbc.driver.OracleStatement.executeNonQuery(OracleStatement.java:2191)

at oracle.jdbc.driver.OracleStatement.doExecuteOther(OracleStatement.java:2064)

at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:2989)

at oracle.jdbc.driver.OracleStatement.execute(OracleStatement.java:961)

at com.hitek.engine.mods.database.DBSelectTask.executeSQL(DBSelectTask.java:216)

at com.hitek.engine.mods.database.DBSelectTask.dbSelectTask(DBSelectTask.java:85)

at com.hitek.engine.mods.database.DBSelectTask.run(DBSelectTask.java:45)


If the stored procedure crashes, does this leave the connection to the database open? We have since restarted our Oracle server so I cannot compare that the crash times are in line with the stranded connections.
Back to top
View user's profile Send private message
melvin
Site Admin


Joined: 25 May 2006
Posts: 595
Location: Santa Barbara, california

PostPosted: Mon Jul 07, 2008 5:16 pm    Post subject: Reply with quote

the connection is always checked and closed, error or no error.

run the tasks as external process. (engine menu / external processes)
this could trick the DB into releasing the connection, since the process dies after completion.
Back to top
View user's profile Send private message Send e-mail
altman80



Joined: 07 Jul 2008
Posts: 7

PostPosted: Tue Jul 08, 2008 4:30 am    Post subject: Reply with quote

Thanks for the help, I will try that.
Back to top
View user's profile Send private message
altman80



Joined: 07 Jul 2008
Posts: 7

PostPosted: Thu Jul 17, 2008 8:29 am    Post subject: Reply with quote

I tried it as an external process and it doesn't run it at all as an external process. The following gets posted to the log.


External Process Runner - myJob - Error : java.lang.UnsatisfiedLinkError: no ocijdbc9 in java.library.path

Jul 15, 2008 2:30:03 PM

External Process Runner - myJob - Error : at java.lang.ClassLoader.loadLibrary(Unknown Source)

Jul 15, 2008 2:30:03 PM

External Process Runner - myJob - Error : at java.lang.Runtime.loadLibrary0(Unknown Source)

Jul 15, 2008 2:30:03 PM

External Process Runner - myJob - Error : at java.lang.System.loadLibrary(Unknown Source)

Jul 15, 2008 2:30:03 PM

External Process Runner - myJob - Error : at oracle.jdbc.oci8.OCIDBAccess.logon(OCIDBAccess.java:267)

Jul 15, 2008 2:30:03 PM

External Process Runner - myJob - Error : at oracle.jdbc.driver.OracleConnection.<init>(OracleConnection.java:371)

Jul 15, 2008 2:30:03 PM

External Process Runner - myJob - Error : at oracle.jdbc.driver.OracleDriver.getConnectionInstance(OracleDriver.java:551)

Jul 15, 2008 2:30:03 PM

External Process Runner - myJob - Error : at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:351)

Jul 15, 2008 2:30:03 PM

External Process Runner - myJob - Error : at java.sql.DriverManager.getConnection(Unknown Source)

Jul 15, 2008 2:30:03 PM

External Process Runner - myJob - Error : at java.sql.DriverManager.getConnection(Unknown Source)

Jul 15, 2008 2:30:03 PM

External Process Runner - myJob - Error : at com.hitek.gui.mods.database.DBConnection.getConnection(DBConnection.java:52)

Jul 15, 2008 2:30:03 PM Database SQL - myJob - End Instance = 197 , Exit Code = 0 , Runtime (ms) = 984

Jul 15, 2008 2:30:03 PM

External Process Runner - myJob - Error : at com.hitek.engine.mods.database.DBSelectTask.connectToDBServer(DBSelectTask.java:139)

Jul 15, 2008 2:30:03 PM

External Process Runner - myJob - Error : at com.hitek.engine.mods.database.DBSelectTask.dbSelectTask(DBSelectTask.java:76)

Jul 15, 2008 2:30:03 PM

External Process Runner - myJob - Error : at com.hitek.engine.mods.database.DBSelectTask.run(DBSelectTask.java:45)

Jul 15, 2008 2:30:06 PM
Back to top
View user's profile Send private message
melvin
Site Admin


Joined: 25 May 2006
Posts: 595
Location: Santa Barbara, california

PostPosted: Fri Jul 18, 2008 11:50 pm    Post subject: Reply with quote

have you included the odbc14.jar in both the main Automize7 directory as well as in Automize7\jre\lib\ext directory?


use the Utilities menu / commandline menu / Task Runner menu.

Select your task

Click on generate Code. working directory and commandline will be generated

create a new wincommand or command task using the above working directory and commandline.

in the commandline , make sure that odbc14.jar is in the class path as shown below .....
"C:\Program Files\Automize7\jre\bin\javaw.exe" -cp .;bin;help;activation.jar;bsh.jar;hitek7.jar;jakoro.jar;jh.jar;mail.jar;maverick-all.jar;net.jar;odbc14.jar com.hitek.engine.core.RunTask myJob
Back to top
View user's profile Send private message Send e-mail
altman80



Joined: 07 Jul 2008
Posts: 7

PostPosted: Mon Jul 21, 2008 4:50 am    Post subject: Reply with quote

I did not have the ojdbc.jar in the main directory for automize. I put it there and restarted the engine. I then tried to run it again and had the same problem. I went to the task runner and this is what shows.

E:\Automize7\jre\bin\javaw.exe -cp .;bin;help;activation.jar;bsh.jar;hitek7.jar;jakoro.jar;jh.jar;mail.jar;maverick-all.jar;net.jar;ojdbc14.jar com.hitek.engine.core.RunTask TestTask

I copied that to the clipboard and tried to run it in the command prompt and windows gave a messagbox error

Messagebox Title:
"Java Virtual Machine Launcher"

Messagebox Description:
"Could not find the main class. Program will exit."
Back to top
View user's profile Send private message
Robert
Site Admin


Joined: 25 May 2006
Posts: 1140

PostPosted: Mon Jul 21, 2008 4:03 pm    Post subject: Reply with quote

did you cd to E:\Automize7 first?

seems like the working directory is not set , hence it is not finding the classes.
Back to top
View user's profile Send private message
altman80



Joined: 07 Jul 2008
Posts: 7

PostPosted: Tue Jul 22, 2008 4:50 am    Post subject: Reply with quote

I changed the directory in the command prompt and the task ran just fine. But it still won't run as an external process within the automize program.
Back to top
View user's profile Send private message
Robert
Site Admin


Joined: 25 May 2006
Posts: 1140

PostPosted: Tue Jul 22, 2008 4:12 pm    Post subject: Reply with quote

The external process feature cannot dynamically append ojdbc14.jar to the class path and hence fails.

Use the working directory and commandline in a Command task. Then schedule the command task. This will run it as an external process (and with ojdbc.jar added to classpath).
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    hiteksoftware.com Forum Index -> Other All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group