Hi,
In your documentation, you mention that for remote access to an MS access database, you specify:
"jdbc:access://domain.com:3099/c:/data" if one AccessServer is run on the 3099 port of domain.com
However, I don't understand what an "AccessServer" is. Where do I find your "AccessServer", and how do I configure the port that it is listening on?
Thanks,
|
I finally found JavaService.exe on the web (the link on your site no longer works), and launched the JavaService on my server (192.168.1.1) with the following command:
JavaService.exe -install HXTTService "C:\Program Files\Java\jre1.5.0_06\bin\client\jvm.dll" -Djava.class.path=c:\temp\hxtt\access_jdbc30.jar -Dhxtt.urlconfig=c:/temp/hxtt/urlconfig.properties -Dhxtt.daemonport=3099 -Xms16M -Xmx256M -start com.hxtt.sql.admin.HxttService -stop com.hxtt.sql.admin.HxttService -method stop -out c:\temp\hxtt\out.log -err c:\temp\hxtt\err.log -manual -startup 6
Furthermore the urlconfig.properties files shows the following:
MVA_log=false
MVA_autorun=false
MVA=jdbc\:access\:/c\:/temp/mva/randomization.mdb
The service starts up, and the log file says that the service is running.
However, when I try to connect from my workstation, I am unable to connection. I am trying to connect using the DBAdmin:
java -jar Access_JDBC30.jar com.hxtt.sql.admin.Admin
Then in the admin panel, I try to connect to:
jdbc:access://192.168.1.1:3099/c:/temp/mva
but get the following error:
java.sql.SQLException: java.net.BindException: Cannot assign requested address: JVM_Bind
at java.net.PlainSocketImpl.socketBind(Native Method)
at java.net.PlainSocketImpl.bind(Unknown Source)
at java.net.ServerSocket.bind(Unknown Source)
....
I've also tried:
jdbc:access://192.168.1.1:3099/c:/temp/mva/randomization.mdb
but get the same error.
Can you point out what I need to do to successfully connect from my workstation please? I've tried to telnet to 192.168.1.1 port 3099 from my workstation to make sure the connection was active and I am able to connect. So the problem is something with the jdbc connection.
Thanks,
Eric
|
>However, when I try to connect from my workstation, I am unable to connection.
> I am trying to connect using the DBAdmin:
>java -jar Access_JDBC30.jar com.hxtt.sql.admin.Admin
>Then in the admin panel, I try to connect to:
>jdbc:access://192.168.1.1:3099/c:/temp/mva
>but get the following error:
>java.sql.SQLException: java.net.BindException: Cannot assign requested
> address: JVM_Bind
DBAdmin should not be used as client program, and is used to start AccessServer. Because your workstation hasn't such a an IP 192.168.1.1, and it should failed. You need only to use that "jdbc:access://192.168.1.1:3099/c:/temp/mva" url in your client program, then you can access those remote database.
|
I wrote a simple client program to show how to test at your workstation.
import java.awt.*;
import java.sql.*;
import java.util.*;
import java.awt.event.*;
public class testApplication extends Frame implements KeyListener,MouseListener{
static
{
try
{
Class.forName("com.hxtt.sql.access.AccessDriver").newInstance();
}
catch(Exception e)
{
e.printStackTrace();
System.out.println(e.getMessage());
}
}
Button connectButton=null;
TextField urlTextField =null;
TextField queryTextField =null;
TextArea resultSetTextArea =null;
Connection con=null;
public void init(){
GridBagConstraints constraints = new GridBagConstraints();
constraints.weightx=1.0;
constraints.weighty=0.0;
constraints.anchor = GridBagConstraints.CENTER;
constraints.fill = GridBagConstraints.NONE;
constraints.gridwidth = GridBagConstraints.REMAINDER;
GridBagLayout layout = new GridBagLayout();
setLayout(layout);
setFont(new Font("Ariel", Font.PLAIN, 14));
setBackground(Color.gray);
connectButton = new Button(" Connect ");
connectButton.addMouseListener(this);
layout.setConstraints(connectButton, constraints);
add(connectButton);
add(new Label("Enter URL(e.g., jdbc:access://192.168.1.1:3099/c:/temp/mva/randomization.mdb and jdbc:access://192.168.1.1:3099/c:/temp/mva) "));
urlTextField = new TextField(30);
urlTextField.setText("jdbc:access://192.168.1.1:3099/c:/temp/mva/randomization.mdb");
urlTextField.setEditable(true);
urlTextField.setBackground(Color.white);
layout.setConstraints(urlTextField, constraints);
add(urlTextField);
add(new Label("Enter SQL Query Statement:"));
queryTextField = new TextField(40);
queryTextField.setEditable(false);
queryTextField.setBackground(Color.white);
queryTextField.addKeyListener(this);
layout.setConstraints(queryTextField, constraints);
add(queryTextField);
Label resultLabel = new Label("Result");
resultLabel.setFont(new Font("Ariel", Font.PLAIN, 16));
resultLabel.setForeground(Color.white);
layout.setConstraints(resultLabel, constraints);
add(resultLabel);
constraints.weighty=1.0;
resultSetTextArea = new TextArea(20,120);
resultSetTextArea.setEditable(false);
layout.setConstraints(resultSetTextArea, constraints);
resultSetTextArea.setForeground(Color.blue);
resultSetTextArea.setBackground(Color.black);
add(resultSetTextArea);
setVisible(true);
}
public void keyPressed(KeyEvent ke)
{
try
{
Object target =ke.getSource();
if (target == queryTextField && ke.getKeyCode()==KeyEvent.VK_ENTER)
{
resultSetTextArea.setText(getResult(queryTextField.getText()));
}
}
catch( Exception e)
{
e.printStackTrace();
System.out.println(e.getMessage());
resultSetTextArea.setText(e.getMessage());
}
}
public void keyReleased(KeyEvent e)
{
}
public void keyTyped(KeyEvent e)
{
}
public void mouseClicked(MouseEvent me)
{
try
{
Object target =me.getSource();
if (target == connectButton)
{
if(con==null)
{
connectButton.setLabel("Connecting");
con = DriverManager.getConnection(urlTextField.getText(), "user","password");
queryTextField.setEditable(true);
connectButton.setLabel("Disconnect");
}
else
{
connectButton.setLabel("Connect");
con.close();
con=null;
queryTextField.setEditable(false);
}
}
}
catch (SQLException sqle) {
do {
System.out.println(sqle.getMessage());
System.out.println("Error Code:" + sqle.getErrorCode());
System.out.println("SQL State:" + sqle.getSQLState());
sqle.printStackTrace();
}
while ( (sqle = sqle.getNextException()) != null);
}
}
public void mousePressed(MouseEvent me)
{
}
public void mouseReleased(MouseEvent me)
{
}
public void mouseEntered(MouseEvent me)
{
}
public void mouseExited(MouseEvent me)
{
}
public String getResult(String sql)
{
try
{
StringBuffer strbuff=new StringBuffer(1000);
Statement stmt = con.createStatement();
stmt.setMaxRows(25);
if(sql.trim().toUpperCase().startsWith("SELECT")){
ResultSet rs = stmt.executeQuery(sql);
ResultSetMetaData resultSetMetaData = rs.getMetaData();
int iNumCols = resultSetMetaData.getColumnCount();
for (int i = 1; i <= iNumCols; i++) {
strbuff.append(resultSetMetaData.getColumnLabel(i));
strbuff.append("\n");
}
while (rs.next()) {
for (int i = 1; i <= iNumCols; i++)
strbuff.append(rs.getObject(i) + " ");
strbuff.append("\n");
}
}else{
strbuff.append(stmt.executeUpdate(sql));
}
stmt.close();
return strbuff.toString();
}
catch( Exception e)
{
e.printStackTrace();
System.out.println(e.getMessage());
return e.getMessage();
}
}
public void destroy()
{
if(con!=null)
{
try
{
con.close();
}
catch( Exception e)
{
e.printStackTrace();
System.out.println(e.getMessage());
}
}
}
private testApplication(){
super("A simple demo for Webstart");
resize(760,500);
init();
}
public boolean handleEvent(Event evt) {
if (evt.id == Event.WINDOW_DESTROY) {
destroy();
System.exit(0);
return true;
}
return super.handleEvent(evt);
}
public static void main(String argv[]) throws SQLException, Exception {
testApplication test=new testApplication();
}
}
|