Perl Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesPerl Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
  #1  
Old April 29th, 2008, 11:39 AM
CGI_Schneid CGI_Schneid is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 21 CGI_Schneid User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 20 m 51 sec
Reputation Power: 0
Connection string syntax for SQLExpress

#!perl

What is the syntax for connection string using SQLExpress, and do I need any other modules?

I am currently using mysql db, but trying to convert all CGI/perl code over to sqlexpress 05.

I am a noob, please help. Here is my current string:

$dbh = DBI->connect("DBI:mysql:database=" . dbconnect("Database") . ";host=" . dbconnect("Server"),dbconnect("DB_User"), dbconnect("DB_Password"),{'RaiseError' => 1})

JOhn

Reply With Quote
  #2  
Old April 29th, 2008, 12:29 PM
Axweildr's Avatar
Axweildr Axweildr is offline
CPAN medic ...
Click here for more information.
 
Join Date: Mar 2003
Location: Location: Location:
Posts: 10,905 Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)  Folding Points: 119844 Folding Title: Super Ultimate Folder - Level 1Folding Points: 119844 Folding Title: Super Ultimate Folder - Level 1Folding Points: 119844 Folding Title: Super Ultimate Folder - Level 1Folding Points: 119844 Folding Title: Super Ultimate Folder - Level 1Folding Points: 119844 Folding Title: Super Ultimate Folder - Level 1Folding Points: 119844 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 3 Weeks 6 Days 3 h 56 m 58 sec
Reputation Power: 2304
Send a message via Google Talk to Axweildr
Orkut
sql express 05 is effectively Microsoft's SQL server, you do know that there's a limit of 4GB's of data for a SQL server Express database?
__________________
--Ax
without exception, there is no rule ...
The great thing about Object Oriented code is that it can make small, simple problems look like large, complex ones


09 F9 11 02
9D 74 E3 5B
D8 41 56 C5
63 56 88 C0
Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.
-- Jamie Zawinski

Reply With Quote
  #3  
Old April 29th, 2008, 01:28 PM
CGI_Schneid CGI_Schneid is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 21 CGI_Schneid User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 20 m 51 sec
Reputation Power: 0
Quote:
Originally Posted by Axweildr
sql express 05 is effectively Microsoft's SQL server, you do know that there's a limit of 4GB's of data for a SQL server Express database?


Yes i knew that. I am simply trying to modify the string. I belive i just have to replace mysql with sqlexpress, but i wanted to ask to be sure. I may have other issues causing my app to not be able to change the dB. I want to be sure im using the correct syntax to connect to my dB.

Reply With Quote
  #4  
Old April 29th, 2008, 01:48 PM
CGI_Schneid CGI_Schneid is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 21 CGI_Schneid User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 20 m 51 sec
Reputation Power: 0
Quote:
Originally Posted by CGI_Schneid
Yes i knew that. I am simply trying to modify the string. I belive i just have to replace mysql with sqlexpress, but i wanted to ask to be sure. I may have other issues causing my app to not be able to change the dB. I want to be sure im using the correct syntax to connect to my dB.


BTW...regex is awsome...

Reply With Quote
  #5  
Old April 29th, 2008, 04:23 PM
atlantisstorm atlantisstorm is offline
Hang your freedom higher.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2005
Posts: 600 atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 10 h 14 m 2 sec
Reputation Power: 113
CGI_Schneid, you also need DBD::ODBC to support ODBC sql server...

Code:
use DBI;
use DBD::ODBC;

my $dbh = DBI->connect("dbi:ODBC:Driver={SQL Server};Server=<servername>;Database=<database_name>;", <username>, <password>, { 'PrintError' => 1, 'RaiseError' => 1 });
__________________
"Badges? We ain't got no badges. We don't need to badges! I don't have to show you any stinkin' badges!!"

Reply With Quote
  #6  
Old April 30th, 2008, 07:17 AM
CGI_Schneid CGI_Schneid is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 21 CGI_Schneid User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 20 m 51 sec
Reputation Power: 0
Quote:
Originally Posted by atlantisstorm
CGI_Schneid, you also need DBD::ODBC to support ODBC sql server...

Code:
use DBI;
use DBD::ODBC;

my $dbh = DBI->connect("dbi:ODBC:Driver={SQL Server};Server=<servername>;Database=<database_name>;", <username>, <password>, { 'PrintError' => 1, 'RaiseError' => 1 });


My problem iswhat to put for {SQL Server} and im not sure if in this string you typed, I should be putting MSSQL or SQLEXPRESS or LOCALHOST. I am not familliar witht the syntax. Please help.

Reply With Quote
  #7  
Old April 30th, 2008, 07:23 AM
atlantisstorm atlantisstorm is offline
Hang your freedom higher.
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jan 2005
Posts: 600 atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level)atlantisstorm User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 6 Days 10 h 14 m 2 sec
Reputation Power: 113
The driver type for for SQL Server AND SQL Server Express should be set to "SQL Server" (as shown), so you put exactly what I have put, with the exception of the variables within "<", ">" obviously you set them as appropriate to your environment.

Reply With Quote
  #8  
Old April 30th, 2008, 07:26 AM
Axweildr's Avatar
Axweildr Axweildr is offline
CPAN medic ...
Click here for more information.
 
Join Date: Mar 2003
Location: Location: Location:
Posts: 10,905 Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)  Folding Points: 119844 Folding Title: Super Ultimate Folder - Level 1Folding Points: 119844 Folding Title: Super Ultimate Folder - Level 1Folding Points: 119844 Folding Title: Super Ultimate Folder - Level 1Folding Points: 119844 Folding Title: Super Ultimate Folder - Level 1Folding Points: 119844 Folding Title: Super Ultimate Folder - Level 1Folding Points: 119844 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 3 Weeks 6 Days 3 h 56 m 58 sec
Reputation Power: 2304
Send a message via Google Talk to Axweildr
Orkut
Code:
my $dbh = DBI->connect(
          "dbi:ODBC:Driver={SQL Server};Server=servername;Database=database_name;", 
          "username", 
          "password", { 'PrintError' => 1, 'RaiseError' => 1 });

Change the bits in red ...

Reply With Quote
  #9  
Old May 1st, 2008, 07:34 AM
CGI_Schneid CGI_Schneid is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 21 CGI_Schneid User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 20 m 51 sec
Reputation Power: 0
Talking

Quote:
Originally Posted by Axweildr
Code:
my $dbh = DBI->connect(
          "dbi:ODBC:Driver={SQL Server};Server=servername;Database=database_name;", 
          "username", 
          "password", { 'PrintError' => 1, 'RaiseError' => 1 });

Change the bits in red ...

Thanks to both of you for your help. It has worked and saved me quite a bit of trouble. I should also point out to anyone reading this who is also a noob, you must also configure the ODBC driver. It is not very complicated but you must do it to have your conncetion work. I created one for system and one for user, i may not need them both but my configuration is a little different. Thanks for your help. This is a great forum with a wealth of information. Very valuable to those who want to stay employed!!



JOhn

Reply With Quote
  #10  
Old May 1st, 2008, 07:38 AM
CGI_Schneid CGI_Schneid is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2008
Posts: 21 CGI_Schneid User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 20 m 51 sec
Reputation Power: 0
Quote:
Originally Posted by CGI_Schneid
Thanks to both of you for your help. It has worked and saved me quite a bit of trouble. I should also point out to anyone reading this who is also a noob, you must also configure the ODBC driver. It is not very complicated but you must do it to have your conncetion work. I created one for system and one for user, i may not need them both but my configuration is a little different. Thanks for your help. This is a great forum with a wealth of information. Very valuable to those who want to stay employed!!



JOhn


One additional point of interest is that any time you change between MySQL and SQL or SQLExpress, check your sql statement syntax. Query language is not exactly the same, even though you might expect it to be. I was getting additional errors after i applied this connection string but they were steming from the sql statements. FYI.

Reply With Quote
  #11  
Old May 1st, 2008, 07:13 PM
Axweildr's Avatar
Axweildr Axweildr is offline
CPAN medic ...
Click here for more information.
 
Join Date: Mar 2003
Location: Location: Location:
Posts: 10,905 Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)Axweildr User rank is General 20th Grade (Above 100000 Reputation Level)  Folding Points: 119844 Folding Title: Super Ultimate Folder - Level 1Folding Points: 119844 Folding Title: Super Ultimate Folder - Level 1Folding Points: 119844 Folding Title: Super Ultimate Folder - Level 1Folding Points: 119844 Folding Title: Super Ultimate Folder - Level 1Folding Points: 119844 Folding Title: Super Ultimate Folder - Level 1Folding Points: 119844 Folding Title: Super Ultimate Folder - Level 1
Time spent in forums: 3 Months 3 Weeks 6 Days 3 h 56 m 58 sec
Reputation Power: 2304
Send a message via Google Talk to Axweildr
Orkut
you're not the first, it's unlikely you'll be the last ... don't sweat, but clues are good ... if you comply to ANSI SQL statements, you should be good, but it's nice to know what's on offer at market

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesPerl Programming > Connection string syntax for SQLExpress


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

 Free IT White Papers!