jQuery in Action, 2nd edition*
The moose likes JDBC and the fly likes jsp database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "jsp database" Watch "jsp database" New topic
Author

jsp database

Jack Bolton
Ranch Hand

Joined: May 08, 2006
Posts: 65
Hi, I have this simple program to access a database in Microsoft SQL Server 2000, the database that i am trying to access is Northwind.
But, when i execute the .jsp i get this error:

java.sql.SQLException: [Microsoft] database not found and no driver was 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)
at desisoft_jsp_ch16_01_jsp1179415463593._jspService(desisoft_jsp_ch16_01_jsp1179415463593.java:52)
at desisoft.server.JspBaseClass.service(JspBaseClass.java:48)
at desisoft.server.servlets.Servlet.service(Servlet.java:86)

what am I doing wrong?
thanks for any response...

the code:
ch16_01.jsp
Herman Schelti
Ranch Hand

Joined: Jul 17, 2006
Posts: 387
hi Jack,

did you configure an ODBC connection for "Northwind" ?

Herman
Jason Kwok
Ranch Hand

Joined: Mar 31, 2005
Posts: 126
Your code is missing a declaration for a driver. For instance, in MySQL I would use:

Class.forName( "com.mysql.jdbc.Driver" ).newInstance();

I'm not sure what you would put for SQL Server, but I'm sure you could google that answer quite easily.

In addition to that, you will have to create a path to your database. In windows, you'll have to go to your control panel, then ODBC Settings and then create a new data source.
[ May 18, 2007: Message edited by: Jason Kwok ]
Herman Schelti
Ranch Hand

Joined: Jul 17, 2006
Posts: 387
hi Jason,

I think Jack did what you call "declarare a driver", right?
<% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); %>

Herman
Jason Kwok
Ranch Hand

Joined: Mar 31, 2005
Posts: 126
Hey Herman,

You're right, I must've missed that. Nice catch!

Jason
Jack Bolton
Ranch Hand

Joined: May 08, 2006
Posts: 65
I had to add the Northwind database in the ODBC Settings,
that's the one that was missing.

thanks guys...
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jsp database