SQLserver 3 « SQLserver « Java Database Q&A





1. SQL Server and real data type    coderanch.com

[B]8.3.8 REAL[/B] The JDBC type REAL represents a "single precision" floating point number that supports seven digits of mantissa. The corresponding SQL type REAL is defined in SQL-92 and is widely, though not universally, supported by the major databases. The SQL-92 standard leaves the precision of REAL up to the implementation, but in practice all the major databases supporting REAL support ...

3. MS SQL -- JDBC -- Memory Spike -- HELP!    coderanch.com

Here is the overview of the problem. We are using WAS5.1, MS SQL with the SP3 JDBC drivers (though we were having the same problem with SP1 and SP2). When testing our web application and running transactions that make calls through the pooled Datasource to SQL that causes an increase in SQL memory usuage. Which to a certain degree in understandable. ...

4. SQL Server with a Select * stored proc    coderanch.com

I have a select * stored proc that I need to access from a jsp page. I am having difficulty setting up the output params and could use a little help. I dont get an error, but I do not get any data either. Is there something wrong with my prepare or the registerOuts? Table: CREATE TABLE [dbo].[tblUsers] ( [password] [varchar] ...

5. JDBC & SQLServer    coderanch.com

6. sql server callable statement result set issue..    coderanch.com

Hi,. i have the following code which is calling a stored procedure in sql server database... this procedure takes 2 parameters and outputs a set of records with one column of type varchar.... i'm unable to get the result ......... its returning 0 records......when calling from the program, if i run the procedure in sql server, its working fine... please let ...

7. JDBC configuration to SQL Server    coderanch.com

8. MSSQL Login Using NT User    coderanch.com

9. View of SQL Server getting locked in JDBC    coderanch.com

Hello all, I am using a JSP/JDBC which is having a select statement. The query refers to a VIEW created based on a join between 2 tables. The JSP page displays the records which are fetched as a result of the query executed on the VIEW. Problem faced : The VIEW gets locked and the JSP page doesnt display any records. ...





11. ms sql question    coderanch.com

We have a satelite tracking program through our cell phone company that produces a dat file containing all unit locations. The only description on the file was I was given was that it used ms sql. So I'm assuming its not an sql server? Objects do get inserted into it, but I can't do it manually. Again, I don't really know ...

12. JDBC Connection to MS SQL with Windows Authentication    coderanch.com

Environment - I am using Tomcat as my servlet engine and IIS as the Server. Additionally, I am using MS SQL 2000 as my DB. The DB resides on a seperate machine, and have created an ODBC JDBC connection on the local machine to access it. Additionally, the authentication for the DB is set to "Windows Authentication". Problem - Everything works ...

13. Prolem in connection to Microsoft sql SErver    coderanch.com

Hi I have a very strange problem with SQLServer and Java Before I upgrade to Windows XP media Center edition , everything works correctly. Now i installed SQL server and other utils which i need . but none of them connect to sql server I changed the authentication to MIXED mode and add user to sql Server but when i try ...

14. How to retrieve partial data in SQL Server ?    coderanch.com

I am trying to display 4 columns of a particular table. The browser is displaying 50 records per page. 'Next' and 'Previous' buttons are there for navigating through all the records. It may have even 1 million or more records. The table may have n number of records. I am not getting any problem if the record size is approximately 50,000. ...

15. SQL Server performace    coderanch.com

Shawn, The first thing to do is figure out whether the problem is in the driver/network or the database/stored proc. You can do this with something as simple as print statements in the code and stored proc. When the app slows down, are multiple stored procs being run simultaneously? You may have contention and locks on the database causing the slowdown. ...

16. Different versions of SQL Server    coderanch.com

Hi, well i do not understand the order of different versions of MS SQL server. You have SQL server 7.0, 8.0 like .. and you have SQL Server 2000, 2005 like.. Does anybody have any idea on the order of these versions?? Is 8.0 before 2000?? I am curious. I am trying to access Sql Server, through JDBC driver, provided by ...





17. Pulling values from SQL Server    coderanch.com

Hello, I want to pull values from SQL Server to Oracle database frequently. How can I do this, the problem is I want to deploy the application in Sun Solaris server, so what kind of driver I need to use to deploy to Solaris server? Can I have a timer or some kind of mechanism to check and pull and update ...

18. SQL Server DSN - JdbcOdbcDriver    coderanch.com

Hi guys! I'm hoping you can steer me in the right direction on this. Here is a snip of the code I'm using to connect to a MS SQL database. public void Open() { try { // Load the jdbc-odbc bridge driver Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); // Attempt to connect to a driver. con = DriverManager.getConnection( strUrl, strUserName,strPassword ); //, // Create a Statement ...

19. DBCP -- connection string for SQL Server    coderanch.com

Thanks, Tom. But with DBCP, when dealing with oracle or mysql, I have userid and password passed in explicitly in the connection string. I don't know how to do the same with SQL Server. Any suggestions? Do I have to change my wrapper code for DBCP for SQL Server? Below is the code I wrote to wrap DBCP (pooled driver) used ...

20. auto-increament in ms sql server2000    coderanch.com

I want to create an auto-increament like thing in MS Sql Server2000 (which is possible with MySql). I am not sure whether that functionality is there in the SQL Server 2000. I think we use sequence in Oracle to do the same thing. The column will have nos generated automatically which otherwise would increament by themselves as the data is inserted ...

21. Read RelationShip from SQL Server    coderanch.com

Hi Everyone, Now, I want to write a program that generate source code, but I have a problem : I don't know how to read the Relationship between 2 tables in SQL Server. (know exactly 1-n, 1-1 or no relationship). Please help me to have a solution. Sorry for my poor English and Thanks a lot. Rock.

23. Tryin' to create a small MS SQL Java Application    coderanch.com

To compile the application the MS SQL JDBC driver files need to be in your projects build path. Look at the properties of the project in eclipse - it should become obvious if you have as poke around. When it comes to running the application, you will need to use a classpath statement as the docs suggest. If you want oto ...

24. Unusual characters written as ? in mssql server    coderanch.com

Hi, My users are submitting text via a jsp web form, and I write the text to an sql server database, column type text. Sometimes certain characters, which look like they should be apostrophes, are written to the db as the character '?'. (At least if I use Query Analyzer on the database, an SQL query returns text containing '?'. Perhaps ...

25. sql server problem or something else    coderanch.com

26. Connection pooling for Ms SQL    coderanch.com

27. MSSQL CallableStatement Issue    coderanch.com

Hello all so I have literly beat my head against a wall on this issue and been up all night. rundown: I am using a callablestatement to access a mssql db stored procedure through jdbc, (if you would like the driver info i can post l8tr). My code is simple but I keep getting the following error and I have tried ...

28. Data from SQL Server to MS Access    coderanch.com

Hi, I have to copy the content of several tables in a sql server database to tables (sometimes with the same structure, sometimes structure is different) in a ms access database. So i am wondering how you have to do such thing, because until now i just made a query, executed it on the appropriate database and handled the resultset so ...

29. MS SQL Query    coderanch.com

I want to invoke rows from a table in such a way that , suppose employeeAccess is my table i want to fetch all the records from employeeAccess table which satisfy the following criteria as if accessid = 1 then accessval = 'all' And if accessid = 2 then accessval = 'read' I don't want to make the condition either or. ...

32. SQL Server limiting result set    coderanch.com

I need to limit the result set coming from a SQL Server query. I can get the top 10 by SELECT TOP 10. But how do I get the rows from 11 to 20, for example? This is very easy in MySQL, but don't know the syntax for SQL server. Is this possible without stored procedures? Thanks.

34. Sql server keyword 'user'    coderanch.com

35. Help with SQLServer Timestamp    coderanch.com

36. JDBC and MSSQL trusted connection    coderanch.com

37. jdbc/odbc to sql server    coderanch.com

38. Read a Sql server trace file    coderanch.com

40. Lot of locks getting created in SQL Server    coderanch.com

Hello all, I have an application developed in jsp.Using SQL Server as the backend.But sometimes the application creates a lot of lock in the database, and due to this blocking my application srops working.I checked the database connection.Each function being called,opens the connection and also closses it after the process.Not able to trace the reason behind these DB blockings.Can anyone suggest ...

41. a q about SQL Server 2005 DB and Java    coderanch.com

i have an SE application that will be connecting to a SQL Server 2005 DB. At first a problem about the Driver arised when using Microsoft JDBC Driver( the problem was solved by enabling SQL Server Browser and enabling TCP/IP under Network Configuartion).the fix was inside SQL Server 2005 so does my user's need to install the whole SQL Server 2005 ...

42. IDE for Sql Server    coderanch.com

Any recommendations? Query Analyser I have found to be a primitive piece of rubbish. I've tried Squirrel-Sql, and although it supports nifty functions (like code complete, returning metadata and rowcounts) it has the annoying habit of endlessly writing to its heapdump logfile until I kill the process if it encounters errors / sql statements that generate large result sets. These errors ...

43. Unicode and MSSQL    coderanch.com

Yep. In my JSP (the one that post the chinese characters) I've got : <%@page pageEncoding="UTF-8"%> <% response.setContentType("text/html;charset=utf-8"); %> In my servlet (where the text is outputed) I've got : request.setCharacterEncoding(SITE_CHARSET); before retreiving the value of the field from the JSP. And I also have : response.setContentType("text/html; charset=" + SITE_CHARSET); But I'm able to display the chinese text that I just ...

44. connectionURL to SQL Server 2005    coderanch.com

Hello guys, I am having connectivity problems when I try to connect to SQL Server 2005. The following connection works for SQL Server 2000. driverName="com.microsoft.jdbc.sqlserver.SQLServerDriver" connectionURL="jdbc:sqlserver://localhost:1433;databaseName=pubs;SelectMethod=Cursor" When I change the sql server pointing to a SQL Server 2005, I am not able to get pass by the login page. I get the following error. 2007-03-02 13:32:17 JDBCRealm[/project]: Exception performing authentication java.sql.SQLException: ...

45. SQL Server 2005 Connectivity issues    coderanch.com

Good, progress! You need to work out why the connection is being refused. The most likely possibility is that SQL Server 2005, unlike 2000, doesn't have TCP/IP enabled out the box. So I'd start by making sure you have configured your server to accept TCP/IP traffic. [ March 19, 2007: Message edited by: Paul Sturrock ]

46. To Populate Bulk Records in SQL Server thru Java    coderanch.com

Hi all, Greetings, I have to populate bulk data into Microsoft SQL Server(around 20,000 records in a table). For each fields in the table, I have to increment/randomly generate to populate it in the SQL Server. Basically, I am from Java background, I thought of writing it in java to populate. Since I don't much aware of syntax of PL/SQL, I ...

47. XML data type in SQL Server 2005    coderanch.com

Hi, I have an xml column in a table. One of the stored procedures need to update the value in the xml column by appending few more nodes at the end of the existing value. E.g. declare @oldXML xml, @newXML xml SET @oldXML = ' ' SET @newXML = ' ' set @oldXML.modify ('insert ...

48. what kind of values we can put into timestamo field in sql server and how?    coderanch.com

No, this is not what SQL Server's timestamp data type is for. If you want to store a date or time in SQL Server, use datetime. timestamp is used only for versioning rows - it acually stores a binary value usually used to represent the time the row was modified. If you want to use this data type in a JDBC ...

51. Using SQL Server database with JDBC. Need Help.    coderanch.com

I'm an rookie with regards to using databases with JDBC. I downloaded the JDBC driver for Microsoft SQL Server and I was able to register the driver using this statement: try { Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver"); } catch (ClassNotFoundException e) { e.printStackTrace();} I don't get any errors with the above line but I'm unsure how to open up a database connection. I used Windows ...

52. Is it hard to use SQL Server with Java?    coderanch.com

I have used Oracle 9i and JDBC before and I know SQL well enough to run queries. I told a company that I know SQL Server figuring it can't be THAT much different then Oracle. But after doing research I found out Oracle supports Java much better. So I'm wondering if simply knowing SQL will be enough for the job. Are ...

53. Read Uncommitted in Sql Server    coderanch.com

Our application is using jtds driver and the database is MS Sql Server 2000. We are having 2 processes say ProcessA and ProcessB accessing a table Action1. The problem we are facing is it either deadlocks or time-outs the resources waiting. How do we programatically code the isolation level to query with an "Uncommitted Read"? What I am trying to find ...

54. Show Tables In MSSQL    coderanch.com

Hi friends. I am quite new to MSSQL as I have used MySQL intensively. But without whining much further, let me pour out my mind: // SNIP----------------------------------- try { Class.forName("net.sourceforge.jtds.jdbc.Driver"); Connection conn = DriverManager.getConnection("jdbc:jtds:sqlserver://" + server + ":" + port + "/" + database, user, password); System.out.println("connected"); Statement stmt = conn.createStatement(); ResultSet data = stmt.executeQuery("SELECT * FROM INFORMATION_SCHEMA.TABLES AS data WHERE ...

55. how to increase speed of application in weblogic8.1 and sqlserver2005    coderanch.com

You changed two things that can cause the issue at the same time. In essence, this means that you've changed the complete infrastructure. Makes it hard to see if it's caused by the application server or by mssqlserver. Try to find the cause for the performance drop: the database, the apps server, the way you've configured them, the network, is it ...

57. sql server question    coderanch.com

I am kinda new to tsql programming and trying to find a quickie from google and such for a solution. What I want is to get a list of tables and columns that contain a certain string. I actually want to replace all such occuranaces with some other string but here is how I started: Declare @tn varchar(100) Declare @cn varchar(100) ...

58. SQLServer to DB2(AS/400) export    coderanch.com

Ty, Welcome to JavaRanch! Any reason not to do a table export (to comma separated value format) and then a table import on the new database? If you need to do this with JDBC, you need to use two sets of connections/statements/resultsets so you can read a record/write a record (or batches of records) at the same time.

60. Using a Trigger to Calculate a Value (SQL Server)    coderanch.com

I'm working on a project (J2EE web app) in which I want to record a record to a database and, based on some of the fields in that record, the record is said to be either "compliant" or "not compliant". As it's based on the data in the record, this is essentially a calculated value, but it's not quite as simple ...

61. MS Sql server2000 connection problem    coderanch.com

Have you configured your SQL Server instance so you can connect to it? Namely: is it using SQL Server authentication (rather than Windows Integrated)? And have TCP/IP connections been enabled? Also, is there a firewall between you and it? Is the server listening on 1433? One more thing, why use the 2000 driver? Its bug-ridden and there are far better ones ...

62. Datasource for non-default instance of SQL Server    coderanch.com

Dear All, We are experiencing this situation now. On our database server, we are planning to create a non-default instance of the SQL Server Database. On our application server, we need to configure a datasource to point to this database, which will be looked up by the application code and used for connectivity. The information will look something like this. Datasource ...

63. SQL server weird connection problem-Pls help    coderanch.com

I m using SQL server 2005 express. My default logon mode setting is set to-SQL server authentication and I can logon to using SQL server management studio express always. I enabled TCP/IP from SQL server configuration manager. The sqljdbc.jar (JDBC driver) is set correctly in classpath and 1433 port is allowed in windows firewall. YET, I cant connect to sql server ...

64. SQL server migration    coderanch.com

65. JDBC for loading data into SQL Server    coderanch.com

You said 1000 takes 15 minutes, so you would expect 40x1000 to take in the order of 40x15 minutes (a long time) It is possible that he amount of data is taking time to transfer between machines (I am assuming a remote DB) and it is also possible that the database is not optimised for inserts (eg lots and lots of ...

66. JDBCRealm in Tomcat5.5 and SQLServer2005    coderanch.com

Yes, it's supposed to change. After I changed to SQL Server 2005 I stopped using the Microsoft driver (it had an SSL bug that I couldn't work around) and switched to the JTDS driver. So I don't have a working example of it here any more. I was hoping you would look in your documentation.

67. taking mssql backup using java program    coderanch.com

68. Using SQL Server 2005 jdbc    coderanch.com

Apologies again for another typo. I've had a few late nights. This is the code I'm actually using. Class.forName(jdbcDriverName); mConnection = DriverManager.getConnection(jdbcURL,jdbcUserName,jdbcPassword); jdbcDriverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver" I have included sqljdbc.jar at the top of my classpath and I have removed msbase.jar, msutil.jar and mssqlserver.jar although I also tried this before removing them. I'm using the same url as I did with the ...

69. jdbc SQL Server 2005 and character set    coderanch.com

70. good books for ms sql tutorial    coderanch.com

71. SqlServer: Login failed for user    coderanch.com

Hi, I've written a very simple jdbc login test program. And after all kinds of problems I've almost got it working. Almost, just can't seem to get past this "SQLServerException: Login failed for user xxxxx" problem. I created a test database (joms) then I created user user1 password1 (sql authenication) I added user1 to database joms. And after trying everything was ...

72. how to convert .csv files into sql server files using java    coderanch.com

I created dsn for csv file, using Microsoft Excel Driver. I can read data in java program using following code. I want to import data from csv file to oracle sql or sql server. How will I do that? import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.sql.Statement; import java.sql.ResultSet; public class CsvEx{ public static void main( String [] args ){ Connection ...

73. Use only 1 connection to SQL Server (newbie ?)    coderanch.com

What you need here is what is typically called a Singleton. You need a class that handles the database that there can only ever be one instance of. What you need to do is create a class to wrap you database. public Class DBHandler{ //The instance private DBHandler dbHandler = new DBHandler(); //Private so no one can access it externally private ...

74. MS SQL BIGINT not accessible in java    coderanch.com

75. jdbc and sql server connection    coderanch.com

76. SQL server 2005 connection from java    coderanch.com

77. Loading/Fetching data from SAP (ERP) to SQL Server 2005    coderanch.com

Hello there, I have my dedicated database (SQL Server 2005) for my java web application but I wanted to get/fetch the data from SAP (ERP system) which holds typically an ecommerce data (Sales,price and inventory data) say daily once as a batch process. What will be the best approaches to deal with this task? The sub task I have identified is, ...

78. Sql-server    coderanch.com

hello, i am doing a project in jsp. As i'm in need to store lumpsum of data in the database(SQL-Server), i used text data type for that. I heard that using text datatype, we can store as much as 2 GB of information. But when i'm entering the data, it's storing just 2 KB. At the end it's showing a pointer, ...

79. BLOB & CLOB - SQL Server    coderanch.com

81. Reading from SQL Server    coderanch.com

82. SQL Server DB connection    coderanch.com

I am working with the following method trying to get a database connection to the sql server on my local PC: public void testMS(){ Connection con = null; String hostname = "THR0011432AE125"; // my machine try { Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver"); con = DriverManager.getConnection("jdbc:microsoft:sqlserver://"+ hostname +":1433"); Statement stmt = con.createStatement(); ResultSet rs= stmt.executeQuery("SELECT * FROM CUSTOMERS"); while (rs.next()) { String field = rs.getString(1); String ...

83. SQL Server Connection question    coderanch.com

I have the following class whereby I am trying to make a database connection to a SQL database that is sitting on my PC: public class SQLServerTest implements Runnable { public static void main(String [ ] args){ new SQLServerTest().run(); } public void run() { testMS(); } public void testMS(){ Connection con = null; String hostname = "localhost"; // current machine try ...

84. limit clause in MS SQL    coderanch.com

86. How to check if triggers are enabled in MS SQL Server database?    coderanch.com

Hi Tom I am not sure but try executing this query using your favourite SQL query browser SELECT T.[name] as TableName, TR.[Name] as TriggerName, CASE WHEN 1=OBJECTPROPERTY(TR.[id], 'ExecIsTriggerDisabled')THEN 'Disabled' ELSE 'Enabled' END Status FROM sysobjects T INNER JOIN sysobjects TR on t.[ID] = TR.parent_obj WHERE (T.xtype = 'U' or T.XType = 'V') AND (TR.xtype = 'TR') ORDER BY T.[name], TR.[name] this ...

87. List all available sql server running on my lan/network    coderanch.com

No. You could write a Java program that tried to discover SQL Server instances by connecting to every node in your LAN on port 1433 and examining the response. However, you would still need to discover evey node in the LAN and you would not be able to discover the SQL Server instances that are not configured to allow TCP/IP connections ...

88. MS SQL Server and Java...    coderanch.com

I use MS SQL Server all day every day at work, but I do all my code development in vb.net and C#.Net. I'm currently studying for the scjp 1.5 and I was thinking about how one would go about connecting to a SQL Server database and executing not only straight SQL queries, but also Stored Procedures. I've tried to look up ...

89. MSSQL Server datasource wont commit    coderanch.com

Hi, I set up a connection to my datasource in Websphere. This is then configured in my application using the spring config below. As you can see it uses JNDI to look up the resource.

90. sql server logs    coderanch.com

I have an entity that inserts few records in a table. This is throwing exception at the time of execution. Is there a way I can lookup more detailed information in SQL Server logs and figure out why the transactions are not succeeding? I know this is a database question and probably not posted in the right forum. But in case ...

91. Integrating J2EE application with SQL Server Reporting Services    coderanch.com

Hello everybody, I want to integrate a J2EE application with SQL Server 2005 Reporting Services. In fact, it is the first time to be involved in developing an interoperability component between .Net web service and Java application. So I have learned for some time how to pass this challenge. Moreover, I found the following virtual lab is an excellent starting point ...

92. SQL Server - netbeans Connection problem    coderanch.com

i'm trying to have a connection my abblication through netbeans and SQL server Express 2008 1- i downloaded the sqlserver JDBC drivers 2- i added it to the IDE 3- i checked my firwall and opend the port 1433 4- checked the sql configurion and enabled the TCPIP protocol 5- by using the msconfig command i checked the sql server service ...

93. Enumerating SQL Server instances    coderanch.com

Hi All, I am trying to build an application which can enumerate MS SQL Servers in a LAN. There are few approaches in ODBC, and .Net which lets you do it. Such as SQLBrowseConnect (an ODBC API) and SMO, DMO etc. however, i want to build such functionality without extensively spending my time through JNI --> ODBC/SMO(.Net)/DMO(COM) approach. What could be ...

94. MSSQL and Unicode in WIndows and Linux    coderanch.com

Java application reads mssql table data (unicode data) and forward to servlet. This scenario works fine when I run application in Ubuntu. But performance changes for these following scenarios: secnario1: i move java application to windows which forwards database data to servlet running in ubuntu. Output in java app shows question marks (unicode issue) but servlet shows them correctly. Scenario2: move ...

95. Data migration from One SQL server to another SQL Server    coderanch.com

Hi, I need your views or thoughs to do below stuff. I have one real time database (production db) and another is backup database. There is 250 transaction happned per second on production db. So, I need all those transactions made available on another db as soon as possible after occurance. Appriciate in advance. Thanks Sandip

96. Problem in fetching data from sql server 2005    coderanch.com

Hi all, I have tried to fetch the values from my table named sample. It contains one field, it was named id. While I try to fetch the data It will throw exception. Name of my datasource is Sample. my code is following: ----------------------- package db; import java.sql.*; import java.util.*; public class ConnectUrl { public static void main(String[] args) { Connection ...

97. Binary datatype in MS SQL via JDBC    coderanch.com

You will have to create auto increment columns in the database, and don't attempt to set them from a client application. Don't even try to update the primary key. By the way: Why are you using binary? In MySQL you usually use serial which is shorthand for "longint unique auto_increment not null" or similar.

99. Arabic characters in MS sql    coderanch.com

Did you read the article? It is a fairly comprehensive description of what is causing your problem. You shouldn't need to uninstall the SQL Server client tools (and certainly you don't need to uninstall SQL Server it supports Arabic fine). Microsoft applications will all pick up the regional settings if you change them without needing reinstalled. Assuming your data model uses ...

100. Importing a SQLServer Schema using java    coderanch.com

Hi All, Does Java have any support for importing a SQL Server database ? I have a SQL Server database schema which I've backed up. So it's called something like "ms-schema.bak" Basically my application needs to take in as input a database backup (i.e a bak file) and actually restore the database Any help would be great on this.. Thanks, Ro. ...