Using ojdbc with Jython standalone

View: New views
2 Messages — Rating Filter:   Alert me  

Using ojdbc with Jython standalone

by Jones, Steven-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Using ojdbc with Jython standalone

When I install Jython 2.5 (any beta version) as a standalone JAR, I am unable to access oracle.jdbc.OracleDriver in jython.  However, if I install jython as a full installation, I have no problem.  What am I doing wrong?

CLASSPATH=/home/path/to/ojdbc6.jar


$ java oracle.jdbc.OracleDriver
Oracle 11.1.0.7.0-Production JDBC 4.0 compile with JDK6


Using a standalone jython.jar installation:


[dmsys_ade@dimtest2 jython25b3]$ java -jar jython.jar
Jython 2.5b3 (Release_2_5beta3:6092, Mar 10 2009, 15:34:57)
[Java HotSpot(TM) Server VM (Sun Microsystems Inc.)] on java1.6.0_03
Type "help", "copyright", "credits" or "license" for more information.
>>> from com.ziclix.python.sql import zxJDBC
db = zxJDBC.connect('jdbc:oracle:thin:@host:post:dimt','xxx','xxx','oracle.jdbc.OracleDriver')>>>
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
zxJDBC.DatabaseError: driver [oracle.jdbc.OracleDriver] not found
>>>



using a "full" installation of jython


[dmsys_ade@dimtest2 jython2.5rc2]$ ./jython
Jython 2.5rc2 (Release_2_5rc2:6341, May 11 2009, 17:07:28)
[Java HotSpot(TM) Server VM (Sun Microsystems Inc.)] on java1.6.0_03
Type "help", "copyright", "credits" or "license" for more information.
>>> from com.ziclix.python.sql import zxJDBC
>>> db = zxJDBC.connect('jdbc:oracle:thin:@host:port:dimt','xxx','xxx','oracle.jdbc.OracleDriver')
>>>


works fine. 


What is the "correct" way to reference this jar file for use in my jython script using a standalone jython installation?

--
STEVE R. JONES  | CalPERS ITSB - IISD – RMO  | C: 916.402.5356 | W: 916.795.7662


______________________________________________
From:   Jones, Steven 
Sent:   Tuesday, May 12, 2009 4:36 PM
To:     'jython-users@...'
Subject:        Using ojdbc with Jython standalone

When I install Jython 2.5 (any beta version) as a standalone JAR, I am unable to access oracle.jdbc.OracleDriver in jython.  However, if I install jython as a full installation, I have no problem.  What am I doing wrong?

CLASSPATH=/home/path/to/ojdbc6.jar


$ java oracle.jdbc.OracleDriver
Oracle 11.1.0.7.0-Production JDBC 4.0 compile with JDK6


Using a standalone jython.jar installation:


[dmsys_ade@dimtest2 jython25b3]$ java -jar jython.jar
Jython 2.5b3 (Release_2_5beta3:6092, Mar 10 2009, 15:34:57)
[Java HotSpot(TM) Server VM (Sun Microsystems Inc.)] on java1.6.0_03
Type "help", "copyright", "credits" or "license" for more information.
>>> from com.ziclix.python.sql import zxJDBC
db = zxJDBC.connect('jdbc:oracle:thin:@host:post:dimt','xxx','xxx','oracle.jdbc.OracleDriver')>>>
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
zxJDBC.DatabaseError: driver [oracle.jdbc.OracleDriver] not found
>>>



using a "full" installation of jython


[dmsys_ade@dimtest2 jython2.5rc2]$ ./jython
Jython 2.5rc2 (Release_2_5rc2:6341, May 11 2009, 17:07:28)
[Java HotSpot(TM) Server VM (Sun Microsystems Inc.)] on java1.6.0_03
Type "help", "copyright", "credits" or "license" for more information.
>>> from com.ziclix.python.sql import zxJDBC
>>> db = zxJDBC.connect('jdbc:oracle:thin:@host:port:dimt','xxx','xxx','oracle.jdbc.OracleDriver')
>>>


works fine. 


What is the "correct" way to reference this jar file for use in my jython script using a standalone jython installation?


------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Jython-users mailing list
Jython-users@...
https://lists.sourceforge.net/lists/listinfo/jython-users

Re: Using ojdbc with Jython standalone

by oti-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Steven,

java ignores your classpath if started with the -jar option.
So if you need more than one .jar file on the classpath, you have to
supply the main class instead (which - in our case - you can find in
the MANIFEST of jython.jar).

For me this worked:

java -classpath
./jython.jar:/Users/oti/stuff/workspace/rcwb/external/lib/jdbc/oracle/ojdbc6.jar
org.python.util.jython
Jython 2.5rc3 (Release_2_5rc3:6384:6385, May 26 2009, 15:51:41)
[Java HotSpot(TM) Client VM (Apple Inc.)] on java1.5.0_16
Type "help", "copyright", "credits" or "license" for more information.
>>> from com.ziclix.python.sql import zxJDBC
>>>

best wishes,
Oti.



On Thu, May 14, 2009 at 7:31 PM, Jones, Steven
<Steven_Jones@...> wrote:

> When I install Jython 2.5 (any beta version) as a standalone JAR, I am
> unable to access oracle.jdbc.OracleDriver in jython.  However, if I install
> jython as a full installation, I have no problem.  What am I doing wrong?
>
> CLASSPATH=/home/path/to/ojdbc6.jar
>
> $ java oracle.jdbc.OracleDriver
> Oracle 11.1.0.7.0-Production JDBC 4.0 compile with JDK6
>
> Using a standalone jython.jar installation:
>
> [dmsys_ade@dimtest2 jython25b3]$ java -jar jython.jar
> Jython 2.5b3 (Release_2_5beta3:6092, Mar 10 2009, 15:34:57)
> [Java HotSpot(TM) Server VM (Sun Microsystems Inc.)] on java1.6.0_03
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from com.ziclix.python.sql import zxJDBC
> db =
> zxJDBC.connect('jdbc:oracle:thin:@host:post:dimt','xxx','xxx','oracle.jdbc.OracleDriver')>>>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> zxJDBC.DatabaseError: driver [oracle.jdbc.OracleDriver] not found
>>>>
>
> using a "full" installation of jython
>
> [dmsys_ade@dimtest2 jython2.5rc2]$ ./jython
> Jython 2.5rc2 (Release_2_5rc2:6341, May 11 2009, 17:07:28)
> [Java HotSpot(TM) Server VM (Sun Microsystems Inc.)] on java1.6.0_03
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from com.ziclix.python.sql import zxJDBC
>>>> db =
>>>> zxJDBC.connect('jdbc:oracle:thin:@host:port:dimt','xxx','xxx','oracle.jdbc.OracleDriver')
>>>>
>
> works fine.
>
> What is the "correct" way to reference this jar file for use in my jython
> script using a standalone jython installation?
>
> --
> STEVE R. JONES  | CalPERS ITSB - IISD – RMO  | C: 916.402.5356 |
> W: 916.795.7662
>
> ______________________________________________
> From:   Jones, Steven
> Sent:   Tuesday, May 12, 2009 4:36 PM
> To:     'jython-users@...'
> Subject:        Using ojdbc with Jython standalone
>
> When I install Jython 2.5 (any beta version) as a standalone JAR, I am
> unable to access oracle.jdbc.OracleDriver in jython.  However, if I install
> jython as a full installation, I have no problem.  What am I doing wrong?
>
> CLASSPATH=/home/path/to/ojdbc6.jar
>
> $ java oracle.jdbc.OracleDriver
> Oracle 11.1.0.7.0-Production JDBC 4.0 compile with JDK6
>
> Using a standalone jython.jar installation:
>
> [dmsys_ade@dimtest2 jython25b3]$ java -jar jython.jar
> Jython 2.5b3 (Release_2_5beta3:6092, Mar 10 2009, 15:34:57)
> [Java HotSpot(TM) Server VM (Sun Microsystems Inc.)] on java1.6.0_03
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from com.ziclix.python.sql import zxJDBC
> db =
> zxJDBC.connect('jdbc:oracle:thin:@host:post:dimt','xxx','xxx','oracle.jdbc.OracleDriver')>>>
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> zxJDBC.DatabaseError: driver [oracle.jdbc.OracleDriver] not found
>>>>
>
> using a "full" installation of jython
>
> [dmsys_ade@dimtest2 jython2.5rc2]$ ./jython
> Jython 2.5rc2 (Release_2_5rc2:6341, May 11 2009, 17:07:28)
> [Java HotSpot(TM) Server VM (Sun Microsystems Inc.)] on java1.6.0_03
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from com.ziclix.python.sql import zxJDBC
>>>> db =
>>>> zxJDBC.connect('jdbc:oracle:thin:@host:port:dimt','xxx','xxx','oracle.jdbc.OracleDriver')
>>>>
>
> works fine.
>
> What is the "correct" way to reference this jar file for use in my jython
> script using a standalone jython installation?
>
> ------------------------------------------------------------------------------
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
> production scanning environment may not be a perfect world - but thanks to
> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK
> i700
> Series Scanner you'll get full speed at 300 dpi even with all image
> processing features enabled. http://p.sf.net/sfu/kodak-com
> _______________________________________________
> Jython-users mailing list
> Jython-users@...
> https://lists.sourceforge.net/lists/listinfo/jython-users
>
>

------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
Jython-users mailing list
Jython-users@...
https://lists.sourceforge.net/lists/listinfo/jython-users