Try freetds jdbc driver... http://www.freetds.org

But, how can I configure some Strings to VARCHAR(25) and others to
VARCHAR(100) in the ejb-jar.xml???

I have found no response to this question...

Edson Richter


----- Original Message -----
From: Victor A. Salaman <[EMAIL PROTECTED]>
To: Orion-Interest <[EMAIL PROTECTED]>
Sent: Wednesday, February 14, 2001 3:52 PM
Subject: RE: VARCHAR values are always the length of the field


> I have some thoughts... don't be cheap and get rid of that piece of crap
> ODBC-JDBC bridge... buy a real jdbc driver.
>
> - peace -
> Victor!
>
> -----Original Message-----
> From: Michael S. Kelly [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, February 14, 2001 2:34 PM
> To: Orion-Interest
> Subject: VARCHAR values are always the length of the field
>
>
> Here's the problem, when I get a datasource like this:
>
>       // Error trapping removed for clarity.
>       Context initCtx = null;
>       initCtx = new InitialContext();
>
>       String dsName = "jdbc/MSSQLTimecardDS";
>       DataSource ds = initCtx.lookup(dsName);
>
> and use it to return a ResultSet containing a VARCHAR field, the getString
> method always returns a String containing spaces filling out the String to
> the entire lengthe of the VARCHAR field, i.e. if I have a VARCHAR(50)
field
> I get a String 50 characters long regardless of how much text is actually
> stored in the field.
>
> This does not happen when using a CMP to access the same table and does
not
> happen when I create a Connection using a DriverManager instead of a
> DataSource.
>
> I'm using the ODBC-JDBC bridge against SQL Server.  Here's my DataSource
> definition:
>
>   <data-source
>      name="MSSQLServerTimecard"
>      location="jdbc/MSSQLCoreTimecardDS"
>      xa-location="jdbc/xa/MSSQLXATimecardDS"
>      ejb-location="jdbc/MSSQLTimecardDS"
>      connection-driver="sun.jdbc.odbc.JdbcOdbcDriver"
>      url="jdbc:odbc:Timecard"
>      username="sa"
>      password=""
>      inactivity-timeout="30"
>      class="com.evermind.sql.DriverManagerDataSource"
>   />
>
> and my database-schema mappings:
>
> <database-schema name="Microsoft SQL Server" not-null="not null" null=""
> primary-key="primary key">
> <type-mapping type="java.lang.String" name="varchar (50)" />
> <type-mapping type="float" name="float" />
> <type-mapping type="double" name="float" />
> <type-mapping type="byte" name="smallint" />
> <type-mapping type="char" name="char" />
> <type-mapping type="short" name="int" />
> <type-mapping type="boolean" name="bit" />
> <type-mapping type="long" name="int" />
> <type-mapping type="java.io.Serializable" name="varbinary" />
> <type-mapping type="java.sql.Timestamp" name="datetime" />
>
> <disallowed-field name="password" />
> <disallowed-field name="username" />
> <disallowed-field name="date" />
> <disallowed-field name="text" />
> </database-schema>
>
> I've tried changing the mapping to String to "varchar" (leaving out size
> parameter), but this didn't help.  Any thoughts?
>
> -=michael=-
>
> ======================================================================
>  Michael S. Kelly                           ____       _
>  Axian, Inc.                                 // |_  __(_) ___  _ __
>  4800 SW Griffith Dr., Ste. 202             file://| |\\/ /| |/ _ \| '_ \
>  Beaverton, OR  97005 USA             _____//_| | / / | | |_| | | | |
>  Voice: (503)644-6106 x122           ((   //  |_|/_/\\|_|\_/|_|_| |_|
>  Fax:   (503)643-8425                 ``-''          ``-''
>  http://www2.axian.com               Software Consulting and Training
>  mailto:[EMAIL PROTECTED]           <Enterprise and Internet Group>
> ======================================================================
>
>
>
>


Reply via email to