File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Doubt on Servlet having database connection?

 
Baseet Ahmed
Ranch Hand
Posts: 225
Java Notepad Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
sruthi das
Ranch Hand
Posts: 34
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
did you import classe12.jar file.Its in oracle lib folder
 
Jignesh Patel
Ranch Hand
Posts: 626
Mac
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 225
Java Notepad Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 225
Java Notepad Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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."
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic