开发者

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 s开发者_开发百科erver 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.


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.


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜