mssql data types vs JAVA data types

mssql data types vs JAVA data types

Post by sapst.. » Fri, 12 May 2000 04:00:00



We are calling a storedprocedure from a java service with five
parameters. Four java fields are char and one field is double integer.
What data type should we use in the  MSSQL table for this column?

Also is there any cross reference for data type compatibility between
mssql and java.

Any help would be appreciated.

Thanks.
steve

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

mssql data types vs JAVA data types

Post by John Steel » Tue, 16 May 2000 04:00:00


Steve,
    Is a double integer a 32-bit integer?  If so, use an int field.  If
it is larger, consider using a decimal field with a 0 scale.

HTH,
John Steely
DaVinci TWG, Inc.


> We are calling a storedprocedure from a java service with five
> parameters. Four java fields are char and one field is double integer.
> What data type should we use in the  MSSQL table for this column?

> Also is there any cross reference for data type compatibility between
> mssql and java.

> Any help would be appreciated.

> Thanks.
> steve

> Sent via Deja.com http://www.deja.com/
> Before you buy.


 
 
 

mssql data types vs JAVA data types

Post by cer.. » Wed, 24 May 2000 04:00:00


Steve,

I am glad I found your posting.  I could not answer your questions, but
instead I would like to seek your help.  I was trying to call MSSQL
storedprocedure from java without any success.  I was using sun's JDBC
driver and sun's jVM on Windows platform.  It works fine with regular
sql statement, but it fails when I changed to call the stored
procedures.  Would you share your thoughts, or better, some working
snippets with me?  Or is there anything wrong with my code:

public class SomeServlet extends HttpServlet {
    Connection conn = null;
    CallableStatement cs = null;

    public void doGet(HttpServletRequest request,
                      HttpServletResponse response)
        throws IOException, ServletException
    {
       ...
       try       {
         Class.forName( "sun.jdbc.odbc.JdbcOdbcDriver" );
       }
       catch (ClassNotFoundException cnfEX)       {}

       try       {
           String url = "jdbc:odbc:TengDev";
           conn = DriverManager.getConnection(url, "admin", "password");
       }
       catch( Exception e ) {}

        try
        {
        DatabaseMetaData meta = conn.getMetaData ();
        // I made sure SQL server supports stored procedures
        if ( meta.supportsStoredProcedures ())  {
           // the prepareCall and registerOutput are fine also
           cs = conn.prepareCall ("{call GetControlInfo(?,?)}");
           cs.registerOutParameter(1,java.sql.Types.INTEGER);
           ...
        }
         }
         catch( SQLException sqlEX )
         {
        ... some logging code
         }

         try {
           // it always fails here:
           if ( cs != null )
             cs.execute ();
         }
         catch( SQLException sqlEX )
         {
            ... exception is caught here, which indicates it is an SQL
exception
         }
         catch( Exception e)
         {
            ... some logging here
         };

Quote:}

Thanks in advance

Teng



> We are calling a storedprocedure from a java service with five
> parameters. Four java fields are char and one field is double integer.
> What data type should we use in the  MSSQL table for this column?

> Also is there any cross reference for data type compatibility between
> mssql and java.

> Any help would be appreciated.

> Thanks.
> steve

> Sent via Deja.com http://www.deja.com/
> Before you buy.

Sent via Deja.com http://www.deja.com/
Before you buy.
 
 
 

1. mssql data types vs JAVA data types

   We are calling a storedprocedure from a java service with five
parameters. Four java fields are char and one field is double integer.
What data type should we use in the  MSSQL table for this column?

Also is there any cross reference for data type compatibility between
mssql and java.

Any help would be appreciated.

Thanks.
steve

Sent via Deja.com http://www.deja.com/
Before you buy.

2. Authentication service failed to initialize

3. How to map Oracle data types to java data types

4. Writing portable SQL

5. sql data type vs vb data type

6. Questions on RI spec (poss. bugs)

7. Data Transfer from Long data type to SQL Server Text data type column

8. Limit profiler to a database

9. conversion of ODBC SQL data types to ODBC C data types

10. Converting OLEDB data types to VC++ data types

11. Mapping SQL Server Data Types and ADO Data Type Enums

12. Data Type SQL Server7.0 need a non decimal 1 E 19 data type

13. Disallowed implicit conversion from data type nvarchar to data type money