• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 250
  • Last Modified:

Inserting data into a remote SQL 2000 database

Hi experts,

I am looking for a good reccomendation here as opposed to an answer.

I need to insert data into a remote SQL server and I am a little unsure of how fast a connection there will be between the application and the SQL server. Is there any sort of reccomended / proven means to insert data in a situation like this where the SQL server is not installed in the local environment.

Thanks
D
0
davidnaude
Asked:
davidnaude
  • 3
  • 2
1 Solution
 
Giant2Commented:
Using JDBC for the programmer is not visible (he/she doesn't care of this) where the Database is.
For increasing speed you can use prepared statement. In this manner the instruction is precompiled. It is good if you are doing many similar query differ only about the data inserted and not with the structure.
So, download and use the JDBC driver for your particular SQLServer and use prepared statement.
http://java.sun.com/j2se/1.4.2/docs/api/java/sql/PreparedStatement.html
http://www.javaworld.com/javaworld/jw-01-2002/jw-0125-overpower.html

Hope this could help you.
Bye Giant.
0
 
nigelsheldonCommented:
Absolutely JDBC removes the complexity of connecting to a database, the speed of your query can be optimized in many ways, but the reall problem is the architecture of your application/database.If you are unsure of the type and speed of the connection that your application has to the remote database. And also the security access to the database then you will have to work around it some how.

I'd suggest that you write a servlet that will be running in the same lan/wan space as the database and  have this intermediate layer connect to that database for you. Yes there is more overhead associated with having another layer to your app; but you may not have any luck in convincing a DBA to open up their database for remote access.

If you are not in a secure LAN/WAN network of some sort, I would strongly recommend that you not open up the database for access over the internet.

Nigel
0
 
Giant2Commented:
>I'd suggest that you write a servlet
In this manner you must have an ApplicationServer/WebServer.
If the program not run on the Internet it's sufficient use the normal and basic JDBC connection.
0
 
nigelsheldonCommented:
You could possibly increase your connection timeout to cater for a slow network response. Keep in mind that the database may allow only a certain amount of connections at any one point in time which could delay threads from receiving available connections.
0
 
Giant2Commented:
Sorry for not help you.
0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now