cancel
Showing results for 
Search instead for 
Did you mean: 

JDBC-ODBC Adapter problem

Former Member
0 Kudos

Hi to all,

I have a problem in order to create CC type JMS to connect my scenario with MS access.

This is the configuration of sender CC:

JDBC Driver: sun.jdbc.odbc.JdbcOdbcDriver

Connection: jdbc:odbc:<DNS Name>

.... and this is the error:

Sender Adapter v2108 for Party '', Service 'BS_APS':

Configured at 2005-12-07 15:30:04 CET

History:

- 2005-12-07 15:37:50 CET: Retry interval started. Length: 5,000 s

- 2005-12-07 15:37:50 CET: Error: Accessing database connection

'jdbc:odbc:XI' failed: java.sql.SQLException: [Microsoft][ODBC Microsoft

Access Driver] Disk or network error.

- 2005-12-07 15:37:50 CET: Processing started

- 2005-12-07 15:37:45 CET: Error: Accessing database connection

'jdbc:odbc:XI' failed: java.sql.SQLException: [Microsoft][ODBC Microsoft

Access Driver] Disk or network error.

- 2005-12-07 15:37:45 CET: Processing started

The MS access database is in XI Server directory.

Thanks in advance,

Michele.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi

Michele

your Driver specification(jdbc.odbc.JdbcOdbcDriver) is correct.

Just change the Connection parameter as follows:

Connection: jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)}; DBQ=c:\path\to\database.mdb.

I hope it will work for you

if it gives error then try for

DBQ=//<xiserver>/.....

So its other way out to access the database.

it will resolve your issue.

cheers

Regards

Piyush

Former Member
0 Kudos

Hi

Michele

for more detailon DSN vs DSN less connection,

you will find on the following link

http://www.stardeveloper.com/articles/display.html?article=2000120101&page=1

so carry on

Regards

Piyush

Former Member
0 Kudos

Hi to all,

now I have try the following code and the call to database.mdb work fine but if I call the database.mdb via JDBC adapter the error is the same.

Any Idea????

**************************JAVA CODE *********************

mport java.sql.*;

/**

  • @author Michele

*

  • To change the template for this generated type comment go to

  • Window>Preferences>Java>Code Generation>Code and Comments

*/

public class JDBCapp {

static Connection theConn;

public static void main (String args[]) {

try {

// connection to an ACCESS MDB

theConn = MyConnection.getConnection();

ResultSet rs;

Statement stmt;

String sql;

sql = "select * from Rifornimenti";

stmt = theConn.createStatement();

rs = stmt.executeQuery(sql);

while (rs.next()) {

System.out.println(rs.getString("ID"));

}

rs.close();

stmt.close();

}

catch (Exception e) {

e.printStackTrace();

}

finally {

try {

if (theConn != null) theConn.close();

}

catch (Exception e) {

}

}

}

}

**************************JAVA CODE *********************

import java.net.URL;

import java.sql.*;

/**

  • @author Michele

*

  • To change the template for this generated type comment go to

  • Window>Preferences>Java>Code Generation>Code and Comments

*/

public class MyConnection {

public static Connection getConnection() throws Exception {

Driver d = (Driver)Class.forName

("sun.jdbc.odbc.JdbcOdbcDriver").newInstance();

Connection c = DriverManager.getConnection

("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=//netsap19/temp/XI.mdb");

return c;

/*

To use an already defined ODBC Datasource :

String URL = "jdbc:odbc:myDSN";

Connection c = DriverManager.getConnection(URL, "user", "pwd");

*/

}

}

**************************JAVA CODE *********************

Thanks in advance,

Michele.

Former Member
0 Kudos

Hi,

You can access MS access Database without DSN name. check this weblog.

<a href="/people/sameer.shadab/blog/2005/10/24/connecting-to-ms-access-using-receiver-jdbc-adapter-without-dsn:///people/sameer.shadab/blog/2005/10/24/connecting-to-ms-access-using-receiver-jdbc-adapter-without-dsn

Regards,

Sudharshan