gsb
gsb

Reputation: 5640

Insert in Microsoft SQL using JDBC

I have some data coming from a machine in the following format: A (some value) B (some value) C (some value) and so on.

I have a database in the Microsoft SQL server 2008 with the columns named A, B, C and so on.

I have downloaded the jdbc drivers for the MS SQL server 2008 and included in my classpath.

I want to insert the values of A, B, C, etc in SQL when i receive it over from a different machine(port). Basically i have to design a server in Java which listens to that port for the values and when it receives the values, it inserts it into the MS SQL database.

Can someone help me code the above in Java? I am new to Java, hence finding it a bit difficult.

Thank you.

Upvotes: 0

Views: 1166

Answers (2)

duffymo
duffymo

Reputation: 308988

Start with the JDBC tutorial:

http://download.oracle.com/javase/tutorial/jdbc/

It should sort you out.

Microsoft also has examples specific to SQL Server here:

http://support.microsoft.com/kb/313100

That takes care of the database side. When you say "server", I'll assume that you want a web based server that's listening on a port for HTTP requests. You'll need a servlet running in a servlet/JSP engine like Tomcat.

Write an interface-based object that handles your database work; thoroughly test it and put it aside. Then write a servlet that calls that object after validating and binding input values.

Upvotes: 1

KV Prajapati
KV Prajapati

Reputation: 94653

Tutorials and articles on Microsoft JDBC driver for MSSQL server.

  1. Microsoft JDBC Driver for SQL Server
  2. Connecting to SQL Server with the JDBC Driver
  3. TO HOW: Start the Microsoft JDBC

Upvotes: 0

Related Questions