Results 1 to 16 of 16
- 04-29-2010, 12:06 AM #1
Member
- Join Date
- Mar 2010
- Posts
- 41
- Rep Power
- 0
client javadb connection over internet
Hi All,
I have a program which connect to a local database. But now i need to do some modification to let it connect to a remote database over internet.
well, actually, this is the first time i will be getting connected to a remote database over internet. So i am also not sure what to do.. Could any of you tell me the needed steps to connect a remote database over internet? permissions, url address blah blah..
database i use : javadb
Thanks, if you need any other information, i will provide.. I am not asking for code, I have searched a lot thru google but nothing i could find.. i read some articles but i could not make myself clear..
Thanks again. :o
- 04-29-2010, 06:34 AM #2
Member
- Join Date
- Mar 2010
- Posts
- 41
- Rep Power
- 0
well, the first thing i did, i used one of the computers in my network to make sure that i can connect a remote database at least..
I got some error on that..
when i write the code like this:
I get this error : java.sql.SQLException: Database '/syazana/c/Data/Router' not found.Java Code:Class.forName("org.apache.derby.jdbc.ClientDriver"); con = DriverManager.getConnection("jdbc:derby:/syazana/c/Data/Router","mahmud","123456");
ok, when i write the code like this:
i get this error : Error connecting to server syazana on port 1527 with message Network is unreachable: connect.Java Code:Class.forName("org.apache.derby.jdbc.ClientDriver"); con = DriverManager.getConnection("jdbc:derby:[B]//[/B]syazana[B]//[/B]c/Data/Router","mahmud","123456");
but, when i type "\\Syazana\C\Data\Router" to the windows explorer address bar, i can go to the location..
Or do i have to upload it to internet first? i think i have some problems with the address of the database..
can anyone help me out?
- 04-29-2010, 09:51 AM #3
Member
- Join Date
- Mar 2010
- Posts
- 41
- Rep Power
- 0
is there anyone who can help?
thanks..
- 04-29-2010, 11:16 AM #4
Just go thru this below link which might be useful for you.
Apache Derby Database - TutorialRamya:cool:
- 04-29-2010, 11:19 AM #5
Member
- Join Date
- Mar 2010
- Posts
- 41
- Rep Power
- 0
finally someone.. :o
thanks, i will let you know when i am done reading it..
:)
- 04-30-2010, 11:26 AM #6
Member
- Join Date
- Mar 2010
- Posts
- 41
- Rep Power
- 0
hi :o
I got some problems..
1. in the article, there is a part called "Installation of Derby", (I copied here)
here I didnt get how to set the environment derby_home, I already installed it (when i started to my project) and i don't know how to change it now or is it really needed? it says "if you want to use derby in server mode" and i do want.Installation of Derby
Download the latest Derby version from the Apache website Apache Derby . Choose the bin distribution as it contains several helpful programs.
Extract this zip to a directory of your choice.
Derby allows to run in embedded mode or in server mode.
If you want to use the Derby tool or Derby in Server mode do also the following:
Set the environment variable DERBY_HOME to the Derby installation directory
Add DERBY_HOME/bin to the path environment variable
2. for the part 3, "server mode" it says if we want to change the listened port, just type "startNetworkServer -p port_number" ex: startNetworkServer -p 3301
but it doesnt work, even i type that, the response i get is
i just skipped evendo it doesnt work..Security manager installed using the Basic server security policy.
Apache Derby Network Server - 10.4.2.1 - (706043) started and ready to accept co
nnections on port 1527 at 2010-04-30 07:47:26.875 GMT
i configured my code by changing the
to:Java Code://con = DriverManager.getConnection("jdbc:derby:Data/Router","mahmud","123456");
i run the apache server like this "startNetworkServer" and it started with this message:Java Code://con = DriverManager.getConnection("jdbc:derby://192.168.1.102:1527/Data/Router","mahmud","123456");
instead of connecting over internet, i just want to connect to another pc in my network first. so i shared the database in folder "Data"Security manager installed using the Basic server security policy.
Apache Derby Network Server - 10.4.2.1 - (706043) started and ready to accept co
nnections on port 1527 at 2010-04-30 07:47:26.875 GMT
from another pc, i can access it with no problem when i type "\\OmerHalit\Route Finder\Data"
server ip : 192.168.1.102
default port : 1527
but there are some errors i got :
if my code is
i get thisJava Code://con = DriverManager.getConnection("jdbc:derby://192.168.1.102:1527/Data/Router","mahmud","123456");
I turned off kis2010 and windows firewall on server and other pc, it's still the same.java.net.ConnectException : Error connection to server 192.168.1.102 on port 1527 with message Connection refused: connect
--------------
if my code is
i get thisJava Code://con = DriverManager.getConnection("jdbc:derby://192.168.1.102:1178/Data/Router","mahmud","123456");
i checked the port between server and the other pc thru kaspersky -> network monitor, and i saw the it uses port 1178(external port) and (139 as local port)java.net.ConnectException : Error connection to server 192.168.1.102 on port 1178 with message Connection refused: connect
when i click login in other pc, in network monitor screen, the value of "bytes received" increases but it still says "connection refused" so i think they can connect to each other but something blocks and i dont know what, no firewall and no antivirus software is enabled..
when i tried port 139 this is the error i got :
and in the network monitor screen of kaspersky, bytes received and sent colums becomes 0(zero) byte and when i try port 1178, it establishes the connection again and received bytes increases..Insufficient data while reading from the network - expected a minimum of 6 bytes and received only 4 bytes. The connection has been terminated.
just to remind you that apache servers accepts from port 1527 only, even i typed the proper command to make it listen other ports..
These are everything i got so far, can you help me to find the problem? thanks..
- 04-30-2010, 11:35 AM #7
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
How to set it depends on your OS. e.g on Windows you could set it at the same place where you set your PATH variable.
That is not an error. Read that message. It's telling you that you have successfully started the DB and the port at which it's listening for connections.
That is a connection issue. First make sure you can ping that IP from your computer. If you can't then you have network issues that have nothing to do with databases. If you can, try to see if you can telnet into that port.
If you can't then you still have network issues.
Only after you can telnet that port should you try connecting with your Java code.
- 04-30-2010, 11:40 AM #8
Member
- Join Date
- Mar 2010
- Posts
- 41
- Rep Power
- 0
ok, i will try it now.. thanks
- 04-30-2010, 11:50 AM #9
Member
- Join Date
- Mar 2010
- Posts
- 41
- Rep Power
- 0
yes i can ping to the server (192.168.1.102)
byte = 32 / time = 1ms / TTL = 128
but i cannot connect thru telnet, i tried like this:
telnet 192.168.1.102 1527
but i can connect and see and copy bla bla using windows explorer.. so what do i need to do now? what possiblities are there that can block it connect?
- 04-30-2010, 12:00 PM #10
Member
- Join Date
- Mar 2010
- Posts
- 41
- Rep Power
- 0
wait a minute,
is there anything wrong with port 135? because i can connect via port 135 it hangs, i also can connect via port 139 but it disconnects after a while and i cant do anything while it is connected. i just see the ip address on top of the cmd window and i cant type anything, nothing appears but the cursor moves..
and each time i press any key, the connection indicator (Windows XP, near system time, two pc screen icon) blinks..
- 04-30-2010, 01:26 PM #11
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Don't woory about other ports. Worry about the port that your database is listening on.
If that port is 1527 then you need to make sure people can telnet to that port. You might need to get a network expert to help if you don't understand the output of those commands.
- 04-30-2010, 05:18 PM #12
Member
- Join Date
- Mar 2010
- Posts
- 41
- Rep Power
- 0
well, i will try to solve that problem,
but my target is not that actually, i have a java desktop application, i want it to connect to database over internet (not lan).. but there are some questions in my mind.. (this program will be used by many users, speed is not problem)
1. how do i need to put the database to internet? i just uploaded my folder to a free web hosting storage. I created a simple web page, an i uploaded it to the storage. It looks so nonsence to me actually, because i don't think the application can access it.
2. i feel, i have to spare one pc as my own server, run an ftp server application on the server, and ..? how to put restrictions and permissions..
and, does the apache server have to be running on the server? if yes, my first option is useless..
can you give me a way to follow??
thanks again..
- 05-25-2010, 12:26 PM #13
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,398
- Blog Entries
- 7
- Rep Power
- 17
I've seen you juggling with that URL over and over again, but it should simply be like this:
jdbc:derby://<your host>:1527/<your db>
The terms <your host> and <your db> translate to the host name of your server host (or its IP address) and <your db> should be the name of your database, not a complete path to a file that contains your JavaDB/Derby database.
Of course you should have JavaDB/Derby up and running on that host.
kind regards,
Jos
- 05-25-2010, 12:35 PM #14
Member
- Join Date
- Mar 2010
- Posts
- 41
- Rep Power
- 0
i tried many things, but it didn't work..
i run the derby server in my pc,
i tried to connect to my pc from another pc in my LAN. but it keep refusing the connection. I dont know why, i turned off everything, firewall, antiviruses.. but i couldnt get it done.
maybe i couldnt run the server properly..
i run the server from cmd but it didnt work, then i run it from netbeans platform.. nothing.. same problem occured.. connection refused..
Thanks.:o
- 05-25-2010, 01:25 PM #15
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,398
- Blog Entries
- 7
- Rep Power
- 17
- 05-26-2010, 11:27 AM #16
Member
- Join Date
- Mar 2010
- Posts
- 41
- Rep Power
- 0
it says this :
----------------------------------------------------------------
2010-05-24 19:13:48.828 GMT:
Booting Derby version The Apache Software Foundation - Apache Derby - 10.4.2.1 - (706043): instance a816c00e-0128-cbbc-3347-0000001907f8
on database directory D:\Projects\Java\ObjectOrientedProgramming\TravelR oute\Data\Router
Database Class Loader started - derby.database.classpath=''
is this what you asked for?
Thanks.
Similar Threads
-
Java client - proxy connection
By ragnonerodocet in forum NetworkingReplies: 0Last Post: 03-10-2010, 06:21 PM -
Java Client Needs Database Acces Over Internet
By etherkye in forum NetworkingReplies: 2Last Post: 07-01-2009, 10:44 AM -
Connection reset error in FTP client
By Waterbottle in forum NetworkingReplies: 0Last Post: 03-23-2009, 09:03 AM -
pc give internet connection to mobile
By dimitrist in forum New To JavaReplies: 0Last Post: 12-21-2008, 02:22 PM -
Client Internet Explorer Setting
By Mir in forum NetworkingReplies: 29Last Post: 06-26-2008, 12:01 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks