wood burning stoves 2.0*
The moose likes Servlets and the fly likes Doubt on Servlet having database connection? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Doubt on Servlet having database connection?" Watch "Doubt on Servlet having database connection?" New topic
Author

Doubt on Servlet having database connection?

Baseet Ahmed
Ranch Hand

Joined: Dec 18, 2006
Posts: 224
Hi Objects,

I am having problem in the following case:

I am developing an application using servlet program.
In which, I need to connect with Database (Oracle)

I have tried with JDBC Type1 driver(JDBC-ODBC Bridge driver) to connect my servlet with Database with the help of DSN.

But it throws the following SQL exception at runtime:
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLDriverConnect(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcConnection.initialize(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcDriver.connect(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)

...

The same DSN is tested with local java program(having main method) whic is working fine.

I would like to know,whether JDBC-ODBC brigde driver is supported with Oracle database through Servlet programming?

If yes the how?

If not,then I think we have to use other types of driver(2,3,4).Right?

Please suggest...


Thank you.

Regards
Baseet Ahmed

"God has made every living thing from water."
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41057
    
  43
Did you set up the DSN as a user DSN or as a system DSN?

Generally, the JDBC/ODBC brodge should not be used in multi-threaded environments (like a servlet container) - it is not threadsafe.


Ping & DNS - my free Android networking tools app
sruthi das
Ranch Hand

Joined: Dec 28, 2007
Posts: 34
did you import classe12.jar file.Its in oracle lib folder
Jignesh Patel
Ranch Hand

Joined: Nov 03, 2001
Posts: 626

Originally posted by Baseet Ahmed:
Hi Objects,

I am developing an application using servlet program.
In which, I need to connect with Database (Oracle)
[/b]


You don't need jdbc/odbc driver for connecting with Oracle. As mentioned in previous post you need oracle12.jar.
Baseet Ahmed
Ranch Hand

Joined: Dec 18, 2006
Posts: 224
Ulf/Sruthi/Jignesh
Thank you for reply.

For Ulf:
I had tried with User DSN,will check with system dsn.
Normally we used Oracle's driver(type3 or 4)
This I was doing for checking whether it works or not.

For Sruthi:
I think, in case of bridge driver, this classe12.jar file is not required, as also mentioned by Jignesh.

For Jignesh:
Thank you for the same.

Thank you once again to all.

Regards
Baseet Ahmed

"God has made every living thing from water." --Holy Quran
Baseet Ahmed
Ranch Hand

Joined: Dec 18, 2006
Posts: 224
Ulf Dittmer,

Thank you very much.
As I am able to run servlets having JDBC Database connection using DSN.
This time,have used the System DSN as mentioned by you.


Can you tell me why is this so that, it was not working with User DSN but works with System DSN.

Anyways,Concern person can close this Post.

Thank you

Regards
Baseet Ahmed

Request to ALL:
"Do worship The Creator,not the creation."
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt on Servlet having database connection?
 
Similar Threads
[Microsoft][ODBC Driver Manager] Invalid string or buffer length exception for 64 bit SQL Server
can i connect to MS sql server without creating a dsn
java.sql.SQLException: No suitable driver
JdbcOdbc Connection
URL error (DSN not found)