You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nishant <ni...@cybage.com> on 2004/11/18 06:41:47 UTC
how to access oracle database on netwrk
hello,
i am using oracle 9i as my database in my application.
My database is on anothere machine in network.
my struts-config.xml is like
<data-sources>
<data-source type="org.apache.commons.dbcp.BasicDataSource">
<set-property property="driverClassName"
value="com.mysql.jdbc.Driver" />
<set-property property="url"
value="jdbc:mysql://localhost/employees" />
<set-property property="username"
value="thinc"/>
<set-property property="password"
value="thinc"/>
</data-source>
</data-sources>
now server is throwing an errors as cannot load JDBC driver called com.mysql.jdbc.Driver
wht is wrong .... wiil i hav to import some external JDBC driver (on my pc no oracle is there )
Nishant Patil
Software Engineer
Cybage Software Pvt. Ltd. (A CMM Level 3 Company)
West Avenue , Kalyani Nagar,
Pune - 411 006
Tel: 91-20-4041700 -355
Email: nishantp@cybage.com
Website: www.cybage.com
There's a difference between knowing the path, and walking the path
Re: how to access oracle database on netwrk
Posted by Peng Tuck <pe...@bluebottle.com>.
Nishant wrote:
>now server is throwing an errors as cannot load JDBC driver called com.mysql.jdbc.Driver
>wht is wrong .... wiil i hav to import some external JDBC driver (on my pc no oracle is there )
>
>
You want to connect to an oracle database and you're loading a jdbc
driver for mysql ?
Yes you will have to make a oracle jdbc driver available to tomcat ( or
whatever app server you are using). FYI
there is a brief write up on this with the tomcat docs. Just make sure
you have the proper driver for the version of oracle you are using
and you should be ok.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: how to access oracle database on netwrk
Posted by Erik Weber <er...@mindspring.com>.
You say you are using Oracle, but your configuration is for a MySQL
database. For Oracle, your driver class is going to be
oracle.jdbc.driver.OracleDriver. Your URL is going to follow this pattern:
jdbc:oracle:thin:@<hostname>:<port>:<db_name>
The "database name" is also known as a TNS name in Oracle terms. Usually
this is something you have to obtain from whoever set up the database.
You are also going to need to download the Oracle thin driver from the
URL I gave you earlier. You may have to register, I can't remember, but
it's painless if you do.
The driver jar file (ojdbc14.jar) has to be in your server's classpath.
You don't say what server you are using, but in the case of Tomcat, it
goes in <tomcat_home>/common/lib/.
The Oracle thin driver (the collection of classes which lives in the
above mentioned jar file) is a Java library which enables your Java
application to talk to the Oracle database server over a network using
the JDBC API. The classes are implementations of JDBC. (Sorry if you
already know all this.)
You don't have to use the Struts data source configuration you are
trying to use, but you can if you want. Consider it to be optional. It
might be easier to just follow the documentation that comes with your
server for setting up a JDBC connection pool (data source). You can get
a reference to a Java DataSource instance using a standard JNDI lookup
(there are tutorials on this). Again, if you are using Tomcat, the docs
will help with this (I think there is an Oracle example).
Hope this helps,
Erik
Nishant wrote:
>hello,
>i am using oracle 9i as my database in my application.
>My database is on anothere machine in network.
>my struts-config.xml is like
><data-sources>
> <data-source type="org.apache.commons.dbcp.BasicDataSource">
> <set-property property="driverClassName"
> value="com.mysql.jdbc.Driver" />
> <set-property property="url"
> value="jdbc:mysql://localhost/employees" />
> <set-property property="username"
> value="thinc"/>
> <set-property property="password"
> value="thinc"/>
> </data-source>
> </data-sources>
>
>now server is throwing an errors as cannot load JDBC driver called com.mysql.jdbc.Driver
>wht is wrong .... wiil i hav to import some external JDBC driver (on my pc no oracle is there )
>
>
>Nishant Patil
>Software Engineer
>Cybage Software Pvt. Ltd. (A CMM Level 3 Company)
>West Avenue , Kalyani Nagar,
>Pune - 411 006
>Tel: 91-20-4041700 -355
>Email: nishantp@cybage.com
>Website: www.cybage.com
>There's a difference between knowing the path, and walking the path
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org