Hi Gary,

Here is a sample code which works: (You can see the explanations in the
comments)

String url = "jdbc:odbc:bdt";  // bdt is the User DSN name
Connection con = null;
    try {
      // Load (and therefore register) the ODBC Driver
      Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
      // Get the connection
// you should define the ADMIN and Password for the DSN
 // using ODBC Manager

        con = DriverManager.getConnection(url, "admin", "");


      Statement stmt = con.createStatement();
      String myquery = "SELECT Ana_Kategori.ana_kategori,
Ana_Kategori.ana_kategori_eng FROM Ana_Kategori ORDER BY
Ana_Kategori.ana_kategori";

        ResultSet rs = stmt.executeQuery(myquery);
// if no problem and you have something in your database you get a resultset

ugur serkan

----- Original Message -----
From: Formanek Gary L <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: 23 Haziran 1999 Çarşamba 20:45
Subject: MS Access 97 access from servlet? Can it be done?


> Can it be done? I'm trying to select in my servlet from MS Access 97 DB. I
> have the odbc dsn defined as a system datasource, but I'm getting the
> following error when I run on the server trying to access MS Access 97 DB:
>
> Wed Jun 23 11:35:14 CDT 1999: MSAccessServlet: *** SQLException caught ***
> Wed Jun 23 11:35:14 CDT 1999: MSAccessServlet: SQLState: S1000
> Wed Jun 23 11:35:14 CDT 1999: MSAccessServlet: Message:  [Microsoft][ODBC
> Microsoft Access 97 Driver]General error Failed to get the expression
> service
> Wed Jun 23 11:35:14 CDT 1999: MSAccessServlet: Vendor:   51
> Wed Jun 23 11:35:14 CDT 1999: MSAccessServlet:
> Wed Jun 23 11:35:14 CDT 1999: MSAccessServlet: SQLState: S1000
> Wed Jun 23 11:35:14 CDT 1999: MSAccessServlet: Message:  [Microsoft][ODBC
> Microsoft Access 97 Driver]General error The specified resource name can
not
> be found in the image file.
> Wed Jun 23 11:35:14 CDT 1999: MSAccessServlet: Vendor:   51
> Wed Jun 23 11:35:14 CDT 1999: MSAccessServlet:
>
> It works fine locally. I'm using the jdbc-odbc driver and it appears to be
> happening on the following line:
>
> Connection con = DriverManager.getConnection(url);
>
> This is in my servlet. Does anyone have an example of the url to use?
>
> Any ideas would be appreciated.
>
> Thanks,
>
> Gary
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to