• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

JDBC over LAN  RSS feed

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone,

I am trying to access a databaste that is stored on a remote computer within my LAN network. So far I have assembled the following code:



If I try entering the IP address of the remote computer in conjunction with the database file path after "DBQ=", I get an error.

Can anyone help? Thanks in advance!
 
Ranch Hand
Posts: 1512
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure exactly with MS Access. However, in the case of MySQL, you just need to include the IP address of the remote machine and make sure the Database server is up and running.

For example: jdbc:mysql://IP Address/database Name
 
author
Posts: 23811
140
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If memory serves, Access is a file based database. If you want network sharing, the file will need to be placed on a shared folder.

Of course, this was a while ago. Haven't played with Access in a while.

Henry
 
Bartender
Posts: 2636
17
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Henry Wong wrote:If memory serves, Access is a file based database. If you want network sharing, the file will need to be placed on a shared folder.

Of course, this was a while ago. Haven't played with Access in a while.

Henry

This is correct. The OP will have to put the database in a shared location.
Then he will have to create an ODBC datasource that points to that location.

Since Access is a file database, the protocol to query the database (file access) is a heavy protocol that requires significant bandwidth. Better use a client/server database in that case (or to be honest: in any case)
 
Sheriff
Posts: 23876
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, IP address isn't good enough. This is MS Access, not some web-friendly software. You have to provide a file name after that "DBQ" thing. Mapping a drive would help, but possibly a UNC path name would work just as well.
 
Bosun Bello
Ranch Hand
Posts: 1512
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless you are just trying simple stuff out, you may want to look into a "real" database that is free, such as mySQL.

Philipe Breiding wrote:Hello everyone,

I am trying to access a databaste that is stored on a remote computer within my LAN network. So far I have assembled the following code:



If I try entering the IP address of the remote computer in conjunction with the database file path after "DBQ=", I get an error.

Can anyone help? Thanks in advance!

 
Philipe Breiding
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Heya, thanks for the replies.

I did a bit of research and often come across "DSN connections" in order to access the database via LAN. Does anyone know how to do this? I also attempted to write client/server socket-based classes which establish a connection on a specific port. I can connect the two computers, I'm just not too sure where to put the database commands. This is a school project, so no major code is required.
 
Henry Wong
author
Posts: 23811
140
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Philipe Breiding wrote:
I did a bit of research and often come across "DSN connections" in order to access the database via LAN. Does anyone know how to do this? I also attempted to write client/server socket-based classes which establish a connection on a specific port. I can connect the two computers, I'm just not too sure where to put the database commands. This is a school project, so no major code is required.



A "DSN connection" doesn't mean that it is a network connection -- it is merely a connection to the DB. If you want to have DB network support, you'll need a DB that supports it. With Access, it is a file based DB, so you'll need to use a shared folder for accessing a db on another machine.

As for DB that supports network access, there are tons of them, and they are all free -- even the commercial ones. MySQL was already mentioned. Postgres is also highly recommended. I have also used Ingres and hypersonic in the past -- which are okay. But best of all, for development projects, all the major manufacturers have free "express" versions (limited usage) -- Oracle, DB2 (IBM), SqlServer (Microsoft). Heck, Microsoft even has a developer's version for $50 -- which is a fully feature enterprise edition that is restricted to developer usage only.

Henry
 
Henry Wong
author
Posts: 23811
140
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops, didn't answer your question...

I also attempted to write client/server socket-based classes which establish a connection on a specific port. I can connect the two computers, I'm just not too sure where to put the database commands.



Doing what you are doing -- using JDBC is a good way to go. You just need to install a DB that does what you want.

With JDBC, once you have a connection to the database, you can create statements and execute queries.

Henry
 
Philipe Breiding
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks so much, really cleared things up. Unfortunately, we HAVE to use MS access, so my only option would be to place it into a shared folder and enter the IP address of the remote computer where it says DBQ= right? I would really prefer to use the previously mentioned client/server classes as that would result in more marks for originality do you think it would be possible to do this?

Regards
 
Henry Wong
author
Posts: 23811
140
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Philipe Breiding wrote:Unfortunately, we HAVE to use MS access, so my only option would be to place it into a shared folder and enter the IP address of the remote computer where it says DBQ= right?



No. Once the file is on the shared folder, you just need to specify the file -- just like you would have to do it, if it wasn't on the shared folder... And BTW, don't guess, google for instructions on configuring JDBC for access.

Philipe Breiding wrote:I would really prefer to use the previously mentioned client/server classes as that would result in more marks for originality do you think it would be possible to do this?



You do know that technically this isn't client / server, as there isn't a DB server, right? All you are doing is configuring JDBC to bridge over to ODBC to load the windows access libraries that parses a MDB file.

Henry
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!