servlet Database connection problem

servlet Database connection problem

Post by Vincent Daun » Sat, 18 Dec 1999 04:00:00



Hello,

I have written a simple Java application that retreives data from a MS
Access97 database
and it works ok.
When I try to do the same in a Servlet, the following exception occurs :

"[Microsoft][ODBC Driver Manager] Data source name not found and no
default driver specified"
The ODBC configuration seems to be ok as it works for a standalone Java
application.
I am using Resin1.1 for the servlet engine.

Anybody experienced the same problem ?
Thanks in advance.

here is the code  :

-----   Database database1 = new Database();
-----   QueryDataSet qDataSet = new QueryDataSet();

-----   database1.setConnection(new
com.borland.dx.sql.dataset.ConnectionDescriptor("jdbc:odbc:DBMyBase",
"", "", false, -----   "sun.jdbc.odbc.JdbcOdbcDriver"));

-----   qDataSet.setQuery(new
com.borland.dx.sql.dataset.QueryDescriptor(database1, "select name,
firtname, passwd from list", -----   null, true, Load.ALL));

-----   qDataSet.executeQuery();
-----   String rty = new String(qDataSet.getString(1));
-----   System.out.println("Result : " + rty);

Vincent Dauny

 
 
 

servlet Database connection problem

Post by Geert Van Damm » Sat, 18 Dec 1999 04:00:00


You might try to define the ODBC profile as a System profile rather than a
(default) user profile.

Geert 'Darling' Van Damme


>Hello,

>I have written a simple Java application that retreives data from a MS
>Access97 database
>and it works ok.
>When I try to do the same in a Servlet, the following exception occurs :

>"[Microsoft][ODBC Driver Manager] Data source name not found and no
>default driver specified"
>The ODBC configuration seems to be ok as it works for a standalone Java
>application.
>I am using Resin1.1 for the servlet engine.

>Anybody experienced the same problem ?
>Thanks in advance.

>here is the code  :

>-----   Database database1 = new Database();
>-----   QueryDataSet qDataSet = new QueryDataSet();

>-----   database1.setConnection(new
>com.borland.dx.sql.dataset.ConnectionDescriptor("jdbc:odbc:DBMyBase",
>"", "", false, -----   "sun.jdbc.odbc.JdbcOdbcDriver"));

>-----   qDataSet.setQuery(new
>com.borland.dx.sql.dataset.QueryDescriptor(database1, "select name,
>firtname, passwd from list", -----   null, true, Load.ALL));

>-----   qDataSet.executeQuery();
>-----   String rty = new String(qDataSet.getString(1));
>-----   System.out.println("Result : " + rty);

>Vincent Dauny


 
 
 

servlet Database connection problem

Post by Vincent Daun » Sat, 18 Dec 1999 04:00:00


I've already tried both System and User but it doesn't work.
Quote:> You might try to define the ODBC profile as a System profile rather than a
> (default) user profile.

> Geert 'Darling' Van Damme